Next changeset 1:f2e4e81f3639 (2013-04-01) |
Commit message:
Uploaded |
added:
samtools_filter.xml |
b |
diff -r 000000000000 -r 5dcbce4f5971 samtools_filter.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samtools_filter.xml Fri Mar 30 16:36:54 2012 -0400 |
[ |
b'@@ -0,0 +1,216 @@\n+<tool id="samtools_filter" name="Filter SAM or BAM" version="1.1.0">\n+ <description>files on FLAG MAPQ RG LN or by region</description>\n+ <requirements>\n+ <requirement type="package">samtools</requirement>\n+ </requirements>\n+ <!-- \n+ samtools view [-bchuHS] [-t in.refList] [-o output] [-f reqFlag] [-F skipFlag] [-q minMapQ] [-l library] [-r readGroup] [-R rgFile] <in.bam>|<in.sam> [region1 [...]]\n+ Usage: samtools view [options] <in.bam>|<in.sam> [region1 [...]]\n+\n+ Options: -b output BAM\n+ -h print header for the SAM output\n+ -H print header only (no alignments)\n+ -S input is SAM\n+ -u uncompressed BAM output (force -b)\n+ -1 fast compression (force -b)\n+ -x output FLAG in HEX (samtools-C specific)\n+ -X output FLAG in string (samtools-C specific)\n+ -c print only the count of matching records\n+ -L FILE output alignments overlapping the input BED FILE [null]\n+ -t FILE list of reference names and lengths (force -S) [null]\n+ -T FILE reference sequence file (force -S) [null]\n+ -o FILE output file name [stdout]\n+ -R FILE list of read groups to be outputted [null]\n+ -f INT required flag, 0 for unset [0]\n+ -F INT filtering flag, 0 for unset [0]\n+ -q INT minimum mapping quality [0]\n+ -l STR only output reads in library STR [null]\n+ -r STR only output reads in read group STR [null]\n+ -? longer help\n+ -->\n+ <command>\n+##set up input files, regions requires input.bam and input.bai\n+#set $input = None\n+#if isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension(\'bam\').__class__):\n+ #set $input = \'input.bam\'\n+ ln -s $input1 $input &&\n+ ln -s $input1.metadata.bam_index input.bai &&\n+#elif isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension(\'sam\').__class__):\n+ #set $input = \'input.sam\'\n+ ln -s $input1 $input &&\n+#end if\n+samtools view -o "$output1" $header\n+ #if $input1.datatype.file_ext == \'sam\':\n+ -S\n+ #else\n+ -b\n+ #end if\n+ #if $mapq.__str__ != \'\':\n+ -q $mapq\n+ #end if\n+ #if $flag.filter.__str__ == \'yes\':\n+ #if $flag.reqBits.__str__ != \'None\':\n+ #set $reqs = $flag.reqBits.__str__.split(\',\') \n+ #set $reqFlag = 0\n+ #for $xn in $reqs:\n+ #set $reqFlag += int(xn,16)\n+ #end for\n+ -f $hex($reqFlag)\n+ #end if\n+ #if $flag.skipBits.__str__ != \'None\':\n+ #set $skips = $flag.skipBits.__str__.split(\',\') \n+ #set $skipFlag = 0\n+ #for $xn in $skips:\n+ #set $skipFlag += int(xn,16)\n+ #end for\n+ -F $hex($skipFlag)\n+ #end if\n+ #end if\n+ #if $read_group.__str__.strip() != \'\':\n+ -r $read_group\n+ #end if\n+ #if $library.__str__.strip() != \'\':\n+ -l $library\n+ #end if\n+ #if $bed_file.__str__ != "None" and len($bed_file.__str__) > 0:\n+ -L $bed_file\n+ #end if\n+ $input\n+ #if $regions.__str__.strip() != \'\' and $input1.datatype.file_ext == \'bam\':\n+ $regions.__str__.strip()\n+ #end if\n+ ## need to redirect stderr message so galaxy does not think this failed\n+ 2>&1\n+ </command>\n+ <inputs>\n+ <param name="input1" type="data" format="sam,bam" label="SAM or BAM File to Filter" />\n+ <param name="header" type="select" label="Header in output">\n+ <option value="-h">Include Header</option>\n+ <option value="">Exclude Header</option>\n+ <option value="-H">Only the Header</option>\n+ </param>\n+ <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score">\n+ <validator type="in_range" message="The MAPQ quality score can\'t be negative" min="0"/>\n+ </param>\n+ <conditional name="flag">\n+ <param name="filter" type="select" label="Filter on bitwise flag">\n+ <option '..b'he mate is unmapped</option>\n+ <option value="0x0010">Read strand</option>\n+ <option value="0x0020">Mate strand</option>\n+ <option value="0x0040">Read is the first in a pair</option>\n+ <option value="0x0080">Read is the second in a pair</option>\n+ <option value="0x0100">The alignment or this read is not primary</option>\n+ <option value="0x0200">The read fails platform/vendor quality checks</option>\n+ <option value="0x0400">The read is a PCR or optical duplicate</option>\n+ </param>\n+ </when>\n+ </conditional>\n+ <param name="library" type="text" value="" size="20" label="Select alignments from Library"\n+ help="Requires headers in the input SAM or BAM, otherwise no alignments will be output."/>\n+ <param name="read_group" type="text" value="" size="20" label="Select alignments from Read Group" \n+ help="Requires headers in the input SAM or BAM, otherwise no alignments will be output."/>\n+ <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE"/>\n+ <param name="regions" type="text" value="" size="180" label="Select regions (only used when the input is in BAM format)" \n+ help="region should be presented in one of the following formats: `chr1\', `chr2:1,000\' and `chr3:1000-2,000\'"/>\n+ </inputs>\n+ <outputs>\n+ <data name="output1" format_source="input1" label="${tool.name} on ${on_string}: ${input1.datatype.file_ext}"/>\n+ </outputs>\n+ <tests>\n+ <test>\n+ <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" />\n+ <param name="header" value=""/>\n+ <param name="filter" value="yes"/>\n+ <param name="reqBits" value="0x0080"/>\n+ <output name="output1" >\n+ <assert_contents> \n+ <has_text text="141" /> \n+ <not_has_text text="77" />\n+ </assert_contents> \n+ </output>\n+ </test>\n+ <test>\n+ <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" />\n+ <param name="header" value=""/>\n+ <param name="filter" value="no"/>\n+ <param name="read_group" value="rg1"/>\n+ <output name="output1" >\n+ <assert_contents> \n+ <has_text text="rg1" /> \n+ <not_has_text text="rg2" />\n+ </assert_contents> \n+ </output>\n+ </test>\n+ <test>\n+ <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" />\n+ <param name="header" value=""/>\n+ <param name="filter" value="yes"/>\n+ <param name="skipBits" value="0x0008"/>\n+ <param name="mapq" value="250"/>\n+ <output name="output1" >\n+ <assert_contents> \n+ <has_text text="both_reads_align_clip_marked" /> \n+ <not_has_text text="both_reads_present_only_first_aligns" />\n+ </assert_contents> \n+ </output>\n+ </test>\n+ </tests>\n+ <help>\n+\n+**What it does**\n+\n+This tool uses the samtools view command in SAMTools_ toolkit to filter a SAM or BAM file on the MAPQ (mapping quality), FLAG bits, Read Group, Library, or region.\n+\n+**Input**\n+\n+Input is either a SAM or BAM file.\n+\n+**Output**\n+\n+The output file will be of the same format a the Input file, filtered by the selected options.\n+\n+**Options**\n+\n+Filtering by read group or library requires headers in the input SAM or BAM file. \n+\n+If regions are specified, only alignments overlapping the specified regions will be output. An alignment may be given multiple times if it is overlapping several regions. \n+A region can be presented, for example, in the following format::\n+\n+ chr2\t(the whole chr2)\n+ chr2:1000000\t (region starting from 1,000,000bp) \n+ chr2:1,000,000-2,000,000\t(region between 1,000,000 and 2,000,000bp including the end points). \n+\n+Note: The coordinate is 1-based.\n+\n+Multiple regions may be specified, separated by a space character::\n+\n+ chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX\n+\n+\n+\n+.. _SAMTools: http://samtools.sourceforge.net/samtools.shtml\n+\n+ </help>\n+</tool>\n' |