Skip to content

Commit

Permalink
Add HTML and PDF file types. Add workaround for downloading of HTML r…
Browse files Browse the repository at this point in the history
…eports as zip archives from Galaxy.
  • Loading branch information
hackdna committed Apr 22, 2014
1 parent 3a5dab9 commit e866ca1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
13 changes: 8 additions & 5 deletions refinery/analysis_manager/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions refinery/file_store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ def _mkdir(path):
GFF = 'gff'
GTF = 'gtf'
GZ = 'gz'
HTML = 'html'
IDF = 'idf'
FASTA = 'fasta'
FASTQ = 'fastq'
FASTQCSANGER = 'fastqcsanger'
FASTQILLUMINA = 'fastqillumina'
FASTQSANGER = 'fastqsanger'
FASTQSOLEXA = 'fastqsolexa'
PDF = 'pdf'
SAM = 'sam'
SEG = 'seg'
TABULAR = 'tabular'
Expand All @@ -124,13 +126,15 @@ 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'),
(FASTQCSANGER, 'FASTQC Sanger'),
(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'),
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions refinery/galaxy_connector/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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 ] )

Expand Down

0 comments on commit e866ca1

Please sign in to comment.