From 4cdcab47151b0eb9d03272e967160ddf5dea206a Mon Sep 17 00:00:00 2001 From: Wen-Yu Chung Date: Tue, 22 Apr 2008 21:04:24 +0000 Subject: [PATCH] update rmap and rmapq tool wrappers. minor fixes of short read tool config. --- tools/metag_tools/blat_coverage_report.xml | 2 +- tools/metag_tools/blat_mapping.xml | 2 +- tools/metag_tools/blat_wrapper.xml | 12 ++--- tools/metag_tools/convert_SOLiD_color2nuc.xml | 4 +- tools/metag_tools/megablast_wrapper.xml | 4 +- tools/metag_tools/megablast_xml_parser.xml | 2 +- tools/metag_tools/rmap_wrapper.py | 41 ++++++++++------- tools/metag_tools/rmap_wrapper.xml | 36 +++++++++++---- tools/metag_tools/rmapq_wrapper.py | 41 ++++++++++------- tools/metag_tools/rmapq_wrapper.xml | 44 +++++++++++++------ ...short_reads_figure_high_quality_length.xml | 6 +-- tools/metag_tools/short_reads_trim_seq.xml | 4 +- 12 files changed, 128 insertions(+), 70 deletions(-) diff --git a/tools/metag_tools/blat_coverage_report.xml b/tools/metag_tools/blat_coverage_report.xml index b779f30ee7c..bd8955c4de2 100644 --- a/tools/metag_tools/blat_coverage_report.xml +++ b/tools/metag_tools/blat_coverage_report.xml @@ -2,7 +2,7 @@ the percentage of reads supporting each nucleotide at each location blat_coverage_report.py $input1 $output1 - + diff --git a/tools/metag_tools/blat_mapping.xml b/tools/metag_tools/blat_mapping.xml index 244ed365c08..57c9f18dc01 100644 --- a/tools/metag_tools/blat_mapping.xml +++ b/tools/metag_tools/blat_mapping.xml @@ -2,7 +2,7 @@ in wiggle format blat_mapping.py $input1 $output1 - + diff --git a/tools/metag_tools/blat_wrapper.xml b/tools/metag_tools/blat_wrapper.xml index be893742300..188539da13e 100644 --- a/tools/metag_tools/blat_wrapper.xml +++ b/tools/metag_tools/blat_wrapper.xml @@ -8,7 +8,7 @@ - + @@ -16,13 +16,13 @@ - + - - - - + + + + diff --git a/tools/metag_tools/convert_SOLiD_color2nuc.xml b/tools/metag_tools/convert_SOLiD_color2nuc.xml index b88d09bf5de..112dff64af8 100644 --- a/tools/metag_tools/convert_SOLiD_color2nuc.xml +++ b/tools/metag_tools/convert_SOLiD_color2nuc.xml @@ -3,8 +3,8 @@ convert_SOLiD_color2nuc.py $input1 $input2 $output1 - - + + diff --git a/tools/metag_tools/megablast_wrapper.xml b/tools/metag_tools/megablast_wrapper.xml index 6892b0a4dfa..3d001117e1a 100644 --- a/tools/metag_tools/megablast_wrapper.xml +++ b/tools/metag_tools/megablast_wrapper.xml @@ -2,10 +2,10 @@ for Metagenomics Projects megablast_wrapper.py $source_select $input_query $output1 $word_size $iden_cutoff $disc_word $disc_type $filter_query ${GALAXY_DATA_INDEX_DIR} - - + + diff --git a/tools/metag_tools/megablast_xml_parser.xml b/tools/metag_tools/megablast_xml_parser.xml index dfeb05ae00c..ceea8b22cf7 100644 --- a/tools/metag_tools/megablast_xml_parser.xml +++ b/tools/metag_tools/megablast_xml_parser.xml @@ -2,7 +2,7 @@ megablast_xml_parser.py $input1 $output1 - + diff --git a/tools/metag_tools/rmap_wrapper.py b/tools/metag_tools/rmap_wrapper.py index 36b792f5a88..da0c6d04c0e 100644 --- a/tools/metag_tools/rmap_wrapper.py +++ b/tools/metag_tools/rmap_wrapper.py @@ -1,9 +1,5 @@ #! /usr/bin/python -""" -3. create test files, run functional test -""" - import os, sys, tempfile assert sys.version_info[:2] >= (2.4) @@ -24,22 +20,37 @@ def __main__(): mismatch = sys.argv[5] # -m output_file = sys.argv[6] + # first guess the read length + guess_read_len = 0 + seq = '' + for i, line in enumerate(open(infile)): + line = line.rstrip('\r\n') + if line.startswith('>'): + if seq: + guess_read_len = len(seq) + break + else: + seq += line + try: test = int(read_len) - assert test >= 20 and test <= 64 + if test == 0: + read_len = str(guess_read_len) + else: + assert test >= 20 and test <= 64 except: stop_err('Invalid value for read length. Must be between 20 and 64.') try: int(align_len) except: - stop_err('Invalid value for minimal length of an alignment.') + stop_err('Invalid value for minimal length of a hit.') try: - test = int(mismatch) - assert test >= 0 and test <= int(0.1*int(read_len)) + int(mismatch) + #assert test >= 0 and test <= int(0.1*int(read_len)) except: - stop_err('Invalid value for mismatch numbers in an alignment. Please use a value smaller than %d' % (int(0.1*int(read_len)))) + stop_err('Invalid value for mismatch numbers in an alignment.') all_files = [] if os.path.isdir(target_path): @@ -59,14 +70,14 @@ def __main__(): command = "rmap -h %s -w %s -m %s -c %s %s -o %s 2>&1" % ( align_len, read_len, mismatch, detail_file_path, infile, output_tempfile ) #print command try: - assert os.system( command ) == 0 - except: - stop_err('Execution failed. Please check whether RMAP was installed.') + os.system( command ) + except Exception, e: + stop_err( str( e ) ) try: - assert os.system( 'cat %s >> %s' % ( output_tempfile, output_file ) ) == 0 - except: - stop_err('Failed to integrate files.') + os.system( 'cat %s >> %s' % ( output_tempfile, output_file ) ) + except Exception, e: + stop_err( str( e ) ) try: os.remove( output_tempfile ) diff --git a/tools/metag_tools/rmap_wrapper.xml b/tools/metag_tools/rmap_wrapper.xml index 773c9141d4d..03bcc78d5c1 100644 --- a/tools/metag_tools/rmap_wrapper.xml +++ b/tools/metag_tools/rmap_wrapper.xml @@ -1,15 +1,33 @@ for Solexa Short Reads Alignment - rmap_wrapper.py $database $input_seq $read_len $align_len $mismatch $output1 + + #if $trim.choice=="No": #rmap_wrapper.py $database $input_seq 0 $align_len $mismatch $output1 + #else: #rmap_wrapper.py $database $input_seq $trim.read_len $align_len $mismatch $output1 + #end if - - - - + + + + + + + + + + + + + + + + + + + @@ -18,7 +36,7 @@ - + @@ -34,7 +52,7 @@ .. class:: infomark -**TIP**. Each read should have at least the minimal length specified as the *Length of the Reads* parameter. Reads with lengths longer than the expected value will be trimmed at the 3'end. +**TIP**. The tool will guess the length of the reads, however, if you select to trim the reads, the *Reads length* must be between 20 and 64. Reads with lengths longer than the specified value will be trimmed at the 3'end. ----- @@ -46,9 +64,9 @@ This tool runs **rmap** (for more information, please see the reference below), **Parameters** -- *Length of the Reads* (**-w**) : the minimal length of the reads -- *Length of an Alignment* (**-h**) : the minimal length of an alignment +- *Minimal Length of a Hit* (**-h**) : this is the seed length or the minimal exact match length - *Number of Mismatches Allowed* (**-m**) : the maximal number of mismatches allowed in an alignment +- *Read Length* (**-w**) : maximal length of the reads; reads longer than the threshold will be truncated at 3' end. ----- diff --git a/tools/metag_tools/rmapq_wrapper.py b/tools/metag_tools/rmapq_wrapper.py index 669e58f85e7..e52035e0d7c 100644 --- a/tools/metag_tools/rmapq_wrapper.py +++ b/tools/metag_tools/rmapq_wrapper.py @@ -1,9 +1,5 @@ #! /usr/bin/python -""" -3. create test files, run functional test -""" - import os, sys, tempfile assert sys.version_info[:2] >= (2.4) @@ -36,23 +32,38 @@ def __main__(): int(high_len) except: stop_err('Invalid value for minimal high quality bases.') - + + # first guess the read length + guess_read_len = 0 + seq = '' + for i, line in enumerate(open(infile)): + line = line.rstrip('\r\n') + if line.startswith('>'): + if seq: + guess_read_len = len(seq) + break + else: + seq += line + try: test = int(read_len) - assert test >= 20 and test <= 64 + if test == 0: + read_len = str(guess_read_len) + else: + assert test >= 20 and test <= 64 except: stop_err('Invalid value for read length. Must be between 20 and 64.') + try: int(align_len) except: - stop_err('Invalid value for minimal length of an alignment.') + stop_err('Invalid value for minimal length of a hit.') try: - test = int(mismatch) - assert test >= 0 and test <= int(0.1*int(read_len)) + int(mismatch) except: - stop_err('Invalid value for mismatch numbers in an alignment. Please use a number smaller than %d.' %(int(0.1*int(read_len)))) + stop_err('Invalid value for mismatch numbers in an alignment.') all_files = [] if os.path.isdir(target_path): @@ -71,14 +82,14 @@ def __main__(): command = "rmapq -q %s -M %s -h %s -w %s -m %s -Q %s -c %s %s -o %s 2>&1" % ( high_score, high_len, align_len, read_len, mismatch, scorefile, detail_file_path, infile, output_tempfile ) #print command try: - assert os.system( command ) == 0 - except: - stop_err('Execution failed. Please check whether RMAP was installed.') + os.system( command ) + except Exception, e: + stop_err( str( e ) ) try: assert os.system( 'cat %s >> %s' % ( output_tempfile, output_file ) ) == 0 - except: - stop_err('Failed to integrate files.') + except Exception, e: + stop_err( str( e ) ) try: os.remove( output_tempfile ) diff --git a/tools/metag_tools/rmapq_wrapper.xml b/tools/metag_tools/rmapq_wrapper.xml index a60db240641..7a536a5f2e7 100644 --- a/tools/metag_tools/rmapq_wrapper.xml +++ b/tools/metag_tools/rmapq_wrapper.xml @@ -1,18 +1,36 @@ for Solexa Short Reads Alignment with Quality Scores - rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len $read_len $align_len $mismatch $output1 + + #if $trim.choice=="No": #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len 0 $align_len $mismatch $output1 + #else: #rmapq_wrapper.py $database $input_seq $input_score $high_score $high_len $trim.read_len $align_len $mismatch $output1 + #end if - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -21,7 +39,7 @@ - + @@ -36,11 +54,11 @@ .. class:: warningmark - RMAP was developed for **Solexa** reads. + RMAPQ was developed for **Solexa** reads. .. class:: infomark -**TIP**. Each read should have at least the minimal length specified in the *Length of the Reads* parameter. Reads with lengths longer than the expected value will be trimmed at the 3'end. +**TIP**. The tool will guess the length of the reads, however, if you select to trim the reads, the *Maximal Length of the Reads* must be between 20 and 64. Reads with lengths longer than the specified value will be trimmed at the 3'end. ----- @@ -54,9 +72,9 @@ This tool runs **rmapq** (for more information, please see the reference below), - *Minimal High-quality Bases* (**-M**): the minimal length of the high quality score bases - *Minimum Score for High-quality Base* (**-q**) : the minimal quality score -- *Length of the Reads* (**-w**) : the minimal length of the reads -- *Length of an Alignment* (**-h**) : the minimal length of an exact match (rmapq) or an alignment (rmap) +- *Minimal Length of a Hit* (**-h**) : the minimal length of an exact match or seed - *Number of Mismatches Allowed* (**-m**) : the maximal number of mismatches allowed in an alignment +- *Read Length* (**-w**) : maximal length of the reads; reads longer than the threshold will be truncated at 3' end. ----- diff --git a/tools/metag_tools/short_reads_figure_high_quality_length.xml b/tools/metag_tools/short_reads_figure_high_quality_length.xml index 9b4a917f49d..3d99e0f6899 100644 --- a/tools/metag_tools/short_reads_figure_high_quality_length.xml +++ b/tools/metag_tools/short_reads_figure_high_quality_length.xml @@ -5,8 +5,8 @@ - - + + @@ -29,7 +29,7 @@ .. class:: warningmark - To use this tool your dataset needs to be in *Quality Score* format. Click pencil icon next to your dataset to set datatype to *Quality Score*. + To use this tool your dataset needs to be in *Quality Score* format. Click pencil icon next to your dataset to set datatype to *Quality Score* (see below for examples of quality scores). ----- diff --git a/tools/metag_tools/short_reads_trim_seq.xml b/tools/metag_tools/short_reads_trim_seq.xml index 502b4f97377..f03236abede 100644 --- a/tools/metag_tools/short_reads_trim_seq.xml +++ b/tools/metag_tools/short_reads_trim_seq.xml @@ -9,13 +9,13 @@ - + - +