# HG changeset patch # User pitagora # Date 1427354945 -32400 # Node ID 3aa3807c078fa9b50299232860a7731e122274d6 commit diff -r 000000000000 -r 3aa3807c078f README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,10 @@ +This code is originated from the following. Prease refer this for the licence +information: + +matt-shirley's code: +https://toolshed.g2.bx.psu.edu/view/matt-shirley/ncbi_sra_toolkit + +If you use this Galaxy tool in work leading to a scientific publication please +cite the following: + +SRA Toolkit: http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software diff -r 000000000000 -r 3aa3807c078f datatypes_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datatypes_conf.xml Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff -r 000000000000 -r 3aa3807c078f fastq_dump.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fastq_dump.xml Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,123 @@ + + from NCBI SRA. + + fastq-dump --log-level fatal + #if $input.input_select == "file": + --accession '${input.file.name}' + #else: + --accession $input.accession + #end if + --defline-seq '@\$sn[_\$rn]/\$ri' + --stdout + #if str( $split ) == "yes": + --split-spot + #end if + #if str( $alignments ) == "aligned": + --aligned + #end if + #if str( $alignments ) == "unaligned": + --unaligned + #end if + #if str( $minID ) != "": + --minSpotId $minID + #end if + #if str( $maxID ) != "": + --maxSpotId $maxID + #end if + #if str( $minlen ) != "": + --minReadLen $minlen + #end if + #if str( $readfilter ) != "": + --read-filter $readfilter + #end if + #if str( $region ) != "": + --aligned-region $region + #end if + #if str( $spotgroups ) != "": + --spot-groups $spotgroups + #end if + #if str( $matepairDist ) != "": + --matepair-distance $matepairDist + #end if + #if $clip == "yes": + --clip + #end if + #if str( $outputformat ) == "fasta": + --fasta + #end if + #if $input.input_select=="file": + $input.file + #else: + $input.accession + #end if + > $output + + fastq-dump --version + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sra_toolkit + + + This tool extracts reads from SRA archives using fastq-dump. + Browse the NCBI SRA for SRR accessions at http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=studies. + The fastq-dump program is developed at NCBI, and is available at: http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software. + Contact Matt Shirley at mdshw5@gmail.com for support and bug reports. + + diff -r 000000000000 -r 3aa3807c078f sam_dump.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sam_dump.xml Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,99 @@ + + in SAM format from NCBI SRA. + + sam-dump --log-level fatal + #if str( $region ) != "": + --aligned-region $region + #end if + #if str( $matepairDist ) != "": + --matepair-distance $matepairDist + #end if + #if str( $minMapq ) != "": + --minmapq $minMapq + #end if + #if $header == "yes": + --header + #else: + --no-header + #end if + #if str( $alignments ) == "both": + --unaligned + #end if + #if str( $alignments ) == "unaligned": + --unaligned-spots-only + #end if + #if (str( $primary ) == "yes") and (str ( $alignments != "unaligned") ): + --primary + #end if + #if str( $fastq ) == "yes": + --fastq + #end if + #if $input.input_select == "file": + $input.file + #elif $input.input_select == "accession_number": + $input.accession + #elif $input.input_select == "text": + `cat $input.text` + #end if + > $output + + sam-dump --version + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sra_toolkit + + + This tool extracts reads from sra archives using sam-dump. + Browse the NCBI SRA for SRR accessions at http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=studies. + The sam-dump program is developed at NCBI, and is available at: http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software. + Contact Matt Shirley at mdshw5@gmail.com for support and bug reports. + + diff -r 000000000000 -r 3aa3807c078f sra.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sra.py Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,43 @@ +""" +NCBI sra class +""" +import logging +import binascii +from galaxy.datatypes.data import nice_size +from galaxy.datatypes.binary import Binary + +log = logging.getLogger(__name__) + +class Sra(Binary): + """ Sequence Read Archive (SRA) """ + file_ext = 'sra' + + def __init__( self, **kwd ): + Binary.__init__( self, **kwd ) + + def sniff( self, filename ): + """ The first 8 bytes of any NCBI sra file is 'NCBI.sra', and the file is binary. + For details about the format, see http://www.ncbi.nlm.nih.gov/books/n/helpsra/SRA_Overview_BK/#SRA_Overview_BK.4_SRA_Data_Structure + """ + try: + header = open(filename).read(8) + if binascii.b2a_hex(header) == binascii.hexlify('NCBI.sra'): + return True + else: + return False + except: + return False + + def set_peek(self, dataset, is_multi_byte=False): + if not dataset.dataset.purged: + dataset.peek = 'Binary sra file' + dataset.blurb = nice_size(dataset.get_size()) + else: + dataset.peek = 'file does not exist' + dataset.blurb = 'file purged from disk' + + def display_peek(self, dataset): + try: + return dataset.peek + except: + return 'Binary sra file (%s)' % (nice_size(dataset.get_size())) diff -r 000000000000 -r 3aa3807c078f sra_pileup.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sra_pileup.xml Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,51 @@ + + from NCBI sra. + sra-pileup --log-level fatal + #if str( $region ) != "": + --aligned-region $region + #end if + #if str( $minMapq ) != "": + --minmapq $minMapq + #end if + #if $input.input_select == "file": + $input.file + #elif $input.input_select == "accession_number": + $input.accession + #elif $input.input_select == "text": + `cat $input.text` + #end if + > $output + sra-pileup --version + + + + + + + + + + + + + + + + + + + + + + + + + sra_toolkit + + + This tool produces pileup format from sra archives using sra-pileup. + Browse the NCBI SRA for SRR accessions at http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=studies. + The sra-pileup program is developed at NCBI, and is available at: http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software. + Contact Matt Shirley at mdshw5@gmail.com for support and bug reports. + + diff -r 000000000000 -r 3aa3807c078f tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Thu Mar 26 16:29:05 2015 +0900 @@ -0,0 +1,6 @@ + + + + + +