# HG changeset patch # User Matt Shirley # Date 1371515416 14400 # Node ID 93a60318b9ca637ed6433afeb8cf633926b2b824 # Parent 078b8e168b0c43ec1e9de1abc5cf91aade6d8c23 updates to SRA datatype diff -r 078b8e168b0c -r 93a60318b9ca sra.py --- a/sra.py Mon Jun 17 17:08:53 2013 -0400 +++ b/sra.py Mon Jun 17 20:30:16 2013 -0400 @@ -1,14 +1,16 @@ """ Sra class """ - +import logging import binascii -from galaxy.datatypes.binary import Binary -from galaxy.datatypes.data import Data -from galaxy.datatypes.metadata import MetadataElement +from galaxy.datatypes.data import * from galaxy.datatypes.sniff import * +from galaxy.datatypes.binary import * +from galaxy.datatypes.metadata import * -class Sra( Binary ): +log = logging.getLogger(__name__) + +class SRA( Binary ): """ Sequence Read Archive (SRA) """ file_ext = 'sra' @@ -37,4 +39,7 @@ try: return dataset.peek except: - return 'Binary sra file (%s)' % ( data.nice_size(dataset.get_size())) + return 'Binary SRA file (%s)' % ( data.nice_size(dataset.get_size())) + +if hasattr(Binary, 'register_sniffable_binary_format'): + Binary.register_sniffable_binary_format('SRA', 'SRA', SRA) diff -r 078b8e168b0c -r 93a60318b9ca sra_fetch.py --- a/sra_fetch.py Mon Jun 17 17:08:53 2013 -0400 +++ b/sra_fetch.py Mon Jun 17 20:30:16 2013 -0400 @@ -15,7 +15,6 @@ suffix = args['accession'][6:9] ftp = FTP('ftp-trace.ncbi.nih.gov') - print args # Open file and transfer requested SRA as a file # Try to change the working directory until it works with open(args['out'], 'wb') as sra: @@ -56,7 +55,6 @@ ## fall back to getopt for python < 2.7 args = dict() options, remainder = getopt.getopt(sys.argv[1:], 'a:o:', ['accession=', 'out=']) - print options for opt, arg in options: if opt in ('-a', '--accession'): args['accession'] = arg