view bcftools_query.xml @ 16:3ce32adc55b2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bcftools commit db275932cbb485cb44ae91e0b421d6f57698db49
author iuc
date Tue, 20 Sep 2022 13:12:13 +0000
parents 94c5f302f0ea
children 31a1b89eab9b
line wrap: on
line source

<?xml version='1.0' encoding='utf-8'?>
<tool name="bcftools @EXECUTABLE@" id="bcftools_@EXECUTABLE@" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>Extracts fields from VCF/BCF file and prints them in user-defined format</description>
    <macros>
        <token name="@EXECUTABLE@">query</token>
        <import>macros.xml</import>
    </macros>
    <expand macro="bio_tools" />
    <expand macro="requirements" />
    <expand macro="version_command" />
    <command detect_errors="aggressive"><![CDATA[
@PREPARE_ENV@
@PREPARE_INPUT_FILES@
#set $section = $sec_restrict
@PREPARE_TARGETS_FILE@
@PREPARE_REGIONS_FILE@

bcftools @EXECUTABLE@

## Query section
#set $section = $sec_query
  --format '${section.format}'

${section.allow_undef_tags}

${section.print_header}

## Default section
#set $section = $sec_restrict
@INCLUDE@
@EXCLUDE@
@COLLAPSE@
@REGIONS@
@SAMPLES@
@TARGETS@

## Primary Input/Outputs
--vcf-list @INPUT_LIST_FILE@
> $output_file
]]>
    </command>
    <inputs>
        <expand macro="macro_inputs" />
        <section name="sec_restrict" expanded="false" title="Restrict to">
            <expand macro="macro_collapse" />
            <expand macro="macro_samples" />
            <expand macro="macro_restrict" />
            <expand macro="macro_restrict" type="target" label_type="Target" />
            <expand macro="macro_include" />
            <expand macro="macro_exclude" />
        </section>
        <section name="sec_query" expanded="true" title="Query Options">
            <param name="format" type="text" value="" label="Format for Output">
                <help>
                <![CDATA[ 
                Example: %CHROM\t%POS\t%REF\t%ALT{0}\n
                ( NOTE TAB: '\t' and new line character: '\n' )
                ]]>
                </help>
                <sanitizer sanitize="False"/>
                <validator type="empty_field" />
            </param>
            <param name="tsv" type="boolean" truevalue="True" falsevalue="False" checked="false" label="Output is tab-delimited"
                   help="Fields in your Format are separated by a TAB character: \t"/>
            <param name="allow_undef_tags" type="boolean" truevalue="--allow-undef-tags" falsevalue="" label="Allow Undefined Tags" 
                   help="Print &quot;.&quot; for undefined tags" />
            <param name="print_header" type="boolean" truevalue="--print-header" falsevalue="" label="Print Header Line" />
        </section>

    </inputs>
    <outputs>
        <data name="output_file" format="txt">
            <change_format>
                <when input="tsv" value="True" format="tabular" />
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input_files" ftype="vcf" value="query.vcf" />
            <param name="format" value="%CHROM\t%POS\t%REF\t%ALT\t%DP4\t%AN[\t%GT\t%TGT]\n" />
            <param name="tsv" value="True" />
            <output name="output_file" file="query.out" />
        </test>
        <!-- Test region overlap option-->
        <test>
            <param name="input_files" ftype="vcf" value="query.vcf" />
            <param name="format" value="%CHROM\t%POS\t%REF\t%ALT\t%DP4\t%AN[\t%GT\t%TGT]\n" />
            <param name="tsv" value="True" />
            <section name="sec_restrict">
                <param name="regions_overlap" value="1"/>
            </section>
            <output name="output_file" file="query.out" />
            <assert_command>
                <has_text text="--regions-overlap" />
            </assert_command>
        </test>
    </tests>
    <help><![CDATA[ 
=====================================
 bcftools @EXECUTABLE@
=====================================

Extracts fields from VCF/BCF file and prints them in user-defined format

  Format:

  ::

    ``%CHROM``          The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
    ``%INFO/TAG``       Any tag in the INFO column
    ``%TYPE``           Variant type (REF, SNP, MNP, INDEL, OTHER)
    ``%MASK``           Indicates presence of the site in other files (with multiple files)
    ``%TAG{INT}``       Curly brackets to subscript vectors (0-based)
    ``%FIRST_ALT``      Alias for %ALT{0}
    ``[]``              The brackets loop over all samples
    ``%GT``             Genotype (e.g. 0/1)
    ``%TBCSQ``          Translated FORMAT/BCSQ. See the csq command above for explanation and examples.
    ``%TGT``            Translated genotype (e.g. C/A)
    ``%IUPACGT``        Genotype translated to IUPAC ambiguity codes (e.g. M instead of C/A)
    ``%LINE``           Prints the whole line
    ``%SAMPLE``         Sample name
    ``%POS0``           POS in 0-based coordinates
    ``%END``            End position of the REF allele
    ``%END0``           End position of the REF allele in 0-based cordinates
    ``\n``              new line
    ``\t``              tab character


  Examples:

  ::

    # Print chromosome, position, ref allele and the first alternate allele
    bcftools query -f '%CHROM  %POS  %REF  %ALT{0}\n' file.vcf.gz

    # Similar to above, but use tabs instead of spaces, add sample name and genotype
    bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz

    # Print FORMAT/GT fields followed by FORMAT/GT fields
    bcftools query -f 'GQ:[ %GQ] \t GT:[ %GT]\n' file.vcf

    # Make a BED file: chr, pos (0-based), end pos (1-based), id
    bcftools query -f'%CHROM\t%POS0\t%END\t%ID\n' file.bcf


@COLLAPSE_HELP@
@REGIONS_HELP@
@TARGETS_HELP@
@EXPRESSIONS_HELP@

@BCFTOOLS_MANPAGE@#@EXECUTABLE@

@BCFTOOLS_WIKI@
]]>
    </help>
    <expand macro="citations" />
</tool>