Mercurial > repos > matt-shirley > sra_tools
changeset 16:93a60318b9ca draft
updates to SRA datatype
author | Matt Shirley <mdshw5@gmail.com> |
---|---|
date | Mon, 17 Jun 2013 20:30:16 -0400 |
parents | 078b8e168b0c |
children | c57efec65750 |
files | sra.py sra_fetch.py |
diffstat | 2 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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