Fixed megablast_wrapper test to use phiX database and modified parameter passing to use named parameters

This commit is contained in:
Kelly Vincent
2009-11-10 13:06:20 -05:00
parent c3878e925f
commit 03cb53ead3
2 changed files with 38 additions and 11 deletions
+26 -9
View File
@@ -1,9 +1,24 @@
#! /usr/bin/python
"""
run megablast for metagenomics data
usage: %prog [options]
-d, --db_build=d: The database to use
-i, --input=i: Input FASTQ candidate file
-w, --word_size=w: Size of best perfect match
-c, --identity_cutoff=c: Report hits at or above this identity
-e, --eval_cutoff=e: Expectation value cutoff
-f, --filter_query=f: Filter out low complexity regions
-x, --index_dir=x: Data index directory
-o, --output=o: Output file
usage: %prog db_build input_file word_size identity_cutoff eval_cutoff filter_query index_dir output_file
"""
import sys, os, tempfile
from galaxy import eggs
import pkg_resources; pkg_resources.require( "bx-python" )
from bx.cookbook import doc_optparse
assert sys.version_info[:2] >= ( 2, 4 )
@@ -12,16 +27,18 @@ def stop_err( msg ):
sys.exit()
def __main__():
#Parse Command Line
options, args = doc_optparse.parse( __doc__ )
db_build = sys.argv[1]
query_filename = sys.argv[2].strip()
output_filename = sys.argv[3].strip()
mega_word_size = sys.argv[4] # -W
mega_iden_cutoff = sys.argv[5] # -p
mega_evalue_cutoff = sys.argv[6] # -e
db_build = options.db_build
query_filename = options.input.strip()
output_filename = options.output.strip()
mega_word_size = options.word_size # -W
mega_iden_cutoff = options.identity_cutoff # -p
mega_evalue_cutoff = options.eval_cutoff # -e
mega_temp_output = tempfile.NamedTemporaryFile().name
mega_filter = sys.argv[7] # -F
GALAXY_DATA_INDEX_DIR = sys.argv[8]
mega_filter = options.filter_query # -F
GALAXY_DATA_INDEX_DIR = options.index_dir
DB_LOC = "%s/blastdb.loc" % GALAXY_DATA_INDEX_DIR
# megablast parameters
@@ -81,7 +98,7 @@ def __main__():
output.write( "%s\n" % new_line )
output.close()
os.unlink( mega_temp_output ) #remove the tempfile that we just reformated the contents of
os.unlink( mega_temp_output ) #remove the tempfile that we just reformatted the contents of
if invalid_lines:
print "Unable to parse %d lines. Keep the default format." % invalid_lines
+12 -2
View File
@@ -1,6 +1,16 @@
<tool id="megablast_wrapper" name="Megablast" version="1.0.0">
<description> compare short reads against nt and wgs databases</description>
<command interpreter="python">megablast_wrapper.py $source_select $input_query $output1 $word_size $iden_cutoff $evalue_cutoff $filter_query ${GALAXY_DATA_INDEX_DIR}</command>
<command interpreter="python">
megablast_wrapper.py
--db_build=$source_select
--input=$input_query
--word_size=$word_size
--identity_cutoff=$iden_cutoff
--eval_cutoff=$evalue_cutoff
--filter_query=$filter_query
--index_dir=${GALAXY_DATA_INDEX_DIR}
--output=$output1
</command>
<inputs>
<param name="input_query" type="data" format="fasta" label="Compare these sequences"/>
<param name="source_select" type="select" display="radio" label="against target database">
@@ -29,7 +39,7 @@
<tests>
<test>
<param name="input_query" value="megablast_wrapper_test1.fa" ftype="fasta"/>
<param name="source_select" value="test" />
<param name="source_select" value="phiX" />
<param name="word_size" value="28" />
<param name="iden_cutoff" value="99.0" />
<param name="evalue_cutoff" value="10.0" />