Mercurial > repos > rnateam > data_manager_sortmerna_database_downloader
changeset 2:7d2252852f96 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_sortmerna_database_downloader commit 4241c1d4b05a177bd2c74f5a139f51d4f65e0b55
author | rnateam |
---|---|
date | Tue, 13 Jun 2017 12:03:08 -0400 |
parents | 30bb49887172 |
children | |
files | data_manager/data_manager_sortmerna_download.py data_manager_conf.xml |
diffstat | 2 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/data_manager/data_manager_sortmerna_download.py Tue Jun 06 13:40:27 2017 -0400 +++ b/data_manager/data_manager_sortmerna_download.py Tue Jun 13 12:03:08 2017 -0400 @@ -4,6 +4,7 @@ import argparse import json import os +import shutil import tarfile import requests import subprocess @@ -126,23 +127,28 @@ if not filename.endswith("fasta"): continue input_filepath = os.path.join(file_dir, filename) - output_filepath = os.path.join(target_dir, filename) - # Move file - os.rename(input_filepath, output_filepath) + # Extract the db name + db_name = os.path.splitext(filename)[0] + # Create the directory where to put the fasta files and indexed files + filedir = os.path.join(target_dir, db_name) + os.mkdir(filedir) + fasta_filepath = os.path.join(filedir, "%s.fasta" % db_name) + indexed_filepath = os.path.join(filedir, db_name) + # Move the fasta file + shutil.move(input_filepath, fasta_filepath) # Index the file with indexdb_rna command = "indexdb_rna --ref %s,%s" % ( - output_filepath, - os.path.splitext(output_filepath)[0]) + fasta_filepath, + indexed_filepath) process = subprocess.call(command, shell=True ) # Add entry in the data table - db_name = os.path.splitext(filename)[0] add_data_table_entry( data_tables, "rRNA_databases", dict( - value=version, + value="%s-%s" %(version, db_name), name=db_name, - path=output_filepath)) + path=filedir)) def download_db(data_tables, version, target_dir):
--- a/data_manager_conf.xml Tue Jun 06 13:40:27 2017 -0400 +++ b/data_manager_conf.xml Tue Jun 13 12:03:08 2017 -0400 @@ -6,11 +6,11 @@ <column name="value" /> <!-- columns that are going to be specified by the Data Manager Tool --> <column name="name" /> <!-- columns that are going to be specified by the Data Manager Tool --> <column name="path" output_ref="out_file" > - <move type="file"> + <move type="directory"> <source>${path}</source> <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">rRNA_databases/${name}</target> </move> - <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/rRNA_databases/${name}</value_translation> + <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/rRNA_databases/${name}/${name}.fasta</value_translation> <value_translation type="function">abspath</value_translation> </column> </output>