view ConvertFastaHeaders.xml @ 0:163892325845 draft default tip

Initial commit.
author galaxyp
date Fri, 10 May 2013 17:15:08 -0400
parents
children
line wrap: on
line source

<!-- 
# =====================================================
# $Id: ConvertFastaHeaders.xml 90 2011-01-19 13:20:31Z pieter.neerincx@gmail.com $
# $URL: https://trac.nbic.nl/svn/galaxytools/trunk/tools/general/FastaTools/ConvertFastaHeaders.xml $
# $LastChangedDate: 2011-01-19 07:20:31 -0600 (Wed, 19 Jan 2011) $ 
# $LastChangedRevision: 90 $
# $LastChangedBy: pieter.neerincx@gmail.com $
# =====================================================
-->
<tool id="ConvertFastaHeaders1" name="ConvertFastaHeaders" version="2.0">
  <description>Converts sequence headers of FASTA files</description>
  <command interpreter="perl">
    #if   $mode.action == "add"     #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -l ERROR
    #elif $mode.action == "strip"   #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -l ERROR
    #elif $mode.action == "replace" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -n $mode.pos.newfix -l ERROR
    #elif $mode.action == "delete"  #ConvertFastaHeaders.pl -i $input -o $output -p $mode.position -a $mode.action -l ERROR
    #elif $mode.action == "shuffle" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.position -a $mode.action -l ERROR
    #end if
  </command>
  <inputs>
    <param format="fasta" name="input" type="data" label="FASTA sequences"/>
    <conditional name ="mode">
      <param name="action" type="select">
        <label>Action to perform on sequence identifiers</label>
        <option value="add">Add Labels</option>
        <option value="strip">Remove Labels</option>
        <option value="replace">Replace Labels</option>
        <option value="delete">Delete</option>
        <option value="shuffle">Shuffle order</option>
      </param>
      <when value="add">
        <conditional name="pos">
          <param name="position" type="select" accept_default="true">
            <label> Label position </label>
            <option value="prefix">Prepend Prefixes</option>
            <option value="suffix">Append Suffixes</option>
          </param>
          <when value="prefix">
            <param name="xfixes" type="text" label="Space separated list of prefixes, which will be added"/>
          </when>
          <when value="suffix">
            <param name="xfixes" type="text" label="Space separated list of suffixes, which will be added"/>
          </when>
        </conditional>
      </when>
      <when value="strip">
        <conditional name="pos">
          <param name="position" type="select" accept_default="true">
            <label> Label position </label>
            <option value="prefix">Strip Prefixes</option>
            <option value="suffix">Strip Suffixes</option>
          </param>
          <when value="prefix">
            <param name="xfixes" type="text" label="Space separated list of prefixes, which will be removed"/>
          </when>
          <when value="suffix">
            <param name="xfixes" type="text" label="Space separated list of suffixes, which will be removed"/>
          </when>
        </conditional>
      </when>
      <when value="replace">
        <conditional name="pos">
          <param name="position" type="select" accept_default="true">
            <label> Label position </label>
          <option value="prefix">Replace prefixes with another prefix</option>
          <option value="suffix">Replace suffixes with another suffix</option>
          <option value="pre2suf">Replace prefixes with a suffix</option>
          <option value="suf2pre">Replace suffixes with a prefix</option>
          </param>
          <when value="prefix">
            <param name="xfixes" type="text" label="Space separated list of prefixes, which will be replaced"/>
            <param name="newfix" type="text" label="New prefix to replace the current prefixes"/>
          </when>
          <when value="suffix">
            <param name="xfixes" type="text" label="Space separated list of suffixes, which will be replaced"/>
            <param name="newfix" type="text" label="New suffix to replace the current suffixes"/>
          </when>
          <when value="pre2suf">
            <param name="xfixes" type="text" label="Space separated list of prefixes, which will be replaced"/>
            <param name="newfix" type="text" label="New suffix to replace the current prefixes"/>
          </when>
          <when value="suf2pre">
            <param name="xfixes" type="text" label="Space separated list of suffixes, which will be replaced"/>
            <param name="newfix" type="text" label="New prefix to replace the current suffixes"/>
          </when>
        </conditional>
      </when>
      <when value="delete">
          <param name="position" type="text" size="10" value="" label="Ranks of IDs to delete" 
                 help="Comma separated list of numbers. For example 1,3 will delete the first and third ID from the FASTA headers."/>
      </when>
      <when value="shuffle">
          <param name="position" type="text" size="10" value="" label="New order for the IDs" 
                 help="Comma separated list of numbers. For example 1,3,2 will shuffle the order from 1,2,3 to 1,3,2."/>
      </when>
    </conditional> 
  </inputs>
  <outputs>
    <data format="fasta" name="output" label="${input.name} with converted FASTA headers"/>
  </outputs>
<!--
  <tests>
    <test> -a add -f "UniProt-Acc: UniProt-ID:"
      <param name="input"       value="ConvertFastaHeaders_example_input_Add.fasta"/>
      <output name="output"     file="ConvertFastaHeaders_example_output_Add.fasta"/>
    </test>
    <test> -a strip -p prefix -f 'SP:'
      <param name="input"       value="ExtractPeptideSequenceContext_example_DB.fasta"/>
      <output name="output"     file="ConvertFastaHeaders_example_output_Strip.fasta"/>
    </test>
    <test> -a replace -p pre2suf -f 'SP:' -n '_CON'
      <param name="input"       value="ExtractPeptideSequenceContext_example_DB.fasta"/>
      <output name="output"     file="ConvertFastaHeaders_example_output_Replace.fasta"/>
    </test>
    <test> -a delete -p '1 3'
      <param name="input"       value="ExtractPeptideSequenceContext_example_DB.fasta"/>
      <output name="output"     file="ConvertFastaHeaders_example_output_Delete.fasta"/>
    </test>
    <test> -a shuffle -p '2 3 1'
      <param name="input"       value="ExtractPeptideSequenceContext_example_DB.fasta"/>
      <output name="output"     file="ConvertFastaHeaders_example_output_Shuffle.fasta"/>
    </test>
  </tests>
-->
  <help>

.. class:: infomark

**What it does**

This tool converts the sequence headers (the description line starting with &gt;) for a set of FASTA sequences. \
Currently supported conversions:

 - Append prefixes like for example database namespace to identifiers / accession numbers.
 - Append suffixes to identifiers / accession numbers.
 - Remove prefixes like for example database namespace from identifiers / accession numbers.
 - Remove suffixes from identifiers / accession numbers.
 - Replace prefixes with a suffix or vice versa.

-----

**Examples**

========================================================
*Appending database namespace prefixes*
========================================================

Supply a space separated list of prefixes to add to pipe separated identifiers. \
The prefixes must contain both the database namespace you want to add and the character used to separate the namespace from the identifier. \
The order of the namespaces is important in this case! \
For example with action *Add Labels*, label position *Prepend Prefixes* and prefixes *UniProtAcc: UniProtID:*, this header::

    >P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

will be converted into::

    >UniProtAcc:P32234|UniProtID:128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

========================================================
*Removing database namespace prefixes*
========================================================

Supply a space separated list of namespaces to remove from pipe separated identifiers. \
The prefixes must contain both the database namespace you want to remove and the character used to separate the namespace from the identifier. \
The order of the namespaces is not relevant in this case. \
For example with action *Remove Labels*, label position *Strip Prefixes* and \
with prefixes *UniProtAcc: UniProtID:* or with prefixes *UniProtID: UniProtAcc:*, this header::

    >UniProtAcc:P32234|UniProtID:128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

will be converted into::

    >P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

========================================================
*Replacing a prefix with a suffix*
========================================================

Supply the prefix to remove from pipe separated identifiers and a new suffix. \
The order of the prefixes is not relevant in this case. \
Optionally you can specify more than one prefix to remove by separating them with spaces. \ 
You can specify only one new suffix though, so in case you specified more than one prefix they will all be replaced with the same new suffix. \
In the following example we'll replace a *REV_* prefix to indicate a reversed sequence with a *_REV* suffix. \
With action *Replace Labels*, label position *Replace prefixes with a suffix*, prefix *REV_* and new suffix *_REV*, this header::

    >REV_P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

will be converted into::

    >P32234_REV|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

========================================================
*Other \*fix replacements*
========================================================

You can also replace a prefix with a new prefix, a suffix with a new suffix or a suffix with a new prefix. \
These replacements are all similar to the example above. \
Hence you can specify multiple \*-fixes to be replaced and only one new \*-fix to replace the existing ones. 

========================================================
*Deleting sequence identifiers*
========================================================

Supply a comma separated list of numbers for the ranks of the identifiers / accession numbers you want to remove. \
Multiple identifiers must be separated with a pipe symbol. \
For example with action *Delete*, and Ranks of IDs to delete set to *1,3*, this header::

    >UniProtID:128UP_DROME|UniProtAcc:P32234|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

will be converted into::

    >UniProtAcc:P32234 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

========================================================
*Changing the order of sequence identifiers*
========================================================

Supply a comma separated list of numbers for the new order of all the identifiers / accession numbers in a header. \
Multiple identifiers must be separated with a pipe symbol. \
Hence if your headers contain 4 pipe separated IDs and you only want to swap the order of the first and the second, \
you will still need to specify the new (unchanged) order for number 3 and 4 too. 
 
For example with action *Shuffle*, and New order for the IDs set to *2,1,3*, this header::

    >UniProtID:128UP_DROME|UniProtAcc:P32234|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

will be converted into::

    >UniProtAcc:P32234|UniProtID:128UP_DROME|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)

Specifying only *2,1* as the New order for the IDs will not work, because this header contains 3 IDs, \
so you'll have to include the (new) position for the third one as well.

========================================================
*Need another type of conversion?*
========================================================

Contact your local bioinformaticians to add other conversions...

  </help>
</tool>