<commit_before><tool profile="16.07" id="mothur_filter_seqs" name="Filter.seqs" version="@WRAPPER_VERSION@.0">
    <description>removes columns from alignments</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="version_command"/>
    <command detect_errors="aggressive"><![CDATA[
        ## create symlinks to input datasets
        ln -s "$fasta" fasta.dat &&
        #for $i in $inputs:
            ln -s "$i.fasta" fasta${inputs.index($i)}.dat &&
        #end for
        ln -s "$hard" hard.dat &&

        echo 'filter.seqs(
            fasta=fasta.dat#for $i in $inputs#-fasta${inputs.index($i)}.dat#end for#,
            vertical=$vertical,
            #if $trump:
                trump=$trump,
            #end if
            soft=$soft,
            #if $hard:
                hard=hard.dat,
            #end if
            processors='\${GALAXY_SLOTS:-8}'
        )'
        | sed 's/ //g'  ## mothur trips over whitespace
        | mothur &&

        ## rename collection files for more transparent element naming
        mv fasta.filter.fasta "${fasta.element_identifier}".filter.fasta
        #for i in $inputs:
            && mv fasta${inputs.index($i)}.filter.fasta "${i.fasta.element_identifier}".filter.fasta
        #end for
    ]]></command>
    <inputs>
        <param name="fasta" type="data" format="mothur.align" label="fasta - Alignment Fasta"/>
        <repeat name="inputs" title="Additional Alignment File">
            <param name="fasta" type="data" format="mothur.align" label="fasta - Alignment Fasta"/>
        </repeat>
        <param name="vertical" type="boolean" checked="true" truevalue="true" falsevalue="false" label="vertical - Vertical column" help="Ignore any column that only contains gap characters (i.e. '-' or '.')"/>
        <param name="trump" type="select" label="trump - Trump character" help="Remove a column if the trump character is found at that position in any sequence of the alignment">
            <option value="">Off</option>
            <option value=".">.</option>
            <option value="-">-</option>
            <option value="N">N</option>
        </param>
        <param name="soft" type="integer" value="0" min="0" max="100" label="soft - percentage required to retain column. (0-100)" help="Removes any column where the dominant base (i.e. A, T, G, C, or U) does not occur in at least a designated percentage of sequences"/>
        <param name="hard" type="data" format="mothur.filter" optional="True" label="hard - Hard Column Filter" help="A file should only contain one line consisting of 0's and 1's"/>
    </inputs>
    <outputs>
        <expand macro="logfile-output"/>
        <data name="out_filter" format="mothur.filter" from_work_dir="fasta*.filter" label="${tool.name} on ${on_string}: filter"/>
        <collection name="filteredfastas" type="list" label="${tool.name} on ${on_string}: filtered fastas">
            <discover_datasets pattern="(?P&lt;designation&gt;.*)\.filter\.fasta" format="fasta"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="fasta" value="HMP_MOCK.v35.align" ftype="mothur.align"/>
            <repeat name="inputs">
                <param name="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" ftype="mothur.align"/>
            </repeat>
            <output name="out_filter" md5="3e6c2cfef46baf35d2a8b5cafe53e3a4"/>
            <output_collection name="filteredfastas" count="2">
                <element name="HMP_MOCK.v35.align" md5="ef4c6c2d9a882f7a22e5fa3c814af7cc" ftype="fasta"/>
            </output_collection>
            <expand macro="logfile-test"/>
        </test>
    </tests>
    <help>
<![CDATA[

@MOTHUR_OVERVIEW@

**Command Documenation**

The filter.seqs_ command removes columns from alignments based on a criteria defined by the user. For example, alignments generated against reference alignments (e.g. from RDP, SILVA, or greengenes) often have columns where every character is either a '.' or a '-'. These columns are not included in calculating distances because they have no information in them. By removing these columns, the calculation of a large number of distances is accelerated. Also, people also like to mask their sequences to remove variable regions using a soft or hard mask (e.g. Lane's mask). This type of masking is only encouraged for deep-level phylogenetic analysis, not fine level analysis such as that needed with calculating OTUs.
<commit_msg>filter.seqs: only output collection if multiple outputs were created<commit_after><tool profile="16.07" id="mothur_filter_seqs" name="Filter.seqs" version="@WRAPPER_VERSION@.0">
    <description>removes columns from alignments</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="version_command"/>
    <command detect_errors="aggressive"><![CDATA[
        ## create symlinks to input datasets
        ln -s "$fasta" fasta.dat &&
        #for $i in $inputs:
            ln -s "$i.fasta" fasta${inputs.index($i)}.dat &&
        #end for
        ln -s "$hard" hard.dat &&

        echo 'filter.seqs(
            fasta=fasta.dat#for $i in $inputs#-fasta${inputs.index($i)}.dat#end for#,
            vertical=$vertical,
            #if $trump:
                trump=$trump,
            #end if
            soft=$soft,
            #if $hard:
                hard=hard.dat,
            #end if
            processors='\${GALAXY_SLOTS:-8}'
        )'
        | sed 's/ //g'  ## mothur trips over whitespace
        | mothur &&

        ## rename collection files for more transparent element naming
        mv fasta.filter.fasta "${fasta.element_identifier}".filter.fasta
        #for i in $inputs:
            && mv fasta${inputs.index($i)}.filter.fasta "${i.fasta.element_identifier}".filter.fasta
        #end for
    ]]></command>
    <inputs>
        <param name="fasta" type="data" format="mothur.align" label="fasta - Alignment Fasta"/>
        <repeat name="inputs" title="Additional Alignment File">
            <param name="fasta" type="data" format="mothur.align" label="fasta - Alignment Fasta"/>
        </repeat>
        <param name="vertical" type="boolean" checked="true" truevalue="true" falsevalue="false" label="vertical - Vertical column" help="Ignore any column that only contains gap characters (i.e. '-' or '.')"/>
        <param name="trump" type="select" label="trump - Trump character" help="Remove a column if the trump character is found at that position in any sequence of the alignment">
            <option value="">Off</option>
            <option value=".">.</option>
            <option value="-">-</option>
            <option value="N">N</option>
        </param>
        <param name="soft" type="integer" value="0" min="0" max="100" label="soft - percentage required to retain column. (0-100)" help="Removes any column where the dominant base (i.e. A, T, G, C, or U) does not occur in at least a designated percentage of sequences"/>
        <param name="hard" type="data" format="mothur.filter" optional="True" label="hard - Hard Column Filter" help="A file should only contain one line consisting of 0's and 1's"/>
    </inputs>
    <outputs>
        <expand macro="logfile-output"/>
        <data name="out_filter" format="mothur.filter" from_work_dir="fasta*.filter" label="${tool.name} on ${on_string}: filter"/>
        <collection name="filteredfastas" type="list" label="${tool.name} on ${on_string}: filtered fastas">
            <discover_datasets pattern="(?P&lt;designation&gt;.*)\.filter\.fasta" format="fasta"/>
            <filter>inputs</filter> <!-- only output collection if multiple outputs-->
        </collection>
        <data name="filteredfasta" format="fasta" from_work_dir="*.filter.fasta" label="${tool.name} on ${on_string}: filtered fasta">
            <filter>not inputs</filter>
        </data>
    </outputs>
    <tests>
        <test><!-- test with multiple inputs and collection output -->
            <param name="fasta" value="HMP_MOCK.v35.align" ftype="mothur.align"/>
            <repeat name="inputs">
                <param name="fasta" value="Mock_S280_L001_R1_001_small.trim.contigs.good.align_head" ftype="mothur.align"/>
            </repeat>
            <output name="out_filter" md5="3e6c2cfef46baf35d2a8b5cafe53e3a4"/>
            <output_collection name="filteredfastas" count="2">
                <element name="HMP_MOCK.v35.align" md5="ef4c6c2d9a882f7a22e5fa3c814af7cc" ftype="fasta"/>
            </output_collection>
            <expand macro="logfile-test"/>
        </test>
        <test><!-- test with single input and non-collection output -->
            <param name="fasta" value="HMP_MOCK.v35.align" ftype="mothur.align"/>
            <output name="out_filter" md5="3e6c2cfef46baf35d2a8b5cafe53e3a4"/>
            <output name="filteredfasta" md5="ef4c6c2d9a882f7a22e5fa3c814af7cc"/>
            <expand macro="logfile-test"/>
        </test>
    </tests>
    <help>
<![CDATA[

@MOTHUR_OVERVIEW@

**Command Documenation**

The filter.seqs_ command removes columns from alignments based on a criteria defined by the user. For example, alignments generated against reference alignments (e.g. from RDP, SILVA, or greengenes) often have columns where every character is either a '.' or a '-'. These columns are not included in calculating distances because they have no information in them. By removing these columns, the calculation of a large number of distances is accelerated. Also, people also like to mask their sequences to remove variable regions using a soft or hard mask (e.g. Lane's mask). This type of masking is only encouraged for deep-level phylogenetic analysis, not fine level analysis such as that needed with calculating OTUs.

{'fraction_non_alphanumeric': 0.13566717402333842, 'fraction_numerical': 0.01643835616438356, 'mean_word_length': 2.9204455051710423, 'pattern_counts': {'":': 0, '<': 124, '<?xml version=': 0, '>': 122, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1527573', 'n_tokens_mistral': 3030, 'n_tokens_neox': 2883, 'n_words': 837}