From e866ca1d95e8b3803191fbea99ed011c35229e42 Mon Sep 17 00:00:00 2001 From: Ilya Sytchev Date: Tue, 22 Apr 2014 18:37:03 -0400 Subject: [PATCH] Add HTML and PDF file types. Add workaround for downloading of HTML reports as zip archives from Galaxy. --- refinery/analysis_manager/tasks.py | 13 ++++++++----- refinery/file_store/models.py | 6 ++++++ refinery/galaxy_connector/connection.py | 5 +++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/refinery/analysis_manager/tasks.py b/refinery/analysis_manager/tasks.py index 114533782e..6b3a11bafd 100644 --- a/refinery/analysis_manager/tasks.py +++ b/refinery/analysis_manager/tasks.py @@ -694,23 +694,26 @@ def download_history_files(analysis) : if curr_file_id in dl_dict: curr_dl_dict = dl_dict[curr_file_id] - result_name = curr_dl_dict['filename'] + '.' + file_type - # size of file defined by galaxy file_size = results['file_size'] # Determing tag if galaxy results should be download through http or copying files directly local_download = analysis.workflow.workflow_engine.instance.local_download - # URL to download - if local_download: + # to retrieve HTML files as zip archives via dataset URL + if local_download and file_type != 'html': download_url = results['file_name'] else: download_url = connection.make_url( str(results['dataset_id']), is_data=True, key=False) - # getting file_store_uuid, + # workaround to set the correct file type for zip archives of + # reports produced by FASTQC + if file_type == 'html': + file_type = 'zip' + + # getting file_store_uuid, # TODO: when changing permanent=True, fix update of % download of file filestore_uuid = create( source=download_url, diff --git a/refinery/file_store/models.py b/refinery/file_store/models.py index 3a4b3bf8f8..ef3a456772 100644 --- a/refinery/file_store/models.py +++ b/refinery/file_store/models.py @@ -91,6 +91,7 @@ def _mkdir(path): GFF = 'gff' GTF = 'gtf' GZ = 'gz' +HTML = 'html' IDF = 'idf' FASTA = 'fasta' FASTQ = 'fastq' @@ -98,6 +99,7 @@ def _mkdir(path): FASTQILLUMINA = 'fastqillumina' FASTQSANGER = 'fastqsanger' FASTQSOLEXA = 'fastqsolexa' +PDF = 'pdf' SAM = 'sam' SEG = 'seg' TABULAR = 'tabular' @@ -124,6 +126,7 @@ def _mkdir(path): (GFF, 'GFF file'), (GTF, 'GTF file'), (GZ, 'Gzip compressed archive'), + (HTML, 'Hypertext Markup Language'), (IDF, 'IDF file'), (FASTA, 'FASTA file'), (FASTQ, 'FASTQ file'), @@ -131,6 +134,7 @@ def _mkdir(path): (FASTQILLUMINA, 'FASTQ Illumina'), (FASTQSANGER, 'FASTQ Sanger'), (FASTQSOLEXA, 'FASTQ Solexa'), + (PDF, 'Portable Document Format'), (SAM, 'Sequence Alignment/Map'), (SEG, 'Segmented Data File'), # http://broadinstitute.org/software/igv/SEG (TABULAR, 'Tabular file'), @@ -165,6 +169,8 @@ def _mkdir(path): 'fastqillumina': FASTQILLUMINA, 'fastqsanger': FASTQSANGER, 'fastqsolexa': FASTQSOLEXA, + 'html': HTML, + 'pdf': PDF, 'sam': SAM, 'tabular': TABULAR, 'tdf': TDF, 'igv.tdf': TDF, diff --git a/refinery/galaxy_connector/connection.py b/refinery/galaxy_connector/connection.py index e1e175b16f..c3529fa399 100644 --- a/refinery/galaxy_connector/connection.py +++ b/refinery/galaxy_connector/connection.py @@ -41,7 +41,7 @@ def __init__(self, base_url, data_url, api_url, api_key ): # ========================================================================================================= - def make_url( self, command, args=None, is_data=False, key=True ): + def make_url(self, command, args=None, is_data=False, key=True): # Adds the API Key to the URL if it's not already there. if args is None: args = [] @@ -51,7 +51,8 @@ def make_url( self, command, args=None, is_data=False, key=True ): if key: return self.base_url + '/' + self.data_url + '/' + command + argsep + '&'.join( [ '='.join( t ) for t in args ] ) else: - return self.base_url + '/' + self.data_url + '/' + command + argsep + "to_ext=txt" + # to download HTML files and linked resources as zip archives + return self.base_url + '/' + self.data_url + '/' + command + '/display' + argsep + "to_ext=txt" else: return self.base_url + '/' + self.api_url + '/' + command + argsep + '&'.join( [ '='.join( t ) for t in args ] )