view tools/fastq/fastq_groomer.xml @ 2:c2a356708570

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:45:42 -0500
parents 9071e359b9a3
children
line wrap: on
line source

<tool id="fastq_groomer" name="FASTQ Groomer" version="1.0.4">
  <description>convert between various FASTQ quality formats</description>
  <command interpreter="python">fastq_groomer.py '$input_file' '$input_type' '$output_file'
#if str( $options_type['options_type_selector'] ) == 'basic':
#if str( $input_type ) == 'cssanger':
'cssanger'
#else:
'sanger'
#end if
'ascii' 'summarize_input'
#else:
'${options_type.output_type}' '${options_type.force_quality_encoding}' '${options_type.summarize_input}'
#end if
</command>
  <inputs>
    <param name="input_file" type="data" format="fastq" label="File to groom" />
    <param name="input_type" type="select" label="Input FASTQ quality scores type">
      <option value="solexa">Solexa</option>
      <option value="illumina">Illumina 1.3+</option>
      <option value="sanger" selected="True">Sanger</option>
      <option value="cssanger">Color Space Sanger</option>
    </param>
    <conditional name="options_type">
    <param name="options_type_selector" type="select" label="Advanced Options">
      <option value="basic" selected="True">Hide Advanced Options</option>
      <option value="advanced">Show Advanced Options</option>
    </param>
    <when value="basic">
      <!-- no options -->
    </when>
    <when value="advanced">
      <param name="output_type" type="select" label="Output FASTQ quality scores type" help="Galaxy tools are designed to work with the Sanger Quality score format.">
        <option value="solexa">Solexa</option>
        <option value="illumina">Illumina 1.3+</option>
        <option value="sanger" selected="True">Sanger (recommended)</option>
        <option value="cssanger">Color Space Sanger</option>
      </param>
      <param name="force_quality_encoding" type="select" label="Force Quality Score encoding">
        <option value="None">Use Source Encoding</option>
        <option value="ascii" selected="True">ASCII</option>
        <option value="decimal">Decimal</option>
      </param>
      <param name="summarize_input" type="select" label="Summarize input data">
        <option value="summarize_input" selected="True">Summarize Input</option>
        <option value="dont_summarize_input">Do not Summarize Input (faster)</option>
      </param>
    </when>
  </conditional>
  </inputs>
  <outputs>
    <data name="output_file" format="fastqsanger">
      <change_format>
        <when input="input_type" value="cssanger" format="fastqcssanger" />
        <when input="options_type.output_type" value="solexa" format="fastqsolexa" />
        <when input="options_type.output_type" value="illumina" format="fastqillumina" />
        <when input="options_type.output_type" value="sanger" format="fastqsanger" />
        <when input="options_type.output_type" value="cssanger" format="fastqcssanger" />
      </change_format>
    </data>
  </outputs>
  <tests>
    <!-- These tests include test files adapted from supplemental material in Cock PJ, Fields CJ, Goto N, Heuer ML, Rice PM. The Sanger FASTQ file format for sequences with quality scores, and the Solexa/Illumina FASTQ variants. Nucleic Acids Res. 2009 Dec 16. -->
    <!-- Unfortunately, cannot test for expected failures -->
    <!-- Test basic options -->
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="basic" />
      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="basic" />
      <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
    </test>
    <test>
      <param name="input_file" value="illumina_full_range_original_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="illumina" />
      <param name="options_type_selector" value="basic" />
      <output name="output_file" file="illumina_full_range_as_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="basic" />
      <output name="output_file" file="solexa_full_range_as_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="basic" />
      <output name="output_file" file="sanger_full_range_as_illumina.fastqillumina" />
    </test>
    <!-- Test grooming from illumina -->
    <test>
      <param name="input_file" value="illumina_full_range_original_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="illumina" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="illumina" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="illumina_full_range_original_illumina.fastqillumina" />
    </test>
    <test>
      <param name="input_file" value="illumina_full_range_original_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="illumina" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="illumina_full_range_as_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="illumina_full_range_original_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="illumina" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="illumina_full_range_as_solexa.fastqsolexa" />
    </test>
    <test>
      <param name="input_file" value="illumina_full_range_original_illumina.fastqillumina" ftype="fastq" />
      <param name="input_type" value="illumina" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="cssanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="illumina_full_range_as_cssanger.fastqcssanger" />
    </test>
    <!-- Test grooming from sanger -->
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="illumina" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_illumina.fastqillumina" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_solexa.fastqsolexa" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="cssanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
    </test>
    <!-- Test grooming from solexa -->
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_original_solexa.fastqsolexa" />
    </test>
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="illumina" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_as_illumina.fastqillumina" />
    </test>
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_as_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="cssanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_as_cssanger.fastqcssanger" />
    </test>
    <!-- Test grooming from cssanger -->
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="cssanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="illumina" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_illumina.fastqillumina" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger.fastqcssanger" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_solexa.fastqsolexa" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_cssanger_adapter_base_with_quality_score.fastqcssanger_fake_score" ftype="fastq" />
      <param name="input_type" value="cssanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="cssanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_cssanger.fastqcssanger" />
    </test>
    <!-- Test fastq with line wrapping -->
    <test>
      <param name="input_file" value="wrapping_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="wrapping_as_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="wrapping_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="illumina" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="wrapping_as_illumina.fastqillumina" />
    </test>
    <test>
      <param name="input_file" value="wrapping_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="None" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="wrapping_as_solexa.fastqsolexa" />
    </test>
    <!-- Test forcing quality score encoding -->
    <!-- Sanger, range 0 - 93 -->
    <test>
      <param name="input_file" value="sanger_full_range_as_decimal_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="ascii" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_original_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="decimal" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_as_decimal_sanger.fastqsanger" />
    </test>
    <test>
      <param name="input_file" value="sanger_full_range_as_tab_decimal_sanger.fastqsanger" ftype="fastq" />
      <param name="input_type" value="sanger" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="sanger" />
      <param name="force_quality_encoding" value="ascii" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="sanger_full_range_original_sanger.fastqsanger" />
    </test>
    <!-- Solexa, range -5 - 62 -->
    <test>
      <param name="input_file" value="solexa_full_range_as_decimal_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="ascii" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_original_solexa.fastqsolexa" />
    </test>
    <test>
      <param name="input_file" value="solexa_full_range_original_solexa.fastqsolexa" ftype="fastq" />
      <param name="input_type" value="solexa" />
      <param name="options_type_selector" value="advanced" />
      <param name="output_type" value="solexa" />
      <param name="force_quality_encoding" value="decimal" />
      <param name="summarize_input" value="summarize_input" />
      <output name="output_file" file="solexa_full_range_as_decimal_solexa.fastqsolexa" />
    </test>
  </tests>
  <help>
**What it does**

This tool offers several conversions options relating to the FASTQ format.

When using *Basic* options, the output will be *sanger* formatted or *cssanger* formatted (when the input is Color Space Sanger).

When converting, if a quality score falls outside of the target score range, it will be coerced to the closest available value (i.e. the minimum or maximum). 

When converting between Solexa and the other formats, quality scores are mapped between Solexa and PHRED scales using the equations found in `Cock PJ, Fields CJ, Goto N, Heuer ML, Rice PM. The Sanger FASTQ file format for sequences with quality scores, and the Solexa/Illumina FASTQ variants. Nucleic Acids Res. 2009 Dec 16.`_

When converting between color space (csSanger) and base/sequence space (Sanger, Illumina, Solexa) formats, adapter bases are lost or gained; if gained, the base 'G' is used as the adapter. You cannot convert a color space read to base space if there is no adapter present in the color space sequence. Any masked or ambiguous nucleotides in base space will be converted to 'N's when determining color space encoding.

-----

**Quality Score Comparison**

::

    SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
    ...............................IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
    ..........................XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    |                         |    |        |                              |                     |
   33                        59   64       73                            104                   126
  
   S - Sanger       Phred+33,  93 values  (0, 93) (0 to 60 expected in raw reads)
   I - Illumina 1.3 Phred+64,  62 values  (0, 62) (0 to 40 expected in raw reads)
   X - Solexa       Solexa+64, 67 values (-5, 62) (-5 to 40 expected in raw reads)

Diagram adapted from http://en.wikipedia.org/wiki/FASTQ_format

------

**Citation**

If you use this tool, please cite `Blankenberg D, Gordon A, Von Kuster G, Coraor N, Taylor J, Nekrutenko A; Galaxy Team. Manipulation of FASTQ data with Galaxy. Bioinformatics. 2010 Jul 15;26(14):1783-5. &lt;http://www.ncbi.nlm.nih.gov/pubmed/20562416&gt;`_


.. _Cock PJ, Fields CJ, Goto N, Heuer ML, Rice PM. The Sanger FASTQ file format for sequences with quality scores, and the Solexa/Illumina FASTQ variants. Nucleic Acids Res. 2009 Dec 16.: http://www.ncbi.nlm.nih.gov/pubmed/20015970

  </help>
</tool>