-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·175 lines (145 loc) · 4.52 KB
/
install.sh
File metadata and controls
executable file
·175 lines (145 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/usr/bin/env bash
# Installation script for WGS Extract v6 (Linux/macOS)
set -e # Exit on error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo "=================================================="
echo "WGS Extract v6 - Installation"
echo "=================================================="
echo ""
# Detect platform
OS="$(uname -s)"
case "${OS}" in
Linux*) PLATFORM=Linux;;
Darwin*) PLATFORM=macOS;;
*) PLATFORM="UNKNOWN:${OS}"
esac
echo "Platform detected: ${PLATFORM}"
echo ""
# Check Python version
echo "Checking Python installation..."
if ! command -v python3 &> /dev/null; then
echo -e "${RED}Error: Python 3 is not installed${NC}"
echo "Please install Python 3.13 or later"
exit 1
fi
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d'.' -f1)
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d'.' -f2)
echo "Python version: $PYTHON_VERSION"
if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 10 ]); then
echo -e "${YELLOW}Warning: Python 3.13+ recommended, you have $PYTHON_VERSION${NC}"
echo -e "${YELLOW}Some features may not work correctly${NC}"
fi
echo ""
# Check for samtools
echo "Checking for samtools..."
if command -v samtools &> /dev/null; then
SAMTOOLS_VERSION=$(samtools --version | head -n1 | awk '{print $2}')
echo -e "${GREEN}samtools found: version $SAMTOOLS_VERSION${NC}"
else
echo -e "${YELLOW}Warning: samtools not found${NC}"
echo "samtools is required for coverage calculations"
echo "Install it using:"
if [ "$PLATFORM" == "Linux" ]; then
echo " sudo apt-get install samtools # Debian/Ubuntu"
echo " sudo yum install samtools # RedHat/CentOS"
elif [ "$PLATFORM" == "macOS" ]; then
echo " brew install samtools # Homebrew"
echo " sudo port install samtools # MacPorts"
fi
fi
echo ""
# Check for BWA
echo "Checking for BWA..."
if command -v bwa &> /dev/null; then
BWA_VERSION=$(bwa 2>&1 | grep Version | awk '{print $2}')
echo -e "${GREEN}BWA found: version $BWA_VERSION${NC}"
else
echo -e "${YELLOW}Warning: BWA not found${NC}"
echo "BWA is required for alignment operations"
echo "Install it using:"
if [ "$PLATFORM" == "Linux" ]; then
echo " sudo apt-get install bwa # Debian/Ubuntu"
echo " sudo yum install bwa # RedHat/CentOS"
elif [ "$PLATFORM" == "macOS" ]; then
echo " brew install bwa # Homebrew"
echo " sudo port install bwa # MacPorts"
fi
fi
echo ""
# Create virtual environment
echo "Creating Python virtual environment..."
if [ -d "venv" ]; then
echo -e "${YELLOW}Virtual environment already exists${NC}"
read -p "Recreate it? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf venv
python3 -m venv venv
fi
else
python3 -m venv venv
fi
echo ""
# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo "Upgrading pip..."
pip install --upgrade pip wheel setuptools
echo ""
# Install dependencies
echo "Installing dependencies..."
pip install -r requirements.txt
echo ""
# Install development dependencies (optional)
read -p "Install development dependencies? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
pip install -r requirements-dev.txt
fi
echo ""
# Install package in editable mode
echo "Installing WGS Extract..."
pip install -e .
echo ""
# Create directories
echo "Creating directories..."
mkdir -p reference/genomes
mkdir -p reference/liftover
mkdir -p reference/microarray_templates
mkdir -p output
mkdir -p temp
echo ""
# Create launcher script
echo "Creating launcher script..."
cat > wgsextract.sh << 'EOF'
#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/venv/bin/activate"
python -m wgsextract "$@"
EOF
chmod +x wgsextract.sh
echo ""
echo -e "${GREEN}=================================================="
echo "Installation complete!"
echo "==================================================${NC}"
echo ""
echo "To run WGS Extract:"
echo " 1. Activate virtual environment:"
echo " source venv/bin/activate"
echo " 2. Run the application:"
echo " python -m wgsextract"
echo ""
echo "Or use the launcher:"
echo " ./wgsextract.sh"
echo ""
echo "For help:"
echo " python -m wgsextract --help"
echo ""