Mercurial > repos > frogs > data_manager_frogs
annotate data_manager/FROGS_data_manager.py @ 0:7403d6c4f510 draft default tip
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
author | frogs |
---|---|
date | Mon, 23 Aug 2021 10:21:10 +0000 |
parents | |
children |
rev | line source |
---|---|
0
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
3 # |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
4 # Copyright (C) 2021 INRA |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
5 # |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
7 # it under the terms of the GNU General Public License as published by |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
8 # the Free Software Foundation, either version 3 of the License, or |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
9 # (at your option) any later version. |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
10 # |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
14 # GNU General Public License for more details. |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
15 # |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
16 # You should have received a copy of the GNU General Public License |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
18 # |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
19 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
20 __author__ = 'David Christiany Migale Jouy en Josas / Maria Bernard - Sigenae Jouy en Josas' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
21 __copyright__ = 'Copyright (C) 2020 INRAE' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
22 __license__ = 'GNU General Public License' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
23 __version__ = '3.2.3' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
24 __email__ = 'frogs-support@inrae.fr' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
25 __status__ = 'prod' |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
26 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
27 # import json |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
28 import argparse |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
29 import os |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
30 # import sys |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
31 import tarfile |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
32 import time |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
33 import urllib |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
34 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
35 from galaxy.util.json import from_json_string, to_json_string |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
36 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
37 import requests |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
38 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
39 # GALAXY_database=~/galaxy/galaxy-20.09/database |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
40 # FROGS_data_manager.py --database=frogs_db_data --all_dbs=false \ |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
41 # --date=0 --amplicons=16S --bases=SILVA --filters=Pintail100 \ |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
42 # --only_last_versions=true \ |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
43 # --tool_data=/home/maria/galaxy/galaxy-20.09/tool-data \ |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
44 # --output $GALAXY_database/objects/e/7/7/dataset_e7766c39-8f36-450c-adf5-3e4ee8d5c562.dat |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
45 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
46 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
47 def get_args(): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
48 parser = argparse.ArgumentParser() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
49 parser.add_argument("-d", "--database") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
50 parser.add_argument("--all_dbs") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
51 parser.add_argument("--date") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
52 parser.add_argument("--amplicons") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
53 parser.add_argument("--bases") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
54 parser.add_argument("--filters") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
55 parser.add_argument("--only_last_versions") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
56 parser.add_argument("--tool_data") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
57 parser.add_argument("-o", "--output") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
58 args = parser.parse_args() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
59 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
60 return args |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
61 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
62 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
63 def _add_data_table_entry(data_manager_dict, data_table_entry, data_table): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
64 data_manager_dict['data_tables'] = data_manager_dict.get('data_tables', {}) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
65 data_manager_dict['data_tables'][data_table] = data_manager_dict['data_tables'].get(data_table, []) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
66 data_manager_dict['data_tables'][data_table].append(data_table_entry) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
67 return data_manager_dict |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
68 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
69 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
70 def keep_only_last_version(db_index): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
71 db_dict = dict() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
72 for line in db_index: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
73 db_type = "_".join(line[1:4]) if line[3] != "" else "_".join(line[1:3]) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
74 if db_type not in db_dict: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
75 db_dict[db_type] = line |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
76 return list(db_dict.values()) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
77 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
78 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
79 def frogs_sources(data_manager_dict, target_directory): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
80 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
81 # variables |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
82 amplicons_list = [] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
83 bases_list = [] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
84 filters_list = [] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
85 if args.all_dbs == "false": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
86 amplicons_list = [amplicon.lower().strip() for amplicon in args.amplicons.split(",") if amplicon != ""] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
87 bases_list = [base.lower().strip() for base in args.bases.split(",") if base != ""] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
88 filters_list = [filter.lower().strip() for filter in args.filters.split(",") if filter != ""] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
89 bottom_date = int(args.date) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
90 tool_data_path = args.tool_data |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
91 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
92 # get frogs database index |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
93 frogs_db_index_link = "http://genoweb.toulouse.inra.fr/frogs_databanks/assignation/FROGS_databases.tsv" |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
94 with requests.Session() as s: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
95 download = s.get(frogs_db_index_link) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
96 decoded_content = download.content.decode('utf-8') |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
97 db_index = decoded_content.splitlines() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
98 db_index = [line.split("\t") for line in db_index[1:]] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
99 db_index = [[line[0], line[1].lower(), line[2].lower(), line[3].lower()] + line[4:] for line in db_index] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
100 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
101 # filter databases |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
102 if args.all_dbs == "false": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
103 # filter by amplicons |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
104 if len(amplicons_list) != 0: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
105 db_index = [line for line in db_index if any([amplicon in amplicons_list for amplicon in line[1].split(',')])] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
106 # filter by base |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
107 if len(bases_list) != 0: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
108 db_index = [line for line in db_index if line[2] in bases_list] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
109 # filter by filters |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
110 if len(filters_list) != 0: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
111 db_index = [line for line in db_index if line[3] in filters_list] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
112 # filter by date |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
113 if bottom_date != 0: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
114 db_index = [line for line in db_index if int(line[0]) >= bottom_date] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
115 if args.only_last_versions == "true": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
116 # keep only last version |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
117 db_index = keep_only_last_version(db_index) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
118 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
119 # get frogs dbs |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
120 os.chdir(target_directory) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
121 dir_name = "frogs_db_" + time.strftime("%Y%m%d") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
122 os.mkdir(dir_name) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
123 dbs = set([]) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
124 for line in db_index: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
125 value = line[5] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
126 name = value.replace("_", " ") if "_" not in line[4] else value.replace(line[4], "").replace("_", " ") + line[4] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
127 link = line[6] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
128 name_dir = "".join([line[6].replace(".tar.gz", "").split("/")[-1]]) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
129 file_path = tool_data_path + "/frogs_db/" + name_dir |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
130 if not os.path.exists(file_path): # if the file is not already in frogs_db directory |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
131 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
132 # download frogs db |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
133 dl_file = urllib.request.URLopener() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
134 dl_file.retrieve(link, "tmp.tar.gz") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
135 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
136 # unzip frogs db |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
137 with tarfile.open("tmp.tar.gz") as tar: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
138 tar.extractall(dir_name) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
139 tar.close() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
140 os.remove('tmp.tar.gz') |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
141 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
142 # get fasta file path |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
143 tmp = set(os.listdir(dir_name)) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
144 new_db = dir_name + "/" + "".join(tmp.difference(dbs)) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
145 files = os.listdir(new_db) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
146 fasta = "".join([file for file in files if file.endswith('.fasta')]) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
147 path = new_db + '/' + fasta |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
148 dbs = os.listdir(dir_name) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
149 # release = value + "_" + time.strftime("%Y-%m-%d") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
150 # date = time.strftime("%Y%m%d") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
151 path = os.path.join(target_directory, path) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
152 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
153 data_table_entry = dict(name=name, value=value, path=path) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
154 _add_data_table_entry(data_manager_dict, data_table_entry, "frogs_db") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
155 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
156 # def HVL_sources(data_manager_dict,target_directory): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
157 # HVL_dir = "http://genoweb.toulouse.inra.fr/frogs_databanks/HVL/ITS/UNITE_s_7.1_20112016" |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
158 # os.chdir(target_directory) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
159 # for link in [HVL_dir + "/Unite_s_7.1_20112016_ITS1.fasta",HVL_dir + "/Unite_s_7.1_20112016_ITS2.fasta"]: |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
160 # file_name=link.split("/")[-1].replace('.fasta',"_"+time.strftime("%Y-%m-%d")+".fasta") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
161 # dl_file = urllib.URLopener() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
162 # dl_file.retrieve(link,file_name) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
163 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
164 # #get fasta file path |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
165 # path = os.path.join(target_directory,file_name) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
166 # if link.endswith('ITS1.fasta'): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
167 # name = "UNITE 7.1 ITS1 " + time.strftime("%Y-%m-%d") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
168 # elif link.endswith('ITS2.fasta'): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
169 # name = "UNITE 7.1 ITS2 " + time.strftime("%Y-%m-%d") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
170 # value=file_name.replace('.fasta','') |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
171 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
172 # data_table_entry = dict(name = name, value = value, path=path) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
173 # _add_data_table_entry(data_manager_dict, data_table_entry, "frogs_HVL_db") |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
174 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
175 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
176 def main(): |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
177 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
178 # get args from command line |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
179 global args |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
180 args = get_args() |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
181 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
182 # Extract json file params |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
183 data_manager_dict = {} |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
184 filename = args.output |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
185 params = from_json_string(open(filename).read()) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
186 target_directory = params['output_data'][0]['extra_files_path'] |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
187 os.mkdir(target_directory) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
188 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
189 # if args.database=="frogs_db_data": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
190 frogs_sources(data_manager_dict, target_directory) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
191 # elif args.database=="HVL_db_data": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
192 # HVL_sources(data_manager_dict,target_directory) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
193 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
194 # save info to json file |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
195 open(filename, 'wt').write(to_json_string(data_manager_dict)) |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
196 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
197 |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
198 if __name__ == "__main__": |
7403d6c4f510
"planemo upload for repository https://github.com/geraldinepascal/FROGS-wrappers/ commit 2024a13846ea6f9bd94ae62e3b2a5a3aba8cd304"
frogs
parents:
diff
changeset
|
199 main() |