Mercurial > repos > iuc > data_manager_mothur_toolsuite
annotate data_manager/fetch_mothur_reference_data.py @ 4:0db22932bc39 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
author | iuc |
---|---|
date | Fri, 25 Jun 2021 09:37:05 +0000 |
parents | 9d09724f2bf1 |
children |
rev | line source |
---|---|
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
1 #!/usr/bin/env python3 |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
2 # |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
3 # Data manager for reference data for the 'mothur_toolsuite' Galaxy tools |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
4 import io |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
5 import json |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
6 import optparse |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
7 import os |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
8 import shutil |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
9 import sys |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
10 import tarfile |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
11 import tempfile |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
12 import urllib.error |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
13 import urllib.parse |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
14 import urllib.request |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
15 import zipfile |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
16 from functools import reduce |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
17 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
18 # When extracting files from archives, skip names that |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
19 # start with the following strings |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
20 IGNORE_PATHS = ('.', '__MACOSX/', '__') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
21 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
22 # Map file extensions to data table names |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
23 MOTHUR_FILE_TYPES = {".map": "map", |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
24 ".fasta": "aligndb", |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
25 ".align": "aligndb", |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
26 ".pat": "lookup", |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
27 ".tax": "taxonomy"} |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
28 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
29 # Reference data URLs |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
30 MOTHUR_REFERENCE_DATA = { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
31 # Look up data |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
32 # http://www.mothur.org/wiki/Lookup_files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
33 "lookup_titanium": { |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
34 "GS FLX Titanium": ["https://mothur.s3.us-east-2.amazonaws.com/wiki/lookup_titanium.zip", ] |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
35 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
36 "lookup_gsflx": { |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
37 "GSFLX": ["https://mothur.s3.us-east-2.amazonaws.com/wiki/lookup_gsflx.zip", ] |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
38 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
39 "lookup_gs20": { |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
40 "GS20": ["https://mothur.s3.us-east-2.amazonaws.com/wiki/lookup_gs20.zip", ] |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
41 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
42 # RDP reference files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
43 # http://www.mothur.org/wiki/RDP_reference_files |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
44 "RDP_v18": { |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
45 "16S rRNA RDP training set 18": |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
46 [ |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
47 "https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset18_062020.rdp.tgz", ], |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
48 "16S rRNA PDS training set 18": |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
49 [ |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
50 "https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset18_062020.pds.tgz", ], |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
51 }, |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
52 "RDP_v16": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
53 "16S rRNA RDP training set 16": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
54 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset16_022016.rdp.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
55 "16S rRNA PDS training set 16": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
56 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset16_022016.pds.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
57 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
58 "RDP_v14": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
59 "16S rRNA RDP training set 14": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
60 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset14_032015.rdp.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
61 "16S rRNA PDS training set 14": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
62 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset14_032015.pds.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
63 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
64 "RDP_v10": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
65 "16S rRNA RDP training set 10": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
66 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset10_082014.rdp.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
67 "16S rRNA PDS training set 10": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
68 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset10_082014.pds.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
69 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
70 "RDP_v9": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
71 "16S rRNA RDP training set 9": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
72 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset9_032012.rdp.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
73 "16S rRNA PDS training set 9": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
74 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset9_032012.pds.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
75 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
76 "RDP_v7": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
77 "16S rRNA RDP training set 7": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
78 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset7_112011.rdp.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
79 "16S rRNA PDS training set 7": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
80 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/trainset7_112011.pds.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
81 "8S rRNA Fungi training set 7": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
82 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/fungilsu_train_v7.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
83 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
84 "RDP_v6": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
85 "RDP training set 6": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
86 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/rdptrainingset.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
87 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
88 # Silva reference files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
89 # http://www.mothur.org/wiki/Silva_reference_files |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
90 "silva_release_138.1": { |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
91 "SILVA release 138.1": |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
92 [ |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
93 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.nr_v138_1.tgz", |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
94 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.seed_v138_1.tgz", ], |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
95 }, |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
96 "silva_release_128": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
97 "SILVA release 128": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
98 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.nr_v128.tgz", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
99 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.seed_v128.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
100 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
101 "silva_release_123": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
102 "SILVA release 123": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
103 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.nr_v123.tgz", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
104 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.seed_v123.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
105 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
106 "silva_release_119": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
107 "SILVA release 119": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
108 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.nr_v119.tgz", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
109 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.seed_v119.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
110 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
111 "silva_release_102": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
112 "SILVA release 102": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
113 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.bacteria.zip", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
114 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.archaea.zip", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
115 "https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.eukarya.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
116 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
117 "silva_gold_bacteria": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
118 "SILVA gold": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
119 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva.gold.bacteria.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
120 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
121 # Greengenes |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
122 # http://www.mothur.org/wiki/Greengenes-formatted_databases |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
123 "greengenes_August2013": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
124 "Greengenes August 2013": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
125 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/gg_13_8_99.refalign.tgz", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
126 "https://mothur.s3.us-east-2.amazonaws.com/wiki/gg_13_8_99.taxonomy.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
127 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
128 "greengenes_May2013": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
129 "Greengenes May 2013": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
130 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/gg_13_5_99.refalign.tgz", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
131 "https://mothur.s3.us-east-2.amazonaws.com/wiki/gg_13_5_99.taxonomy.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
132 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
133 "greengenes_old": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
134 "Greengenes pre-May 2013": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
135 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/greengenes.alignment.zip", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
136 "https://mothur.s3.us-east-2.amazonaws.com/wiki/greengenes.tax.tgz", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
137 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
138 "greengenes_gold_alignment": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
139 "Greengenes gold alignment": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
140 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/greengenes.gold.alignment.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
141 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
142 # Secondary structure maps |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
143 # http://www.mothur.org/wiki/Secondary_structure_map |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
144 "secondary_structure_maps_silva": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
145 "SILVA": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
146 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/silva_ss_map.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
147 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
148 "secondary_structure_maps_greengenes": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
149 "Greengenes": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
150 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/gg_ss_map.zip", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
151 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
152 # Lane masks: not used here? |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
153 "lane_masks": { |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
154 "Greengenes-compatible": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
155 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/Lane1241.gg.filter", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
156 "https://mothur.s3.us-east-2.amazonaws.com/wiki/lane1287.gg.filter", |
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
157 "https://mothur.s3.us-east-2.amazonaws.com/wiki/lane1349.gg.filter", ], |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
158 "SILVA-compatible": |
2
0e532fc0a0a6
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit b824ec6d0faa5353c5893b5a2a540b8251cae309"
iuc
parents:
1
diff
changeset
|
159 ["https://mothur.s3.us-east-2.amazonaws.com/wiki/lane1349.silva.filter", ] |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
160 }, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
161 } |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
162 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
163 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
164 # Utility functions for interacting with Galaxy JSON |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
165 def read_input_json(jsonfile): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
166 """Read the JSON supplied from the data manager tool |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
167 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
168 Returns a tuple (param_dict,extra_files_path) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
169 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
170 'param_dict' is an arbitrary dictionary of parameters |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
171 input into the tool; 'extra_files_path' is the path |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
172 to a directory where output files must be put for the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
173 receiving data manager to pick them up. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
174 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
175 NB the directory pointed to by 'extra_files_path' |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
176 doesn't exist initially, it is the job of the script |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
177 to create it if necessary. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
178 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
179 """ |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
180 with open(jsonfile) as fh: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
181 params = json.load(fh) |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
182 return (params['param_dict'], |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
183 params['output_data'][0]['extra_files_path']) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
184 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
185 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
186 # Utility functions for creating data table dictionaries |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
187 # |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
188 # Example usage: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
189 # >>> d = create_data_tables_dict() |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
190 # >>> add_data_table(d,'my_data') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
191 # >>> add_data_table_entry(dict(dbkey='hg19',value='human')) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
192 # >>> add_data_table_entry(dict(dbkey='mm9',value='mouse')) |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
193 # >>> print(json.dumps(d)) |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
194 def create_data_tables_dict(): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
195 """Return a dictionary for storing data table information |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
196 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
197 Returns a dictionary that can be used with 'add_data_table' |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
198 and 'add_data_table_entry' to store information about a |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
199 data table. It can be converted to JSON to be sent back to |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
200 the data manager. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
201 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
202 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
203 d = {} |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
204 d['data_tables'] = {} |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
205 return d |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
206 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
207 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
208 def add_data_table(d, table): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
209 """Add a data table to the data tables dictionary |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
210 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
211 Creates a placeholder for a data table called 'table'. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
212 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
213 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
214 d['data_tables'][table] = [] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
215 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
216 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
217 def add_data_table_entry(d, table, entry): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
218 """Add an entry to a data table |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
219 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
220 Appends an entry to the data table 'table'. 'entry' |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
221 should be a dictionary where the keys are the names of |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
222 columns in the data table. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
223 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
224 Raises an exception if the named data table doesn't |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
225 exist. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
226 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
227 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
228 try: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
229 d['data_tables'][table].append(entry) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
230 except KeyError: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
231 raise Exception("add_data_table_entry: no table '%s'" % table) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
232 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
233 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
234 # Utility functions for downloading and unpacking archive files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
235 def download_file(url, target=None, wd=None): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
236 """Download a file from a URL |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
237 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
238 Fetches a file from the specified URL. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
239 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
240 If 'target' is specified then the file is saved to this |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
241 name; otherwise it's saved as the basename of the URL. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
242 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
243 If 'wd' is specified then it is used as the 'working |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
244 directory' where the file will be save on the local |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
245 system. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
246 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
247 Returns the name that the file is saved with. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
248 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
249 """ |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
250 print(f"Downloading {url}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
251 if not target: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
252 target = os.path.basename(url) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
253 if wd: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
254 target = os.path.join(wd, target) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
255 print(f"Saving to {target}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
256 with open(target, 'wb') as fh: |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
257 url_h = urllib.request.urlopen(url) |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
258 while True: |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
259 buffer = url_h.read(io.DEFAULT_BUFFER_SIZE) |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
260 if buffer == b"": |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
261 break |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
262 fh.write(buffer) |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
263 return target |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
264 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
265 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
266 def unpack_zip_archive(filen, wd=None): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
267 """Extract files from a ZIP archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
268 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
269 Given a ZIP archive, extract the files it contains |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
270 and return a list of the resulting file names and |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
271 paths. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
272 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
273 'wd' specifies the working directory to extract |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
274 the files to, otherwise they are extracted to the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
275 current working directory. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
276 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
277 Once all the files are extracted the ZIP archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
278 file is deleted from the file system. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
279 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
280 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
281 if not zipfile.is_zipfile(filen): |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
282 print(f"{filen}: not ZIP formatted file") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
283 return [filen] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
284 file_list = [] |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
285 with zipfile.ZipFile(filen) as z: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
286 for name in z.namelist(): |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
287 if reduce(lambda x, y: x or name.startswith(y), IGNORE_PATHS, False): |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
288 print(f"Ignoring {name}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
289 continue |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
290 if wd: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
291 target = os.path.join(wd, name) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
292 else: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
293 target = name |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
294 if name.endswith('/'): |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
295 # Make directory |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
296 print(f"Creating dir {target}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
297 try: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
298 os.makedirs(target) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
299 except OSError: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
300 pass |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
301 else: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
302 # Extract file |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
303 print("Extracting {target}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
304 try: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
305 os.makedirs(os.path.dirname(target)) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
306 except OSError: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
307 pass |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
308 with open(target, 'wb') as fh: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
309 fh.write(z.read(name)) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
310 file_list.append(target) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
311 print(f"Removing {filen}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
312 os.remove(filen) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
313 return file_list |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
314 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
315 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
316 def unpack_tar_archive(filen, wd=None): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
317 """Extract files from a TAR archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
318 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
319 Given a TAR archive (which optionally can be |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
320 compressed with either gzip or bz2), extract the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
321 files it contains and return a list of the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
322 resulting file names and paths. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
323 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
324 'wd' specifies the working directory to extract |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
325 the files to, otherwise they are extracted to the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
326 current working directory. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
327 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
328 Once all the files are extracted the TAR archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
329 file is deleted from the file system. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
330 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
331 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
332 file_list = [] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
333 if not tarfile.is_tarfile(filen): |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
334 print(f"{filen}: not TAR file") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
335 return [filen] |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
336 with tarfile.open(filen) as t: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
337 for name in t.getnames(): |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
338 # Check for unwanted files |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
339 if reduce(lambda x, y: x or name.startswith(y), IGNORE_PATHS, False): |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
340 print(f"Ignoring {name}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
341 continue |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
342 # Extract file |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
343 print(f"Extracting {name}") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
344 t.extract(name, wd) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
345 if wd: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
346 target = os.path.join(wd, name) |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
347 else: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
348 target = name |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
349 file_list.append(target) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
350 print(f"Removing {filen}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
351 os.remove(filen) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
352 return file_list |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
353 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
354 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
355 def unpack_archive(filen, wd=None): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
356 """Extract files from an archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
357 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
358 Wrapper function that calls the appropriate |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
359 unpacking function depending on the archive |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
360 type, and returns a list of files that have |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
361 been extracted. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
362 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
363 'wd' specifies the working directory to extract |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
364 the files to, otherwise they are extracted to the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
365 current working directory. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
366 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
367 """ |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
368 print(f"Unpack {filen}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
369 ext = os.path.splitext(filen)[1] |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
370 print(f"Extension: {ext}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
371 if ext == ".zip": |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
372 return unpack_zip_archive(filen, wd=wd) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
373 elif ext == ".tgz": |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
374 return unpack_tar_archive(filen, wd=wd) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
375 else: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
376 return [filen] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
377 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
378 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
379 def fetch_files(urls, wd=None, files=None): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
380 """Download and unpack files from a list of URLs |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
381 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
382 Given a list of URLs, download and unpack each |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
383 one, and return a list of the extracted files. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
384 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
385 'wd' specifies the working directory to extract |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
386 the files to, otherwise they are extracted to the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
387 current working directory. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
388 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
389 If 'files' is given then the list of extracted |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
390 files will be appended to this list before being |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
391 returned. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
392 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
393 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
394 if files is None: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
395 files = [] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
396 for url in urls: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
397 filen = download_file(url, wd=wd) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
398 files.extend(unpack_archive(filen, wd=wd)) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
399 return files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
400 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
401 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
402 # Utility functions specific to the Mothur reference data |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
403 def identify_type(filen): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
404 """Return the data table name based on the file name |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
405 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
406 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
407 ext = os.path.splitext(filen)[1] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
408 try: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
409 return MOTHUR_FILE_TYPES[ext] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
410 except KeyError: |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
411 print(f"WARNING: unknown file type for {filen}, skipping") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
412 return None |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
413 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
414 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
415 def get_name(filen): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
416 """Generate a descriptive name based on the file name |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
417 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
418 # type_ = identify_type(filen) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
419 name = os.path.splitext(os.path.basename(filen))[0] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
420 for delim in ('.', '_'): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
421 name = name.replace(delim, ' ') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
422 return name |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
423 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
424 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
425 def fetch_from_mothur_website(data_tables, target_dir, datasets): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
426 """Fetch reference data from the Mothur website |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
427 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
428 For each dataset in the list 'datasets', download (and if |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
429 necessary unpack) the related files from the Mothur website, |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
430 copy them to the data manager's target directory, and add |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
431 references to the files to the appropriate data table. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
432 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
433 The 'data_tables' dictionary should have been created using |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
434 the 'create_data_tables_dict' and 'add_data_table' functions. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
435 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
436 Arguments: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
437 data_tables: a dictionary containing the data table info |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
438 target_dir: directory to put the downloaded files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
439 datasets: a list of dataset names corresponding to keys in |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
440 the MOTHUR_REFERENCE_DATA dictionary |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
441 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
442 # Make working dir |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
443 wd = tempfile.mkdtemp(suffix=".mothur", dir=os.getcwd()) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
444 print(f"Working dir {wd}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
445 # Iterate over all requested reference data URLs |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
446 for dataset in datasets: |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
447 print(f"Handling dataset '{dataset}'") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
448 for name in MOTHUR_REFERENCE_DATA[dataset]: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
449 for f in fetch_files(MOTHUR_REFERENCE_DATA[dataset][name], wd=wd): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
450 type_ = identify_type(f) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
451 name_from_file = os.path.splitext(os.path.basename(f))[0] |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
452 entry_name = f"{name_from_file} ({name})" |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
453 print(f"{type_}\t\'{entry_name}'\t.../{os.path.basename(f)}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
454 if type_ is not None: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
455 # Move to target dir |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
456 ref_data_file = os.path.basename(f) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
457 f1 = os.path.join(target_dir, ref_data_file) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
458 print(f"Moving {f} to {f1}") |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
459 shutil.move(f, f1) |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
460 # Add entry to data table |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
461 table_name = f"mothur_{type_}" |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
462 add_data_table_entry(data_tables, table_name, dict(name=entry_name, value=ref_data_file)) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
463 # Remove working dir |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
464 print(f"Removing {wd}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
465 shutil.rmtree(wd) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
466 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
467 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
468 def files_from_filesystem_paths(paths): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
469 """Return list of file paths from arbitrary input paths |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
470 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
471 Given a list of filesystem paths, return a list of |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
472 full paths corresponding to all files found recursively |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
473 from under those paths. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
474 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
475 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
476 # Collect files to add |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
477 files = [] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
478 for path in paths: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
479 path = os.path.abspath(path) |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
480 print(f"Examining '{path}'...") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
481 if os.path.isfile(path): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
482 # Store full path for file |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
483 files.append(path) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
484 elif os.path.isdir(path): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
485 # Descend into directory and collect the files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
486 for f in os.listdir(path): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
487 files.extend(files_from_filesystem_paths((os.path.join(path, f), ))) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
488 else: |
1
aec831b54a5b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 57f71aa633a43ab02bbf05acd0c6d7f406e01f1e"
iuc
parents:
0
diff
changeset
|
489 print("Not a file or directory, ignored") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
490 return files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
491 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
492 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
493 def import_from_server(data_tables, target_dir, paths, description, link_to_data=False): |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
494 """Import reference data from filesystem paths |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
495 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
496 Creates references to the specified file(s) on the Galaxy |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
497 server in the appropriate data table (determined from the |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
498 file extension). |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
499 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
500 The 'data_tables' dictionary should have been created using |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
501 the 'create_data_tables_dict' and 'add_data_table' functions. |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
502 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
503 Arguments: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
504 data_tables: a dictionary containing the data table info |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
505 target_dir: directory to put copy or link to the data file |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
506 paths: list of file and/or directory paths to import |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
507 description: text to associate with the files |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
508 link_to_data: boolean, if False then copy the data file |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
509 into Galaxy (default); if True then make a symlink to |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
510 the data file |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
511 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
512 """ |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
513 # Collect list of files based on input paths |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
514 files = files_from_filesystem_paths(paths) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
515 # Handle each file individually |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
516 for f in files: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
517 type_ = identify_type(f) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
518 if type_ is None: |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
519 print(f"{f}: unrecognised type, skipped") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
520 continue |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
521 ref_data_file = os.path.basename(f) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
522 target_file = os.path.join(target_dir, ref_data_file) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
523 entry_name = "%s" % os.path.splitext(ref_data_file)[0] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
524 if description: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
525 entry_name += " (%s)" % description |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
526 print(f"{type_}\t\'{entry_name}'\t.../{ref_data_file}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
527 # Link to or copy the data |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
528 if link_to_data: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
529 os.symlink(f, target_file) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
530 else: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
531 shutil.copyfile(f, target_file) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
532 # Add entry to data table |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
533 table_name = f"mothur_{type_}" |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
534 add_data_table_entry(data_tables, table_name, dict(name=entry_name, value=ref_data_file)) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
535 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
536 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
537 if __name__ == "__main__": |
1
aec831b54a5b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 57f71aa633a43ab02bbf05acd0c6d7f406e01f1e"
iuc
parents:
0
diff
changeset
|
538 print("Starting...") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
539 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
540 # Read command line |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
541 parser = optparse.OptionParser() |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
542 parser.add_option('--source', action='store', dest='data_source') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
543 parser.add_option('--datasets', action='store', dest='datasets', default='') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
544 parser.add_option('--paths', action='store', dest='paths', default=[]) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
545 parser.add_option('--description', action='store', dest='description', default='') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
546 parser.add_option('--link', action='store_true', dest='link_to_data') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
547 options, args = parser.parse_args() |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
548 print(f"options: {options}") |
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
549 print(f"args : {args}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
550 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
551 # Check for JSON file |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
552 if len(args) != 1: |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
553 sys.stderr.write("Need to supply JSON file name") |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
554 sys.exit(1) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
555 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
556 jsonfile = args[0] |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
557 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
558 # Read the input JSON |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
559 params, target_dir = read_input_json(jsonfile) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
560 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
561 # Make the target directory |
4
0db22932bc39
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit f845716f6ac93500f143a30abef97eaba406344e"
iuc
parents:
3
diff
changeset
|
562 print(f"Making {target_dir}") |
0
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
563 os.mkdir(target_dir) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
564 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
565 # Set up data tables dictionary |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
566 data_tables = create_data_tables_dict() |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
567 add_data_table(data_tables, 'mothur_lookup') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
568 add_data_table(data_tables, 'mothur_aligndb') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
569 add_data_table(data_tables, 'mothur_map') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
570 add_data_table(data_tables, 'mothur_taxonomy') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
571 |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
572 # Fetch data from specified data sources |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
573 if options.data_source == 'mothur_website': |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
574 datasets = options.datasets.split(',') |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
575 fetch_from_mothur_website(data_tables, target_dir, datasets) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
576 elif options.data_source == 'filesystem_paths': |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
577 # Check description text |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
578 description = options.description.strip() |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
579 # Get list of paths (need to remove any escapes for '\n' and '\r' |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
580 # that might have been inserted by Galaxy) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
581 paths = options.paths.replace('__cn__', '\n').replace('__cr__', '\r').split() |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
582 import_from_server(data_tables, target_dir, paths, description, link_to_data=options.link_to_data) |
ab7a7e798c34
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit c1b936b54b7133106b3181df1e104986613a5bea
iuc
parents:
diff
changeset
|
583 # Write output JSON |
1
aec831b54a5b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 57f71aa633a43ab02bbf05acd0c6d7f406e01f1e"
iuc
parents:
0
diff
changeset
|
584 print("Outputting JSON") |
3
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
585 with open(jsonfile, 'w') as fh: |
9d09724f2bf1
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents:
2
diff
changeset
|
586 json.dump(data_tables, fh, sort_keys=True) |
1
aec831b54a5b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_mothur_toolsuite/ commit 57f71aa633a43ab02bbf05acd0c6d7f406e01f1e"
iuc
parents:
0
diff
changeset
|
587 print("Done.") |