comparison samtools_view.xml @ 10:350bbc5c2ffd draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit 0f75269223c0821c6c82acf98fde947d0f816f2b"
author iuc
date Tue, 28 Sep 2021 16:18:32 +0000
parents b72793637686
children df20f1fd453f
comparison
equal deleted inserted replaced
9:b72793637686 10:350bbc5c2ffd
1 <tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@+galaxy3"> 1 <tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@" profile="@PROFILE@">
2 <description>- reformat, filter, or subsample SAM, BAM or CRAM</description> 2 <description>- reformat, filter, or subsample SAM, BAM or CRAM</description>
3 <macros> 3 <macros>
4 <import>macros.xml</import> 4 <import>macros.xml</import>
5 <token name="@REF_DATA@"> 5 <token name="@REF_DATA@">
6 ## additional reference data 6 ## additional reference data
119 #set $std_filters = $std_filters + " -l '%s'" % str($mode.filter_config.library) 119 #set $std_filters = $std_filters + " -l '%s'" % str($mode.filter_config.library)
120 #end if 120 #end if
121 #if str($mode.filter_config.cigarcons): 121 #if str($mode.filter_config.cigarcons):
122 #set $std_filters = $std_filters + " -m %s" % str($mode.filter_config.cigarcons) 122 #set $std_filters = $std_filters + " -m %s" % str($mode.filter_config.cigarcons)
123 #end if 123 #end if
124 #if str($mode.filter_config.inclusive_filter) != 'None': 124 #set $filter = $mode.filter_config.inclusive_filter
125 #set $filter = str($mode.filter_config.inclusive_filter) 125 @FLAGS@
126 @FLAGS@ 126 #set $std_filters = $std_filters + " -f %s" % str($flags)
127 #set $std_filters = $std_filters + " -f %s" % str($flags) 127 #set $filter = $mode.filter_config.exclusive_filter
128 #end if 128 @FLAGS@
129 #if str($mode.filter_config.exclusive_filter) != 'None': 129 #set $std_filters = $std_filters + " -F %s" % str($flags)
130 #set $filter = str($mode.filter_config.exclusive_filter) 130 #set $filter = $mode.filter_config.exclusive_filter_all
131 @FLAGS@ 131 @FLAGS@
132 #set $std_filters = $std_filters + " -F %s" % str($flags) 132 #set $std_filters = $std_filters + " -G %s" % str($flags)
133 #end if 133 #if $mode.filter_config.tag:
134 #if str($mode.filter_config.exclusive_filter_all) != 'None': 134 #set $std_filters = $std_filters + " --tag '%s'" % $mode.filter_config.tag
135 #set $filter = str($mode.filter_config.exclusive_filter_all) 135 #end if
136 @FLAGS@ 136 #if $mode.filter_config.qname_file:
137 #set $std_filters = $std_filters + " -G %s" % str($flags) 137 #set std_filters = $std_filters + " --qname-file '%s'" % $mode.filter_config.qname_file
138 #end if 138 #end if
139 #end if 139 #end if
140 140
141 #if $with_subsampling: 141 #if $with_subsampling:
142 ## handle seed and fraction calculation for subsampling 142 ## handle seed and fraction calculation for subsampling
309 <expand macro="flag_options" /> 309 <expand macro="flag_options" />
310 </param> 310 </param>
311 <param name="exclusive_filter_all" argument="-G" type="select" multiple="True" label="Exclude reads with all of the following flags set"> 311 <param name="exclusive_filter_all" argument="-G" type="select" multiple="True" label="Exclude reads with all of the following flags set">
312 <expand macro="flag_options" /> 312 <expand macro="flag_options" />
313 </param> 313 </param>
314 <param argument="--tag" type="text" optional="true" label="Filter by tag" help="Only include reads with tag STR1 and associated value STR2. Write in the format STR1:STR2 (see help for more details)." />
315 <!-- TODO implement -D -->
316 <param argument="--qname-file" format="text" optional="true" type="data" label="Filter by readnames" help="Only output alignments with readnames that are listed in this file." />
314 </section> 317 </section>
315 <section name="subsample_config" title="Configure subsampling" expanded="false"> 318 <section name="subsample_config" title="Configure subsampling" expanded="false">
316 <conditional name="subsampling_mode"> 319 <conditional name="subsampling_mode">
317 <param name="select_subsample" type="select" argument="-s" label="Subsample alignment"> 320 <param name="select_subsample" type="select" argument="-s" label="Subsample alignment">
318 <option value="fraction">Specify a downsampling factor</option> 321 <option value="fraction">Specify a downsampling factor</option>
368 <expand macro="output_format_selector" /> 371 <expand macro="output_format_selector" />
369 </when> 372 </when>
370 </conditional> 373 </conditional>
371 </when> 374 </when>
372 </conditional> 375 </conditional>
373 <conditional name="addref_cond"> 376 <expand macro="optional_reference" argument="-t" help="Reference data as fasta(.gz). Required for SAM input without @SQ headers and useful/required for writing CRAM output (see help)."/>
374 <param name="addref_select" type="select" label="Reference data">
375 <help>Reference data as fasta(.gz). Required for SAM input without @SQ headers and useful/required for writing CRAM output (see help).</help>
376 <option value="no" selected="True">No, see help (-output-fmt-option no_ref)</option>
377 <option value="history">Use a genome/index from the history (-t/-T)</option>
378 <option value="cached">Use a built-in genome (-t/-T)</option>
379 </param>
380 <when value="no"/>
381 <when value="history">
382 <param name="ref" format="fasta,fasta.gz" optional="true" type="data" label="Reference file"/>
383 </when>
384 <when value="cached">
385 <param name="ref" type="select" label="Using reference genome">
386 <options from_data_table="fasta_indexes">
387 <filter column="dbkey" key="dbkey" ref="input" type="data_meta" />
388 <validator message="No reference genome is available for the build associated with the selected input dataset" type="no_options" />
389 </options>
390 </param>
391 </when>
392 </conditional>
393 </inputs> 377 </inputs>
394 <outputs> 378 <outputs>
395 <!-- TODO do I need an action for dbkey? --> 379 <!-- TODO do I need an action for dbkey? -->
396 <data name="outputsam" format_source="input" from_work_dir="outfile" label="${tool.name} on ${on_string}: filtered alignments"> 380 <data name="outputsam" format_source="input" from_work_dir="outfile" label="${tool.name} on ${on_string}: filtered alignments">
397 <filter>mode['outtype'] == 'header' or mode['output_options']['reads_report_type'] != 'count'</filter> 381 <filter>mode['outtype'] == 'header' or mode['output_options']['reads_report_type'] != 'count'</filter>
412 <data name="outputcnt" format="tabular" from_work_dir="outfile" label="${tool.name} on ${on_string}: Counts"> 396 <data name="outputcnt" format="tabular" from_work_dir="outfile" label="${tool.name} on ${on_string}: Counts">
413 <filter>mode['outtype'] != 'header' and mode['output_options']['reads_report_type'] == 'count'</filter> 397 <filter>mode['outtype'] != 'header' and mode['output_options']['reads_report_type'] == 'count'</filter>
414 </data> 398 </data>
415 </outputs> 399 </outputs>
416 <tests> 400 <tests>
417 <!-- sam to bam (copied from the sam_to_bam tool) --> 401 <!-- 1) sam to bam (copied from the sam_to_bam tool) -->
418 <test> 402 <test>
419 <param name="input" ftype="sam" value="sam_to_bam_in1.sam" /> 403 <param name="input" ftype="sam" value="in_test_1.sam" />
420 <output name="outputsam" ftype="bam" file="sam_to_bam_out1.bam" /> 404 <output name="outputsam" ftype="bam" file="test_1.bam" lines_diff="4" />
421 </test> 405 </test>
422 <test> 406 <!-- 2) -->
423 <param name="input" ftype="sam" dbkey="equCab2" value="sam_to_bam_in1.sam" /> 407 <test>
408 <param name="input" ftype="sam" dbkey="equCab2" value="in_test_1.sam" />
424 <conditional name="addref_cond"> 409 <conditional name="addref_cond">
425 <param name="addref_select" value="cached" /> 410 <param name="addref_select" value="cached" />
426 <param name="ref" value="equCab2chrM" /> 411 <param name="ref" value="equCab2chrM" />
427 </conditional> 412 </conditional>
428 <output name="outputsam" ftype="bam" file="sam_to_bam_out2.bam" /> 413 <output name="outputsam" ftype="bam" file="test_2.bam" lines_diff="4" />
429 </test> 414 </test>
430 <test> 415 <!-- 3) -->
431 <param name="input" ftype="sam" value="sam_to_bam_noheader_in2.sam" /> 416 <test>
417 <param name="input" ftype="sam" value="in_test_3.sam" />
432 <conditional name="addref_cond"> 418 <conditional name="addref_cond">
433 <param name="addref_select" value="history" /> 419 <param name="addref_select" value="history" />
434 <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" /> 420 <param name="ref" ftype="fasta" dbkey="equCab2" value="chr_m.fasta" />
435 </conditional> 421 </conditional>
436 <output name="outputsam" ftype="bam" file="sam_to_bam_out3.bam" /> 422 <output name="outputsam" ftype="bam" file="test_3.bam" lines_diff="4" />
437 </test> 423 </test>
438 424 <!-- 4) cram to bam -->
439 <!-- bam to cram --> 425 <test>
440 <test> 426 <param name="input" value="in_test_4.cram" ftype="cram" />
441 <param name="input" value="test.cram" ftype="cram" />
442 <conditional name="addref_cond"> 427 <conditional name="addref_cond">
443 <param name="addref_select" value="history" /> 428 <param name="addref_select" value="history" />
444 <param name="ref" value="test.fa" /> 429 <param name="ref" value="test.fa" />
445 </conditional> 430 </conditional>
446 <output name="outputsam" file="test.bam" ftype="bam" /> 431 <output name="outputsam" file="test_4.bam" ftype="bam" lines_diff="4" />
447 </test> 432 </test>
448 433 <!-- 5) within bam operations expected to result in sorting or not -->
449 <!-- within bam operations expected to result in sorting or not --> 434 <test >
450 <test>
451 <!-- sorted bam should always result in unmodifed output --> 435 <!-- sorted bam should always result in unmodifed output -->
452 <param name="input" ftype="bam" value="1_sort.bam" /> 436 <param name="input" ftype="bam" value="in_test_5.bam" />
453 <assert_command> 437 <assert_command>
454 <not_has_text text="samtools sort" /> 438 <not_has_text text="samtools sort" />
455 </assert_command> 439 </assert_command>
456 <output name="outputsam" ftype="bam" file="1_sort.bam" /> 440 <output name="outputsam" ftype="bam" file="test_5.bam" lines_diff="2"/>
457 </test> 441 </test>
442 <!-- 6) -->
458 <test> 443 <test>
459 <!-- sorted bam should always result in unmodifed output --> 444 <!-- sorted bam should always result in unmodifed output -->
460 <param name="input" ftype="bam" value="1_sort.bam" /> 445 <param name="input" ftype="bam" value="in_test_5.bam" />
461 <conditional name="mode"> 446 <conditional name="mode">
462 <conditional name="output_options"> 447 <conditional name="output_options">
463 <conditional name="output_format"> 448 <conditional name="output_format">
464 <param name="oformat" value="input" /> 449 <param name="oformat" value="input" />
465 </conditional> 450 </conditional>
466 </conditional> 451 </conditional>
467 </conditional> 452 </conditional>
468 <assert_command> 453 <assert_command>
469 <not_has_text text="samtools sort" /> 454 <not_has_text text="samtools sort" />
470 </assert_command> 455 </assert_command>
471 <output name="outputsam" ftype="bam" file="1_sort.bam" /> 456 <output name="outputsam" ftype="bam" file="test_5.bam" lines_diff="2"/>
472 </test> 457 </test>
458 <!-- 7) -->
473 <test> 459 <test>
474 <!-- qname_sorted.bam should get sorted during "conversion" to bam ... --> 460 <!-- qname_sorted.bam should get sorted during "conversion" to bam ... -->
475 <param name="input" ftype="qname_sorted.bam" value="1_sort_read_names.bam" /> 461 <param name="input" ftype="qname_sorted.bam" value="in_test_7.bam" />
476 <assert_command> 462 <assert_command>
477 <has_text text="samtools sort" /> 463 <has_text text="samtools sort" />
478 </assert_command> 464 </assert_command>
479 <output name="outputsam" ftype="bam" file="1_sort.bam" /> 465 <output name="outputsam" ftype="bam" file="test_7.bam" lines_diff="4" />
480 </test> 466 </test>
467 <!-- 8) -->
481 <test> 468 <test>
482 <!-- ... but should be emitted unmodifed when using input format --> 469 <!-- ... but should be emitted unmodifed when using input format -->
483 <param name="input" ftype="qname_sorted.bam" value="1_sort_read_names.bam" /> 470 <param name="input" ftype="qname_sorted.bam" value="in_test_7.bam" />
484 <conditional name="mode"> 471 <conditional name="mode">
485 <conditional name="output_options"> 472 <conditional name="output_options">
486 <conditional name="output_format"> 473 <conditional name="output_format">
487 <param name="oformat" value="input" /> 474 <param name="oformat" value="input" />
488 </conditional> 475 </conditional>
489 </conditional> 476 </conditional>
490 </conditional> 477 </conditional>
491 <assert_command> 478 <assert_command>
492 <not_has_text text="samtools sort" /> 479 <not_has_text text="samtools sort" />
493 </assert_command> 480 </assert_command>
494 <output name="outputsam" ftype="qname_sorted.bam" file="1_sort_read_names.bam" /> 481 <output name="outputsam" ftype="qname_sorted.bam" file="test_8.bam" lines_diff="2"/>
495 </test> 482 </test>
483 <!-- 9) -->
496 <test> 484 <test>
497 <!-- unsorted.bam should get sorted during "conversion" to bam ... --> 485 <!-- unsorted.bam should get sorted during "conversion" to bam ... -->
498 <param name="input" ftype="unsorted.bam" value="1_sort_read_names.bam" /> 486 <param name="input" ftype="unsorted.bam" value="in_test_7.bam" />
499 <assert_command> 487 <assert_command>
500 <has_text text="samtools sort" /> 488 <has_text text="samtools sort" />
501 </assert_command> 489 </assert_command>
502 <output name="outputsam" ftype="bam" file="1_sort.bam" /> 490 <output name="outputsam" ftype="bam" file="test_7.bam" lines_diff="4" />
503 </test> 491 </test>
492 <!-- 10) -->
504 <test> 493 <test>
505 <!-- ... ... but should be emitted unmodifed when using input format --> 494 <!-- ... ... but should be emitted unmodifed when using input format -->
506 <param name="input" ftype="unsorted.bam" value="1_sort_read_names.bam" /> 495 <param name="input" ftype="unsorted.bam" value="in_test_7.bam" />
507 <conditional name="mode"> 496 <conditional name="mode">
508 <conditional name="output_options"> 497 <conditional name="output_options">
509 <conditional name="output_format"> 498 <conditional name="output_format">
510 <param name="oformat" value="input" /> 499 <param name="oformat" value="input" />
511 </conditional> 500 </conditional>
512 </conditional> 501 </conditional>
513 </conditional> 502 </conditional>
514 <assert_command> 503 <assert_command>
515 <not_has_text text="samtools sort" /> 504 <not_has_text text="samtools sort" />
516 </assert_command> 505 </assert_command>
517 <output name="outputsam" ftype="unsorted.bam" file="1_sort_read_names.bam" /> 506 <output name="outputsam" ftype="unsorted.bam" file="test_8.bam" lines_diff="2" />
518 </test> 507 </test>
519 508 <!-- 11) bam to sam + header options (adapted from bam_to_sam tool)-->
520 <!-- bam to sam + header options (adapted from bam_to_sam tool)--> 509 <test>
521 <test> 510 <param ftype="bam" name="input" value="in_test_11.bam" />
522 <param ftype="bam" name="input" value="bam_to_sam_in1.bam" />
523 <conditional name="mode"> 511 <conditional name="mode">
524 <conditional name="output_options"> 512 <conditional name="output_options">
525 <conditional name="output_format"> 513 <conditional name="output_format">
526 <param name="oformat" value="sam" /> 514 <param name="oformat" value="sam" />
527 <param name="with_header" value="true" /> 515 <param name="with_header" value="true" />
528 </conditional> 516 </conditional>
529 </conditional> 517 </conditional>
530 </conditional> 518 </conditional>
531 <output file="bam_to_sam_out1.sam" ftype="sam" name="outputsam" /> 519 <output file="test_11.sam" ftype="sam" name="outputsam" lines_diff="2" />
532 </test> 520 </test>
533 <test> 521 <!-- 12) -->
534 <param ftype="bam" name="input" value="bam_to_sam_in1.bam" /> 522 <test>
523 <param ftype="bam" name="input" value="in_test_11.bam" />
535 <conditional name="mode"> 524 <conditional name="mode">
536 <param name="outtype" value="header" /> 525 <param name="outtype" value="header" />
537 <conditional name="output_options"> 526 <conditional name="output_options">
538 <conditional name="output_format"> 527 <conditional name="output_format">
539 <param name="oformat" value="sam" /> 528 <param name="oformat" value="sam" />
540 </conditional> 529 </conditional>
541 </conditional> 530 </conditional>
542 </conditional> 531 </conditional>
543 <output file="bam_to_sam_out2.sam" ftype="sam" name="outputsam" /> 532 <output file="test_12.sam" ftype="sam" name="outputsam" lines_diff="2" />
544 </test> 533 </test>
545 <test> 534 <!-- 13) -->
546 <param ftype="bam" name="input" value="bam_to_sam_in1.bam" /> 535 <test>
536 <param ftype="bam" name="input" value="in_test_11.bam" />
547 <conditional name="mode"> 537 <conditional name="mode">
548 <conditional name="output_options"> 538 <conditional name="output_options">
549 <conditional name="output_format"> 539 <conditional name="output_format">
550 <param name="oformat" value="sam" /> 540 <param name="oformat" value="sam" />
551 <param name="with_header" value="false" /> 541 <param name="with_header" value="false" />
552 </conditional> 542 </conditional>
553 </conditional> 543 </conditional>
554 </conditional> 544 </conditional>
555 <output file="bam_to_sam_out3.sam" ftype="sam" name="outputsam" /> 545 <output file="test_13.sam" ftype="sam" name="outputsam" lines_diff="2" />
556 </test> 546 </test>
557 547 <!-- 14) count alignments -->
558 <!-- count alignments --> 548 <test>
559 <test> 549 <param name="input" value="in_test_14.bam" ftype="bam" />
560 <param name="input" value="test.bam" ftype="bam" />
561 <conditional name="mode"> 550 <conditional name="mode">
562 <param name="outtype" value="all_reads" /> 551 <param name="outtype" value="all_reads" />
563 <conditional name="output_options"> 552 <conditional name="output_options">
564 <param name="reads_report_type" value="count" /> 553 <param name="reads_report_type" value="count" />
565 </conditional> 554 </conditional>
566 </conditional> 555 </conditional>
567 <output name="outputcnt" file="test_counts.tab" ftype="tabular" /> 556 <output name="outputcnt" file="test_14.tab" ftype="tabular" lines_diff="2" />
568 </test> 557 </test>
569 558 <!-- 15) region filters -->
570 <!-- region filters --> 559 <test>
571 <test> 560 <param name="input" value="in_test_15.sam" ftype="sam" />
572 <param name="input" value="test.sam" ftype="sam" />
573 <conditional name="mode"> 561 <conditional name="mode">
574 <param name="outtype" value="selected_reads" /> 562 <param name="outtype" value="selected_reads" />
575 <section name="filter_config"> 563 <section name="filter_config">
576 <conditional name="cond_region"> 564 <conditional name="cond_region">
577 <param name="select_region" value="no"/> 565 <param name="select_region" value="no"/>
585 </conditional> 573 </conditional>
586 <conditional name="addref_cond"> 574 <conditional name="addref_cond">
587 <param name="addref_select" value="history" /> 575 <param name="addref_select" value="history" />
588 <param name="ref" value="test.fa" /> 576 <param name="ref" value="test.fa" />
589 </conditional> 577 </conditional>
590 <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" /> 578 <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
591 </test> 579 </test>
592 <test> 580 <!-- 16) -->
593 <param name="input" value="test.bam" ftype="bam" /> 581 <test>
582 <param name="input" value="in_test_14.bam" ftype="bam" />
594 <conditional name="mode"> 583 <conditional name="mode">
595 <param name="outtype" value="selected_reads" /> 584 <param name="outtype" value="selected_reads" />
596 <section name="filter_config"> 585 <section name="filter_config">
597 <conditional name="cond_region"> 586 <conditional name="cond_region">
598 <param name="select_region" value="no"/> 587 <param name="select_region" value="no"/>
606 </conditional> 595 </conditional>
607 <conditional name="addref_cond"> 596 <conditional name="addref_cond">
608 <param name="addref_select" value="history" /> 597 <param name="addref_select" value="history" />
609 <param name="ref" value="test.fa" /> 598 <param name="ref" value="test.fa" />
610 </conditional> 599 </conditional>
611 <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" /> 600 <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
612 </test> 601 </test>
613 <test> 602 <!-- 17) -->
614 <param name="input" value="test2.cram" dbkey="equCab2" ftype="cram" /> 603 <test>
604 <param name="input" value="in_test_17.cram" dbkey="equCab2" ftype="cram" />
615 <conditional name="mode"> 605 <conditional name="mode">
616 <param name="outtype" value="selected_reads" /> 606 <param name="outtype" value="selected_reads" />
617 <section name="filter_config"> 607 <section name="filter_config">
618 <conditional name="cond_region"> 608 <conditional name="cond_region">
619 <param name="select_region" value="no"/> 609 <param name="select_region" value="no"/>
627 </conditional> 617 </conditional>
628 <conditional name="addref_cond"> 618 <conditional name="addref_cond">
629 <param name="addref_select" value="cached" /> 619 <param name="addref_select" value="cached" />
630 <param name="ref" value="equCab2chrM" /> 620 <param name="ref" value="equCab2chrM" />
631 </conditional> 621 </conditional>
632 <output name="outputsam" file="sam_to_bam_out2.bam" ftype="bam" /> 622 <output name="outputsam" file="test_17.bam" ftype="bam" lines_diff="4" />
633 </test> 623 </test>
634 <test> 624 <!-- 18) -->
635 <param name="input" value="test.bam" ftype="bam" /> 625 <test>
626 <param name="input" value="in_test_14.bam" ftype="bam" />
636 <conditional name="mode"> 627 <conditional name="mode">
637 <param name="outtype" value="selected_reads" /> 628 <param name="outtype" value="selected_reads" />
638 <section name="filter_config"> 629 <section name="filter_config">
639 <conditional name="cond_region"> 630 <conditional name="cond_region">
640 <param name="select_region" value="text"/> 631 <param name="select_region" value="text"/>
649 </conditional> 640 </conditional>
650 <conditional name="addref_cond"> 641 <conditional name="addref_cond">
651 <param name="addref_select" value="history" /> 642 <param name="addref_select" value="history" />
652 <param name="ref" value="test.fa" /> 643 <param name="ref" value="test.fa" />
653 </conditional> 644 </conditional>
654 <output name="outputsam" file="test.cram" ftype="cram" compare="sim_size" delta="250" /> 645 <output name="outputsam" file="test_15.cram" ftype="cram" compare="sim_size" delta="250" />
655 </test> 646 </test>
656 <test> 647 <!-- 19) -->
657 <param name="input" value="test.cram" ftype="cram" /> 648 <test>
649 <param name="input" value="test_15.cram" ftype="cram" />
658 <conditional name="mode"> 650 <conditional name="mode">
659 <param name="outtype" value="selected_reads" /> 651 <param name="outtype" value="selected_reads" />
660 <section name="filter_config"> 652 <section name="filter_config">
661 <conditional name="cond_region"> 653 <conditional name="cond_region">
662 <param name="select_region" value="text"/> 654 <param name="select_region" value="text"/>
671 </conditional> 663 </conditional>
672 <conditional name="addref_cond"> 664 <conditional name="addref_cond">
673 <param name="addref_select" value="history" /> 665 <param name="addref_select" value="history" />
674 <param name="ref" value="test.fa" /> 666 <param name="ref" value="test.fa" />
675 </conditional> 667 </conditional>
676 <output name="outputsam" file="test.bam" ftype="bam" /> 668 <output name="outputsam" file="test_19.bam" ftype="bam" lines_diff="4"/>
677 </test> 669 </test>
678 <test> 670 <!-- 20) -->
679 <param name="input" value="test.cram" ftype="cram" /> 671 <test>
672 <param name="input" value="test_15.cram" ftype="cram" />
680 <conditional name="mode"> 673 <conditional name="mode">
681 <param name="outtype" value="selected_reads" /> 674 <param name="outtype" value="selected_reads" />
682 <section name="filter_config"> 675 <section name="filter_config">
683 <conditional name="cond_region"> 676 <conditional name="cond_region">
684 <param name="select_region" value="bed" /> 677 <param name="select_region" value="bed" />
693 </conditional> 686 </conditional>
694 <conditional name="addref_cond"> 687 <conditional name="addref_cond">
695 <param name="addref_select" value="history" /> 688 <param name="addref_select" value="history" />
696 <param name="ref" value="test.fa" /> 689 <param name="ref" value="test.fa" />
697 </conditional> 690 </conditional>
698 <output name="outputsam" file="test.bam" ftype="bam" /> 691 <output name="outputsam" file="test_20.bam" ftype="bam" lines_diff="4" />
699 </test> 692 </test>
700 693 <!-- 21) sampling options-->
701 <!-- sampling options--> 694 <test>
702 <test> 695 <param name="input" value="in_test_15.sam" ftype="sam" />
703 <param name="input" value="test.sam" ftype="sam" />
704 <conditional name="mode"> 696 <conditional name="mode">
705 <param name="outtype" value="selected_reads" /> 697 <param name="outtype" value="selected_reads" />
706 <section name="subsample_config"> 698 <section name="subsample_config">
707 <conditional name="subsampling_mode"> 699 <conditional name="subsampling_mode">
708 <param name="select_subsample" value="target" /> 700 <param name="select_subsample" value="target" />
713 <conditional name="output_format"> 705 <conditional name="output_format">
714 <param name="oformat" value="input" /> 706 <param name="oformat" value="input" />
715 </conditional> 707 </conditional>
716 </conditional> 708 </conditional>
717 </conditional> 709 </conditional>
718 <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" /> 710 <output name="outputsam" file="test_21.sam" ftype="sam" compare="diff" lines_diff="6" />
719 </test> 711 </test>
720 <test> 712 <!-- 22) -->
721 <param name="input" value="test.sam" ftype="sam" /> 713 <test>
714 <param name="input" value="in_test_15.sam" ftype="sam" />
722 <conditional name="mode"> 715 <conditional name="mode">
723 <param name="outtype" value="selected_reads" /> 716 <param name="outtype" value="selected_reads" />
724 <section name="subsample_config"> 717 <section name="subsample_config">
725 <conditional name="subsampling_mode"> 718 <conditional name="subsampling_mode">
726 <param name="select_subsample" value="target" /> 719 <param name="select_subsample" value="target" />
731 <conditional name="output_format"> 724 <conditional name="output_format">
732 <param name="oformat" value="input" /> 725 <param name="oformat" value="input" />
733 </conditional> 726 </conditional>
734 </conditional> 727 </conditional>
735 </conditional> 728 </conditional>
736 <output name="outputsam" file="test.sam" ftype="sam" /> 729 <output name="outputsam" file="test_22.sam" ftype="sam" lines_diff="2"/>
737 </test> 730 </test>
731 <!-- 23) -->
738 <test> 732 <test>
739 <!-- subsampling SAM input without reads --> 733 <!-- subsampling SAM input without reads -->
740 <param name="input" value="no_reads.sam" ftype="sam" /> 734 <param name="input" value="in_test_23.sam" ftype="sam" />
741 <conditional name="mode"> 735 <conditional name="mode">
742 <param name="outtype" value="selected_reads" /> 736 <param name="outtype" value="selected_reads" />
743 <section name="subsample_config"> 737 <section name="subsample_config">
744 <conditional name="subsampling_mode"> 738 <conditional name="subsampling_mode">
745 <param name="select_subsample" value="target" /> 739 <param name="select_subsample" value="target" />
750 <conditional name="output_format"> 744 <conditional name="output_format">
751 <param name="oformat" value="input" /> 745 <param name="oformat" value="input" />
752 </conditional> 746 </conditional>
753 </conditional> 747 </conditional>
754 </conditional> 748 </conditional>
755 <output name="outputsam" file="no_reads.sam" ftype="sam" /> 749 <output name="outputsam" file="test_23.sam" ftype="sam" lines_diff="2"/>
756 </test> 750 </test>
751 <!-- 24) -->
757 <test> 752 <test>
758 <!-- subsampling BAM input without reads --> 753 <!-- subsampling BAM input without reads -->
759 <param name="input" value="no_reads.bam" ftype="bam" /> 754 <param name="input" value="in_test_24.bam" ftype="bam" />
760 <conditional name="mode"> 755 <conditional name="mode">
761 <param name="outtype" value="selected_reads" /> 756 <param name="outtype" value="selected_reads" />
762 <section name="subsample_config"> 757 <section name="subsample_config">
763 <conditional name="subsampling_mode"> 758 <conditional name="subsampling_mode">
764 <param name="select_subsample" value="target" /> 759 <param name="select_subsample" value="target" />
769 <conditional name="output_format"> 764 <conditional name="output_format">
770 <param name="oformat" value="input" /> 765 <param name="oformat" value="input" />
771 </conditional> 766 </conditional>
772 </conditional> 767 </conditional>
773 </conditional> 768 </conditional>
774 <output name="outputsam" file="no_reads.bam" ftype="bam" /> 769 <output name="outputsam" file="test_24.bam" ftype="bam" lines_diff="2" />
775 </test> 770 </test>
776 <test> 771 <!-- 25) -->
777 <param name="input" value="test.sam" ftype="sam" /> 772 <test>
773 <param name="input" value="in_test_15.sam" ftype="sam" />
778 <conditional name="mode"> 774 <conditional name="mode">
779 <param name="outtype" value="selected_reads" /> 775 <param name="outtype" value="selected_reads" />
780 <section name="subsample_config"> 776 <section name="subsample_config">
781 <conditional name="subsampling_mode"> 777 <conditional name="subsampling_mode">
782 <param name="select_subsample" value="target" /> 778 <param name="select_subsample" value="target" />
788 <conditional name="output_format"> 784 <conditional name="output_format">
789 <param name="oformat" value="input" /> 785 <param name="oformat" value="input" />
790 </conditional> 786 </conditional>
791 </conditional> 787 </conditional>
792 </conditional> 788 </conditional>
793 <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" /> 789 <output name="outputsam" file="test_25.sam" ftype="sam" compare="diff" lines_diff="6" />
794 </test> 790 </test>
795 <test> 791 <!-- 26) -->
796 <param name="input" value="test.bam" ftype="bam" /> 792 <test>
793 <param name="input" value="in_test_14.bam" ftype="bam" />
797 <conditional name="mode"> 794 <conditional name="mode">
798 <param name="outtype" value="selected_reads" /> 795 <param name="outtype" value="selected_reads" />
799 <section name="subsample_config"> 796 <section name="subsample_config">
800 <conditional name="subsampling_mode"> 797 <conditional name="subsampling_mode">
801 <param name="select_subsample" value="target" /> 798 <param name="select_subsample" value="target" />
807 <conditional name="output_format"> 804 <conditional name="output_format">
808 <param name="oformat" value="input" /> 805 <param name="oformat" value="input" />
809 </conditional> 806 </conditional>
810 </conditional> 807 </conditional>
811 </conditional> 808 </conditional>
812 <output name="outputsam" file="test_ds.bam" ftype="bam" /> 809 <output name="outputsam" file="test_26.bam" ftype="bam" lines_diff="2" />
813 </test> 810 </test>
814 <test> 811 <!-- 27) -->
815 <param name="input" value="test.bam" ftype="bam" /> 812 <test>
813 <param name="input" value="in_test_14.bam" ftype="bam" />
816 <conditional name="mode"> 814 <conditional name="mode">
817 <param name="outtype" value="selected_reads" /> 815 <param name="outtype" value="selected_reads" />
818 <section name="subsample_config"> 816 <section name="subsample_config">
819 <conditional name="subsampling_mode"> 817 <conditional name="subsampling_mode">
820 <param name="select_subsample" value="target" /> 818 <param name="select_subsample" value="target" />
826 <conditional name="output_format"> 824 <conditional name="output_format">
827 <param name="oformat" value="input" /> 825 <param name="oformat" value="input" />
828 </conditional> 826 </conditional>
829 </conditional> 827 </conditional>
830 </conditional> 828 </conditional>
831 <output name="outputsam" file="test.bam" ftype="bam" /> 829 <output name="outputsam" file="test_27.bam" ftype="bam" lines_diff="2"/>
832 </test> 830 </test>
833 <test> 831 <!-- 28) -->
834 <param name="input" value="test.bam" ftype="bam" /> 832 <test>
833 <param name="input" value="in_test_14.bam" ftype="bam" />
835 <conditional name="mode"> 834 <conditional name="mode">
836 <param name="outtype" value="selected_reads" /> 835 <param name="outtype" value="selected_reads" />
837 <section name="subsample_config"> 836 <section name="subsample_config">
838 <conditional name="subsampling_mode"> 837 <conditional name="subsampling_mode">
839 <param name="select_subsample" value="fraction" /> 838 <param name="select_subsample" value="fraction" />
845 <conditional name="output_format"> 844 <conditional name="output_format">
846 <param name="oformat" value="input" /> 845 <param name="oformat" value="input" />
847 </conditional> 846 </conditional>
848 </conditional> 847 </conditional>
849 </conditional> 848 </conditional>
850 <output name="outputsam" file="test_ds.bam" ftype="bam" /> 849 <output name="outputsam" file="test_28.bam" ftype="bam" lines_diff="2" />
851 </test> 850 </test>
852 <test> 851 <!-- 29) -->
853 <param name="input" value="test.bam" ftype="bam" /> 852 <test>
853 <param name="input" value="in_test_14.bam" ftype="bam" />
854 <conditional name="mode"> 854 <conditional name="mode">
855 <param name="outtype" value="selected_reads" /> 855 <param name="outtype" value="selected_reads" />
856 <section name="subsample_config"> 856 <section name="subsample_config">
857 <conditional name="subsampling_mode"> 857 <conditional name="subsampling_mode">
858 <param name="select_subsample" value="fraction" /> 858 <param name="select_subsample" value="fraction" />
865 <conditional name="output_format"> 865 <conditional name="output_format">
866 <param name="oformat" value="input" /> 866 <param name="oformat" value="input" />
867 </conditional> 867 </conditional>
868 </conditional> 868 </conditional>
869 </conditional> 869 </conditional>
870 <output name="outputsam" file="test_ds.bam" ftype="bam" /> 870 <output name="outputsam" file="test_29.bam" ftype="bam" lines_diff="2"/>
871 </test> 871 </test>
872 <!-- 30) testing tag filtering -->
873 <test>
874 <param name="input" value="in_test_30.bam" ftype="bam" />
875 <conditional name="mode">
876 <param name="outtype" value="selected_reads" />
877 <section name="filter_config">
878 <param name="tag" value="XS:-18" />
879 </section>
880 <conditional name="output_options">
881 <conditional name="output_format">
882 <param name="oformat" value="bam" />
883 </conditional>
884 </conditional>
885 </conditional>
886 <assert_command>
887 <has_text text="--tag 'XS:-18'"/>
888 </assert_command>
889 <output name="outputsam" file="test_30.bam" ftype="bam" lines_diff="2" />
890 </test>
891 <!-- 31) testing readname filtering -->
892 <test>
893 <param name="input" value="in_test_30.bam" ftype="bam" />
894 <conditional name="mode">
895 <param name="outtype" value="selected_reads" />
896 <section name="filter_config">
897 <param name="qname_file" value="readnames.txt" />
898 </section>
899 <conditional name="output_options">
900 <conditional name="output_format">
901 <param name="oformat" value="bam" />
902 </conditional>
903 </conditional>
904 </conditional>
905 <assert_command>
906 <has_text text="--qname-file"/>
907 </assert_command>
908 <output name="outputsam" file="test_31.bam" ftype="bam" lines_diff="2" />
909 </test>
872 </tests> 910 </tests>
873 <help> 911 <help>
874 **What it does** 912 **What it does**
875 913
876 Samtools view can: 914 Samtools view can:
877 915
878 1. convert between alignment formats (SAM, BAM, CRAM) 916 1. convert between alignment formats (SAM, BAM, CRAM)
879 2. filter and subsample alignments according to user-specified criteria 917 2. filter and subsample alignments according to user-specified criteria
880 3. count the reads in the input dataset or those retained after filtering 918 3. count the reads in the input dataset or those retained after filtering
881 and subsampling 919 and subsampling
882 4. obtain just the header of the input in any supported format 920 4. obtain just the header of the input in any supported format
883 921
884 In addition, the tool has (limited) options to modify read records during conversion and/or filtering by: 922 In addition, the tool has (limited) options to modify read records during conversion and/or filtering by:
885 923
886 - stripping them of user-specified tags 924 - stripping them of user-specified tags
887 - collapsing backward CIGAR operations if they are specified in their CIGAR 925 - collapsing backward CIGAR operations if they are specified in their CIGAR
888 fields 926 fields
892 930
893 **Alignment format conversion** 931 **Alignment format conversion**
894 932
895 By changing the *Output format* it is possible to convert an input dataset to 933 By changing the *Output format* it is possible to convert an input dataset to
896 another format. 934 another format.
897 Inputs of type SAM, BAM, and CRAM are accepted and can be converted to each of these formats (alternatively alignment counts can be computed) by selecting the appropriate "Output type". 935 Inputs of type SAM, BAM, and CRAM are accepted and can be converted to each of these formats (alternatively alignment counts can be computed) by selecting the appropriate "Output type".
898 936
899 .. class:: infomark 937 .. class:: infomark
900 938
901 The tool allows you to specify a reference sequence. This is required for SAM input with missing @SQ headers (which include sequence names, length, md5, etc) and useful (and sometimes necessary) for CRAM input and output. In the following the use of the reference sequence in the CRAM format is detailed. 939 The tool allows you to specify a reference sequence. This is required for SAM input with missing @SQ headers (which include sequence names, length, md5, etc) and useful (and sometimes necessary) for CRAM input and output. In the following the use of the reference sequence in the CRAM format is detailed.
902 CRAM is (primarily) a reference-based compressed format, i.e. only sequence differences between aligned reads and the reference are stored. As a consequence, the reference that was used during read mapping is needed in order to interpret the alignment records (a checksum stored in the CRAM file is used to verify that only the correct reference sequence can be used). This allows for more space-efficient storage than with BAM format, but such a CRAM file is not usable without its reference. 940 CRAM is (primarily) a reference-based compressed format, i.e. only sequence differences between aligned reads and the reference are stored. As a consequence, the reference that was used during read mapping is needed in order to interpret the alignment records (a checksum stored in the CRAM file is used to verify that only the correct reference sequence can be used). This allows for more space-efficient storage than with BAM format, but such a CRAM file is not usable without its reference.
903 It is also possible, however, to use CRAM without a reference with the disadvantage that the reference sequence gets stored then explicitely (as in SAM and BAM). 941 It is also possible, however, to use CRAM without a reference with the disadvantage that the reference sequence gets stored then explicitely (as in SAM and BAM).
904 942
948 ``.`` 986 ``.``
949 Output all alignments. (Mostly unnecessary as not specifying a region at all has the same effect.) 987 Output all alignments. (Mostly unnecessary as not specifying a region at all has the same effect.)
950 988
951 **Filtering by quality** 989 **Filtering by quality**
952 990
953 This filters based on the MAPQ column of the SAM format which gives an estimate about the correct placement of the alignment. Note that aligners do not follow a consistent definition. 991 This filters based on the MAPQ column of the SAM format which gives an estimate about the correct placement of the alignment. Note that aligners do not follow a consistent definition.
992
993 ## Filtering by Tag **
994
995 This filter allows to select reads based on tool or user specific tags, e.g., XS:i:-18 the alignment score tag of bowtie.
996 Thus to filter for a specific value of the tag you need the format STR1:STR2, e.g., XS:-18 to filter reads with an aligment score of -18.
997 You can also just write STR1 without the value STR2 hence the filter selects all reads with the tag STR1, e.g., XS.
998
954 </help> 999 </help>
955 <expand macro="citations"/> 1000 <expand macro="citations"/>
956 </tool> 1001 </tool>