Next changeset 1:94d5786febc4 (2015-08-10) |
Commit message:
Imported from capsule None |
added:
samtool_filter2.xml test-data/bam_to_sam_in1.sam test-data/bam_to_sam_in2.sam tool_dependencies.xml |
b |
diff -r 000000000000 -r 2d4ae2f8231e samtool_filter2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samtool_filter2.xml Thu Feb 27 16:16:26 2014 -0500 |
[ |
b'@@ -0,0 +1,232 @@\n+<tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.1">\n+ <description>files on FLAG MAPQ RG LN or by region</description>\n+ <requirements>\n+ <requirement type="package" version="0.1.18">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+#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+ \n+ #if $input1.datatype.file_ext == \'sam\':\n+ -S\n+ #end if\n+\n+ #if $outputtype.__str__ == "bam":\n+ -b \n+ #end if\n+ \n+ \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'..b'/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+ <param name="outputtype" type="select" label="Select the output format">\n+ <option value="bam">bam</option>\n+ <option value="sam">sam</option>\n+ </param>\n+ </inputs>\n+ <outputs>\n+ <data name="output1" format_source="input1" label="${tool.name} on ${on_string}: ${input1.datatype.file_ext}">\n+ <change_format>\n+ <when input="outputtype" value="bam" format="bam" />\n+ </change_format>\n+ </data>\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+ <param name="outputtype" value="sam"/>\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+ <param name="outputtype" value="sam"/>\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+ <param name="outputtype" value="sam"/>\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+\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 SAM or BAM (depending on the chosen option), 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' |
b |
diff -r 000000000000 -r 2d4ae2f8231e test-data/bam_to_sam_in1.sam --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/bam_to_sam_in1.sam Thu Feb 27 16:16:26 2014 -0500 |
b |
@@ -0,0 +1,14 @@ +@HD VN:1.0 SO:coordinate +@SQ SN:chr1 LN:101 +@SQ SN:chr7 LN:404 +@SQ SN:chr8 LN:202 +@RG ID:0 SM:Hi,Mom! +@PG ID:1 PN:Hey! VN:2.0 +both_reads_align_clip_marked 83 chr7 1 255 101M = 302 201 CAACAGAAGCNGGNATCTGTGTTTGTGTTTCGGATTTCCTGCTGAANNGNTTNTCGNNTCNNNNNNNNATCCCGATTTCNTTCCGCAGCTNACCTCCCAAN )'.*.+2,))&&'&*/)-&*-)&.-)&)&),/-&&..)./.,.).*&&,&.&&-)&&&0*&&&&&&&&/32/,01460&&/6/*0*/2/283//36868/& RG:Z:0 +both_reads_present_only_first_aligns 89 chr7 1 255 101M * 0 0 CAACAGAAGCNGGNATCTGTGTTTGTGTTTCGGATTTCCTGCTGAANNGNTTNTCGNNTCNNNNNNNNATCCCGATTTCNTTCCGCAGCTNACCTCCCAAN )'.*.+2,))&&'&*/)-&*-)&.-)&)&),/-&&..)./.,.).*&&,&.&&-)&&&0*&&&&&&&&/32/,01460&&/6/*0*/2/283//36868/& RG:Z:0 +read_2_too_many_gaps 83 chr7 1 255 101M = 302 201 CAACAGAAGCNGGNATCTGTGTTTGTGTTTCGGATTTCCTGCTGAANNGNTTNTCGNNTCNNNNNNNNATCCCGATTTCNTTCCGCAGCTNACCTCCCAAN )'.*.+2,))&&'&*/)-&*-)&.-)&)&),/-&&..)./.,.).*&&,&.&&-)&&&0*&&&&&&&&/32/,01460&&/6/*0*/2/283//36868/& RG:Z:0 +both_reads_align_clip_adapter 147 chr7 16 255 101M = 21 -96 CAACAGAAGCNGGNATCTGTGTTTGTGTTTCGGATTTCCTGCTGAANNGNTTNTCGNNTCNNNNNNNNATCCCGATTTCNTTCCGCAGCTNACCTCCCAAN )'.*.+2,))&&'&*/)-&*-)&.-)&)&),/-&&..)./.,.).*&&,&.&&-)&&&0*&&&&&&&&/32/,01460&&/6/*0*/2/283//36868/& RG:Z:0 +both_reads_align_clip_adapter 99 chr7 21 255 101M = 16 96 CAACAGAAGCNGGNATCTGTGTTTGTGTTTCGGATTTCCTGCTGAANNGNTTNTCGNNTCNNNNNNNNATCCCGATTTCNTTCCGCAGCTNACCTCCCAAN )'.*.+2,))&&'&*/)-&*-)&.-)&)&),/-&&..)./.,.).*&&,&.&&-)&&&0*&&&&&&&&/32/,01460&&/6/*0*/2/283//36868/& RG:Z:0 +both_reads_align_clip_marked 163 chr7 302 255 101M = 1 -201 NCGCGGCATCNCGATTTCTTTCCGCAGCTAACCTCCCGACAGATCGGCAGCGCGTCGTGTAGGTTATTATGGTACATCTTGTCGTGCGGCNAGAGCATACA &/15445666651/566666553+2/14/&/555512+3/)-'/-&-'*+))*''13+3)'//++''/'))/3+&*5++)&'2+&+/*&-&&*)&-./1'1 RG:Z:0 +read_2_too_many_gaps 163 chr7 302 255 10M1D10M5I76M = 1 -201 NCGCGGCATCNCGATTTCTTTCCGCAGCTAACCTCCCGACAGATCGGCAGCGCGTCGTGTAGGTTATTATGGTACATCTTGTCGTGCGGCNAGAGCATACA &/15445666651/566666553+2/14/&/555512+3/)-'/-&-'*+))*''13+3)'//++''/'))/3+&*5++)&'2+&+/*&-&&*)&-./1'1 RG:Z:0 +both_reads_present_only_first_aligns 165 * 0 0 * chr7 1 0 NCGCGGCATCNCGATTTCTTTCCGCAGCTAACCTCCCGACAGATCGGCAGCGCGTCGTGTAGGTTATTATGGTACATCTTGTCGTGCGGCNAGAGCATACA &/15445666651/566666553+2/14/&/555512+3/)-'/-&-'*+))*''13+3)'//++''/'))/3+&*5++)&'2+&+/*&-&&*)&-./1'1 RG:Z:0 |
b |
diff -r 000000000000 -r 2d4ae2f8231e test-data/bam_to_sam_in2.sam --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/bam_to_sam_in2.sam Thu Feb 27 16:16:26 2014 -0500 |
b |
@@ -0,0 +1,25 @@ +@HD VN:1.0 SO:coordinate +@SQ SN:chr1 LN:10001 +@SQ SN:chr2 LN:100001 +@SQ SN:chr3 LN:10001 +@SQ SN:chr4 LN:1001 +@RG ID:rg1 SM:s1 +@RG ID:rg2 SM:s3 +bar:record:4 77 chr1 1 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg1 +bar:record:6 77 chr1 1 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg2 +bar:record:1 77 chr1 10 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg1 +bar:record:3 77 chr1 10 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg2 +bar:record:1 141 chr1 20 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:7 77 chr1 20 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg2 +bar:record:8 77 chr1 30 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg2 +bar:record:4 141 chr1 40 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:5 77 chr1 40 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg2 +bar:record:6 141 chr1 50 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg2 +bar:record:2 77 chr2 10 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg1 +bar:record:2 141 chr2 30 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg2 +bar:record:3 141 chr3 20 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:8 141 chr3 20 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:5 141 chr3 40 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:9 77 chr4 10 0 * * 0 0 AAAAAAAAAAAAA 1111111111111 RG:Z:rg1 +bar:record:7 141 chr4 20 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 +bar:record:9 141 chr4 60 0 * * 0 0 CCCCCCCCCCCCC 2222222222222 RG:Z:rg1 |
b |
diff -r 000000000000 -r 2d4ae2f8231e tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Thu Feb 27 16:16:26 2014 -0500 |
b |
@@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="samtools" version="0.1.18"> + <repository changeset_revision="171cd8bc208d" name="package_samtools_0_1_18" owner="devteam" prior_installation_required="False" toolshed="http://toolshed.g2.bx.psu.edu" /> + </package> +</tool_dependency> |