apscale-installer 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- apscale_installer/__init__.py +0 -0
- apscale_installer/__main__.py +149 -0
- apscale_installer-0.1.dist-info/LICENSE +21 -0
- apscale_installer-0.1.dist-info/METADATA +25 -0
- apscale_installer-0.1.dist-info/RECORD +8 -0
- apscale_installer-0.1.dist-info/WHEEL +5 -0
- apscale_installer-0.1.dist-info/entry_points.txt +2 -0
- apscale_installer-0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import shutil
|
|
3
|
+
import requests
|
|
4
|
+
import os
|
|
5
|
+
import tarfile
|
|
6
|
+
import subprocess
|
|
7
|
+
import json
|
|
8
|
+
import platform
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
def download_blast(url, file_name):
|
|
12
|
+
########################################################################################################################
|
|
13
|
+
## Download
|
|
14
|
+
|
|
15
|
+
## download the tar.gz file
|
|
16
|
+
response = requests.get(url)
|
|
17
|
+
with open(file_name, "wb") as file:
|
|
18
|
+
file.write(response.content)
|
|
19
|
+
|
|
20
|
+
print("Download complete!")
|
|
21
|
+
|
|
22
|
+
########################################################################################################################
|
|
23
|
+
## Extract
|
|
24
|
+
|
|
25
|
+
extract_path = os.path.dirname(file_name)
|
|
26
|
+
|
|
27
|
+
# Open the tar.gz file
|
|
28
|
+
with tarfile.open(file_name, "r:gz") as tar:
|
|
29
|
+
# Extract all the contents to the same directory
|
|
30
|
+
tar.extractall(path=extract_path)
|
|
31
|
+
print("Unpacking complete!")
|
|
32
|
+
|
|
33
|
+
########################################################################################################################
|
|
34
|
+
## Find install directory
|
|
35
|
+
|
|
36
|
+
# Run the conda info command
|
|
37
|
+
result = subprocess.run(['conda', 'info', '--json'], stdout=subprocess.PIPE)
|
|
38
|
+
# Parse the JSON output
|
|
39
|
+
conda_info = json.loads(result.stdout)
|
|
40
|
+
# Get the current environment path
|
|
41
|
+
env_path = Path(conda_info['default_prefix'] + '/bin')
|
|
42
|
+
print(f'Installing to: {env_path}')
|
|
43
|
+
|
|
44
|
+
## create bin folder if necessary
|
|
45
|
+
os.makedirs(env_path, exist_ok=True)
|
|
46
|
+
|
|
47
|
+
########################################################################################################################
|
|
48
|
+
## Move files to bin
|
|
49
|
+
|
|
50
|
+
# Collect files
|
|
51
|
+
folder = file_name.split('+-')[0] + '+'
|
|
52
|
+
bin_files = glob.glob(str(Path(f'./{extract_path}/{folder}/bin/*')))
|
|
53
|
+
|
|
54
|
+
# Move files
|
|
55
|
+
for file in bin_files:
|
|
56
|
+
moved_file = env_path.joinpath(Path(file).name)
|
|
57
|
+
shutil.copy(file, moved_file)
|
|
58
|
+
print("Finished installation!")
|
|
59
|
+
|
|
60
|
+
########################################################################################################################
|
|
61
|
+
## Update PATH
|
|
62
|
+
|
|
63
|
+
os.environ["PATH"] += os.pathsep + str(env_path)
|
|
64
|
+
print(f"Updated PATH: {os.environ['PATH']}")
|
|
65
|
+
|
|
66
|
+
def download_vsearch(url, file_name):
|
|
67
|
+
########################################################################################################################
|
|
68
|
+
## Download
|
|
69
|
+
|
|
70
|
+
## download the tar.gz file
|
|
71
|
+
response = requests.get(url)
|
|
72
|
+
with open(file_name, "wb") as file:
|
|
73
|
+
file.write(response.content)
|
|
74
|
+
|
|
75
|
+
print("Download complete!")
|
|
76
|
+
|
|
77
|
+
########################################################################################################################
|
|
78
|
+
## Extract
|
|
79
|
+
|
|
80
|
+
extract_path = os.path.dirname(file_name)
|
|
81
|
+
|
|
82
|
+
# Open the tar.gz file
|
|
83
|
+
with tarfile.open(file_name, "r:gz") as tar:
|
|
84
|
+
# Extract all the contents to the same directory
|
|
85
|
+
tar.extractall(path=extract_path)
|
|
86
|
+
print("Unpacking complete!")
|
|
87
|
+
|
|
88
|
+
########################################################################################################################
|
|
89
|
+
## Find install directory
|
|
90
|
+
|
|
91
|
+
# Run the conda info command
|
|
92
|
+
result = subprocess.run(['conda', 'info', '--json'], stdout=subprocess.PIPE)
|
|
93
|
+
# Parse the JSON output
|
|
94
|
+
conda_info = json.loads(result.stdout)
|
|
95
|
+
# Get the current environment path
|
|
96
|
+
env_path = Path(conda_info['default_prefix'] + '/bin')
|
|
97
|
+
print(f'Installing to: {env_path}')
|
|
98
|
+
|
|
99
|
+
## create bin folder if necessary
|
|
100
|
+
os.makedirs(env_path, exist_ok=True)
|
|
101
|
+
|
|
102
|
+
########################################################################################################################
|
|
103
|
+
## Move files to bin
|
|
104
|
+
|
|
105
|
+
# Collect files
|
|
106
|
+
folder = file_name.replace('.tar.gz', '')
|
|
107
|
+
bin_files = glob.glob(str(Path(f'./{extract_path}/{folder}/bin/*')))
|
|
108
|
+
|
|
109
|
+
# Move files
|
|
110
|
+
for file in bin_files:
|
|
111
|
+
moved_file = env_path.joinpath(Path(file).name)
|
|
112
|
+
shutil.copy(file, moved_file)
|
|
113
|
+
print("Finished installation!")
|
|
114
|
+
|
|
115
|
+
########################################################################################################################
|
|
116
|
+
## Update PATH
|
|
117
|
+
|
|
118
|
+
os.environ["PATH"] += os.pathsep + str(env_path)
|
|
119
|
+
print(f"Updated PATH: {os.environ['PATH']}")
|
|
120
|
+
|
|
121
|
+
if __name__ == "__main__":
|
|
122
|
+
## OS-specific download
|
|
123
|
+
current_os = platform.system()
|
|
124
|
+
|
|
125
|
+
if current_os == "Windows":
|
|
126
|
+
# blastn+
|
|
127
|
+
print('\nInstalling blast+:')
|
|
128
|
+
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-win64.tar.gz"
|
|
129
|
+
file_name = url.split('/')[-1]
|
|
130
|
+
download_blast(url, file_name)
|
|
131
|
+
|
|
132
|
+
## vsearch
|
|
133
|
+
print('\nInstalling vsearch:')
|
|
134
|
+
url = 'https://github.com/torognes/vsearch/releases/download/v2.28.1/vsearch-2.28.1-win-x86_64.zip'
|
|
135
|
+
file_name = url.split('/')[-1]
|
|
136
|
+
download_vsearch(url, file_name)
|
|
137
|
+
|
|
138
|
+
elif current_os == "Darwin":
|
|
139
|
+
# blastn+
|
|
140
|
+
print('\nInstalling blast+:')
|
|
141
|
+
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-macosx.tar.gz"
|
|
142
|
+
file_name = url.split('/')[-1]
|
|
143
|
+
download_blast(url, file_name)
|
|
144
|
+
|
|
145
|
+
## vsearch
|
|
146
|
+
print('\nInstalling vsearch:')
|
|
147
|
+
url = 'https://github.com/torognes/vsearch/releases/download/v2.28.1/vsearch-2.28.1-macos-aarch64.tar.gz'
|
|
148
|
+
file_name = url.split('/')[-1]
|
|
149
|
+
download_vsearch(url, file_name)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Till-Hendrik Macher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: apscale_installer
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data - Conda installer (workaround)
|
|
5
|
+
Home-page: https://pypi.org/project/apscale_installer/
|
|
6
|
+
Author: Till-Hendrik Macher
|
|
7
|
+
Author-email: macher@uni-trier.de
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: Requests ==2.32.3
|
|
16
|
+
|
|
17
|
+
# apscale
|
|
18
|
+
Advanced Pipeline for Simple yet Comprehensive AnaLysEs of DNA metabarcoding data
|
|
19
|
+
|
|
20
|
+
[](https://pepy.tech/project/apscale) - apscale
|
|
21
|
+
|
|
22
|
+
[](https://pepy.tech/project/apscale-blast) - apscale_blast
|
|
23
|
+
|
|
24
|
+
# apscale installer
|
|
25
|
+
A script to automatically download and install vsearch and blastn on Windows and MacOS (aarch64) until both dependencies are released for conda.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
apscale_installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
apscale_installer/__main__.py,sha256=pOVGfj9k486yOmarC890Zdls9adYDJucZa8tx-aYfFU,5341
|
|
3
|
+
apscale_installer-0.1.dist-info/LICENSE,sha256=1MgYyubrJEbXbG9vvX38G-kZ5VzkilTiXpALpQqFyJA,1075
|
|
4
|
+
apscale_installer-0.1.dist-info/METADATA,sha256=XUwtUcalm1JvNTNGGFSZsAPfo26t3VlsqYUzw7xgnUc,1057
|
|
5
|
+
apscale_installer-0.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
6
|
+
apscale_installer-0.1.dist-info/entry_points.txt,sha256=K3zmxU24KnbEHam7PAywW4G25I3wCbML32aowSXfz9M,70
|
|
7
|
+
apscale_installer-0.1.dist-info/top_level.txt,sha256=tEBdToWqQg545J0MLLXrwiaEtN7gAQyoZwi-lkhw62Y,18
|
|
8
|
+
apscale_installer-0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
apscale_installer
|