details: http://www.bx.psu.edu/hg/galaxy/rev/ecd5fb7ec59b changeset: 2488:ecd5fb7ec59b user: guru date: Mon Jul 20 16:57:55 2009 -0400 description: Committing changes to 'extract genomic dna' tool - twobit file will be opened only once per job. (Courtesy: Gordon). 2 file(s) affected in this change: tools/extract/extract_genomic_dna.py tools/extract/extract_genomic_dna.xml diffs (38 lines): diff -r 46bd94b12a0c -r ecd5fb7ec59b tools/extract/extract_genomic_dna.py --- a/tools/extract/extract_genomic_dna.py Thu Jul 16 15:35:58 2009 -0400 +++ b/tools/extract/extract_genomic_dna.py Mon Jul 20 16:57:55 2009 -0400 @@ -70,7 +70,8 @@ fout = open( output_filename, "w" ) warnings = [] warning = '' - + twobitfile = None + for i, line in enumerate( open( input_filename ) ): line = line.rstrip( '\r\n' ) if line and not line.startswith( "#" ): @@ -118,12 +119,10 @@ invalid_line = line continue elif seq_path and os.path.isfile( seq_path ): - if chrom in twobits: - t = twobits[chrom] - else: - twobits[chrom] = t = bx.seq.twobit.TwoBitFile( file( seq_path ) ) + if not(twobitfile): + twobitfile = bx.seq.twobit.TwoBitFile( file( seq_path ) ) try: - sequence = t[chrom][start:end] + sequence = twobitfile[chrom][start:end] except: warning = "Unable to fetch the sequence from '%d' to '%d' for build '%s'. " %( start, end-start, dbkey ) warnings.append( warning ) diff -r 46bd94b12a0c -r ecd5fb7ec59b tools/extract/extract_genomic_dna.xml --- a/tools/extract/extract_genomic_dna.xml Thu Jul 16 15:35:58 2009 -0400 +++ b/tools/extract/extract_genomic_dna.xml Mon Jul 20 16:57:55 2009 -0400 @@ -1,4 +1,4 @@ -<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.1.0"> +<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.0"> <description>using coordinates from assembled/unassembled genomes</description> <command interpreter="python">extract_genomic_dna.py $input $out_file1 -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol} -d $dbkey -o $out_format -g ${GALAXY_DATA_INDEX_DIR}</command> <inputs>