mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Added additional options to the liftOver tool. It now supports GFF and GTF formats and allows multiple output regions and related options.
This commit is contained in:
@@ -34,15 +34,27 @@ def safe_bed_file(infile):
|
||||
out_handle.close()
|
||||
return fname
|
||||
|
||||
if len( sys.argv ) != 7:
|
||||
stop_err( "USAGE: prog input out_file1 out_file2 input_dbkey output_dbkey minMatch" )
|
||||
if len( sys.argv ) < 9:
|
||||
stop_err( "USAGE: prog input out_file1 out_file2 input_dbkey output_dbkey infile_type minMatch multiple <minChainT> <minChainQ> <minSizeQ>" )
|
||||
|
||||
infile = sys.argv[1]
|
||||
outfile1 = sys.argv[2]
|
||||
outfile2 = sys.argv[3]
|
||||
in_dbkey = sys.argv[4]
|
||||
mapfilepath = sys.argv[5]
|
||||
minMatch = sys.argv[6]
|
||||
infile_type = sys.argv[6]
|
||||
gff_option = ""
|
||||
if infile_type == "gff":
|
||||
gff_option = "-gff "
|
||||
minMatch = sys.argv[7]
|
||||
multiple = int(sys.argv[8])
|
||||
multiple_option = ""
|
||||
if multiple:
|
||||
minChainT = sys.argv[9]
|
||||
minChainQ = sys.argv[10]
|
||||
minSizeQ = sys.argv[11]
|
||||
multiple_option = " -multiple -minChainT=%s -minChainQ=%s -minSizeQ=%s " %(minChainT,minChainQ,minSizeQ)
|
||||
|
||||
try:
|
||||
assert float(minMatch)
|
||||
except:
|
||||
@@ -55,7 +67,8 @@ if not os.path.isfile( mapfilepath ):
|
||||
stop_err( "%s mapping is not currently available." % ( mapfilepath.split('/')[-1].split('.')[0] ) )
|
||||
|
||||
safe_infile = safe_bed_file(infile)
|
||||
cmd_line = "liftOver -minMatch=" + str(minMatch) + " " + safe_infile + " " + mapfilepath + " " + outfile1 + " " + outfile2 + " > /dev/null"
|
||||
cmd_line = "liftOver " + gff_option + "-minMatch=" + str(minMatch) + multiple_option + " " + safe_infile + " " + mapfilepath + " " + outfile1 + " " + outfile2 + " > /dev/null"
|
||||
|
||||
try:
|
||||
# have to nest try-except in try-finally to handle 2.4
|
||||
try:
|
||||
|
||||
@@ -1,8 +1,21 @@
|
||||
<tool id="liftOver1" name="Convert genome coordinates" version="1.0.2">
|
||||
<tool id="liftOver1" name="Convert genome coordinates" version="1.0.3">
|
||||
<description> between assemblies and genomes</description>
|
||||
<command interpreter="python">liftOver_wrapper.py $input "$out_file1" "$out_file2" $dbkey $to_dbkey $minMatch</command>
|
||||
<command interpreter="python">
|
||||
liftOver_wrapper.py
|
||||
$input
|
||||
"$out_file1"
|
||||
"$out_file2"
|
||||
$dbkey
|
||||
$to_dbkey
|
||||
#if isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__) or isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gtf').__class__):
|
||||
"gff"
|
||||
#else:
|
||||
"interval"
|
||||
#end if
|
||||
$minMatch ${multiple.choice} ${multiple.minChainT} ${multiple.minChainQ} ${multiple.minSizeQ}
|
||||
</command>
|
||||
<inputs>
|
||||
<param format="interval" name="input" type="data" label="Convert coordinates of">
|
||||
<param format="interval,gff,gtf" name="input" type="data" label="Convert coordinates of">
|
||||
<validator type="unspecified_build" />
|
||||
<validator type="dataset_metadata_in_file" filename="liftOver.loc" metadata_name="dbkey" metadata_column="0" message="Liftover mappings are currently not available for the specified build." />
|
||||
</param>
|
||||
@@ -14,7 +27,23 @@
|
||||
<filter type="data_meta" ref="input" key="dbkey" column="0" />
|
||||
</options>
|
||||
</param>
|
||||
<param name="minMatch" size="10" type="float" value="0.95" label="Minimum ratio of bases that must remap" />
|
||||
<param name="minMatch" size="10" type="float" value="0.95" label="Minimum ratio of bases that must remap" help="Recommended values: same species = 0.95, different species = 0.10" />
|
||||
<conditional name="multiple">
|
||||
<param name="choice" type="select" label="Allow multiple output regions?" help="Recommended values: same species = No, different species = Yes">
|
||||
<option value="0" selected="true">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<when value="0">
|
||||
<param name="minSizeQ" type="hidden" value="0" />
|
||||
<param name="minChainQ" type="hidden" value="0" />
|
||||
<param name="minChainT" type="hidden" value="0" />
|
||||
</when>
|
||||
<when value="1">
|
||||
<param name="minSizeQ" size="10" type="integer" value="0" label="Minimum matching region size in query" help="Recommended value: set to >= 300 bases for complete transcripts"/>
|
||||
<param name="minChainQ" size="10" type="integer" value="500" label="Minimum chain size in query"/>
|
||||
<param name="minChainT" size="10" type="integer" value="500" label="Minimum chain size in target"/>
|
||||
</when>
|
||||
</conditional>
|
||||
</inputs>
|
||||
<outputs>
|
||||
<data format="input" name="out_file1" label="${tool.name} on ${on_string} [ MAPPED COORDINATES ]">
|
||||
@@ -37,9 +66,40 @@
|
||||
<param name="input" value="5.bed" dbkey="hg18" ftype="bed" />
|
||||
<param name="to_dbkey" value="panTro2" />
|
||||
<param name="minMatch" value="0.95" />
|
||||
<param name="choice" value="0" />
|
||||
<output name="out_file1" file="5_liftover_mapped.bed"/>
|
||||
<output name="out_file2" file="5_liftover_unmapped.bed"/>
|
||||
</test>
|
||||
<test>
|
||||
<param name="input" value="5.bed" dbkey="hg18" ftype="bed" />
|
||||
<param name="to_dbkey" value="panTro2" />
|
||||
<param name="minMatch" value="0.10" />
|
||||
<param name="choice" value="1" />
|
||||
<param name="minSizeQ" value="0" />
|
||||
<param name="minChainQ" value="500" />
|
||||
<param name="minChainT" value="500" />
|
||||
<output name="out_file1" file="5_mult_liftover_mapped.bed"/>
|
||||
<output name="out_file2" file="5_mult_liftover_unmapped.bed"/>
|
||||
</test>
|
||||
<test>
|
||||
<param name="input" value="cuffcompare_in1.gtf" dbkey="hg18" ftype="gtf" />
|
||||
<param name="to_dbkey" value="panTro2" />
|
||||
<param name="minMatch" value="0.95" />
|
||||
<param name="choice" value="0" />
|
||||
<output name="out_file1" file="cuffcompare_in1_liftover_mapped.bed"/>
|
||||
<output name="out_file2" file="cuffcompare_in1_liftover_unmapped.bed"/>
|
||||
</test>
|
||||
<test>
|
||||
<param name="input" value="cuffcompare_in1.gtf" dbkey="hg18" ftype="gtf" />
|
||||
<param name="to_dbkey" value="panTro2" />
|
||||
<param name="minMatch" value="0.10" />
|
||||
<param name="choice" value="1" />
|
||||
<param name="minSizeQ" value="0" />
|
||||
<param name="minChainQ" value="500" />
|
||||
<param name="minChainT" value="500" />
|
||||
<output name="out_file1" file="cuffcompare_in1_mult_liftover_mapped.bed"/>
|
||||
<output name="out_file2" file="cuffcompare_in1_mult_liftover_unmapped.bed"/>
|
||||
</test>
|
||||
</tests>
|
||||
<help>
|
||||
.. class:: warningmark
|
||||
@@ -48,7 +108,7 @@ Make sure that the genome build of the input dataset is specified (click the pen
|
||||
|
||||
.. class:: warningmark
|
||||
|
||||
This tool will only work on interval datasets with chromosome in column 1,
|
||||
This tool can work with interval, GFF, and GTF datasets. It requires the interval datasets to have chromosome in column 1,
|
||||
start co-ordinate in column 2 and end co-ordinate in column 3. BED comments
|
||||
and track and browser lines will be ignored, but if other non-interval lines
|
||||
are present the tool will return empty output datasets.
|
||||
@@ -59,7 +119,11 @@ are present the tool will return empty output datasets.
|
||||
|
||||
**What it does**
|
||||
|
||||
This tool converts coordinates and annotations between assemblies and genomes. It produces 2 files, one containing all the mapped coordinates and the other containing the unmapped coordinates, if any.
|
||||
This tool is based on the LiftOver utility and Chain track from `the UC Santa Cruz Genome Browser`__.
|
||||
|
||||
It converts coordinates and annotations between assemblies and genomes. It produces 2 files, one containing all the mapped coordinates and the other containing the unmapped coordinates, if any.
|
||||
|
||||
.. __: http://genome.ucsc.edu/
|
||||
|
||||
-----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user