forked from navduhan/pyseqrna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINSTALL
executable file
·121 lines (105 loc) · 5.12 KB
/
INSTALL
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
#!/bin/sh
############################################################
## ##
## install pySeqRNA ##
## Author: Naveen Duhan ##
## ##
############################################################
# Check if script is executed using Bash
if [ -n "$BASH_VERSION" ]; then
SHELL_TYPE="bash"
elif [ -n "$ZSH_VERSION" ]; then
SHELL_TYPE="zsh"
else
SHELL_TYPE="sh"
fi
# Function to check if a command is available
command_exists() {
command -v "$1" >/dev/null 2>&1
}
echo "\nPlease wait, checking development environment..."
# Check operating system
OS=$(uname -s)
if [ "$OS" = "Linux" ]; then
echo "\nLinux development environment found\nProceeding with Linux-based installation\n"
elif [ "$OS" = "Darwin" ]; then
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
echo "\nARM64 Darwin development environment found\nProceeding with ARM64-based macOS installation\n"
else
echo "\nIntel Darwin development environment found\nProceeding with Intel-based macOS installation\n"
fi
else
echo "\nUnsupported operating system: $OS\nPlease install using dockerfile\n"
exit 1
fi
# Check if Miniconda is already installed
if [ ! -d "$HOME/miniconda3" ]; then
echo "Miniconda3 is not installed. Installing..."
# Download Miniconda installer based on OS and architecture
if [ "$OS" = "Linux" ]; then
echo "\nDownloading Miniconda3 for Linux\n"
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh || { echo "Error: Failed to download Miniconda for Linux."; exit 1; }
elif [ "$OS" = "Darwin" ]; then
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
echo "\nDownloading Miniconda3 for ARM-based macOS\n"
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -O miniconda.sh || { echo "Error: Failed to download Miniconda for ARM-based macOS."; exit 1; }
echo "\nNot all software compiles on ARM-based macOS; adding osx-x64 subdir\n"
conda config --env --set subdir osx-x64
else
echo "\nDownloading Miniconda3 for Intel-based macOS\n"
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh || { echo "Error: Failed to download Miniconda for Intel-based macOS."; exit 1; }
fi
else
echo "\nUnsupported operating system: $OS\nPlease install using dockerfile\n"
exit 1
fi
echo "\nInstalling Miniconda3 environment...\n"
sh miniconda.sh -b -p ~/miniconda3 || { echo "Error: Miniconda installation failed."; exit 1; }
fi
# Activate Miniconda
. ~/miniconda3/bin/activate || { echo "Error: Failed to activate Miniconda."; exit 1; }
# Check if the conda environment already exists
if conda env list | grep -q "pyseqrna-0.2"; then
echo "pySeqRNA environment already exists. Deleting and recreating..."
conda env remove -n pyseqrna-0.2 --yes || { echo "Error: Failed to remove existing pySeqRNA environment."; exit 1; }
fi
echo "Creating pySeqRNA conda environment...\n"
# Install dependencies via conda
if [ "$OS" = "Linux" ]; then
conda env create -f pyseqrna_environment.yml || { echo "Error: Failed to create pySeqRNA conda environment."; exit 1; }
elif [ "$OS" = "Darwin" ]; then
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
# Activate the environment
CONDA_SUBDIR=osx-64 conda env create -f pyseqrna_environment.yml || { echo "Error: Failed to create pySeqRNA conda environment."; exit 1; }
else
conda env create -f pyseqrna_environment.yml || { echo "Error: Failed to create pySeqRNA conda environment."; exit 1; }
fi
else
echo "\nUnsupported operating system: $OS\nPlease install using dockerfile\n"
exit 1
fi
conda activate pyseqrna-0.2 || { echo "Error: Failed to activate pySeqRNA environment."; exit 1; }
# Install pySeqRNA
echo "\nInstalling pySeqRNA package\n"
pip install . || { echo "Error: Failed to install pySeqRNA package."; exit 1; }
# Set up initialization for shell
if [ "$SHELL_TYPE" = "bash" ]; then
conda init "$SHELL_TYPE" >/dev/null 2>&1
echo "source ~/miniconda3/bin/activate pyseqrna-0.2" >>~/.bashrc
source ~/.bashrc
elif [ "$SHELL_TYPE" = "zsh" ]; then
conda init "$SHELL_TYPE" >/dev/null 2>&1
echo "source ~/miniconda3/bin/activate pyseqrna-0.2" >>~/.zshrc
source ~/.zshrc
fi
echo "\n\npySeqRNA installation successfully completed\nThank you for using pySeqRNA\n\nTo execute pyseqrna, run:\n\nsource ~/miniconda3/bin/activate pyseqrna-0.2\n\npyseqrna -h\n\n"
##################################################################
## ##
## Written by Naveen Duhan (naveen.duhan@outlook.com) ##
## Kaundal Bioinformatics Lab, Utah State University ##
## Released under the terms of GNU General Public Licence v3 ##
## ##
##################################################################