view gffread.xml @ 0:d0d6fc2004be draft default tip

Uploaded
author jjohnson
date Mon, 05 Jan 2015 12:53:44 -0500
parents
children
line wrap: on
line source

<tool id="gffread" name="gffread" version="@VERSION@.0">
    <description>Filters and/or converts GFF3/GTF2 records</description>
    <expand macro="requirements" />
    <expand macro="stdio" />
    <macros>
        <import>cuff_macros.xml</import>
        <xml name="fasta_output_select">
            <param name="fa_outputs" type="select" display="checkboxes" multiple="true" label="Select fasta outputs">
                <option value="-w exons.fa">(-w) a fasta file with spliced exons for each GFF transcript</option>
                <option value="-x cds.fa">(-x) a fasta file with spliced CDS for each GFF transcript</option>
                <option value="-y pep.fa">(-y)  a protein fasta file with the translation of CDS for each record</option>
                <option value="-W">(-W) for each fasta record the exon coordinates projected onto the spliced sequence</option>
            </param>
        </xml>
        <xml name="ref_filtering_select">
            <param name="ref_filtering" type="select" display="checkboxes" multiple="true" label="reference based filters">
                <option value="-N">(-N) discard multi-exon mRNAs that have any intron with a non-canonical splice site consensus (i.e. not GT-AG, GC-AG or AT-AC)</option>
                <option value="-J">(-J) discard any mRNAs that either lack initial START codon or the terminal STOP codon, or have an in-frame stop codon (only print mRNAs with a fulll, valid CDS)</option>
                <option value="-V">(-V) discard any mRNAs with CDS having in-frame stop codons</option>
                <option value="-H">(-H with -V) check and adjust the starting CDS phase if the original phase leads to a translation with an in-frame stop codon</option>
                <option value="-B">(-B with -V) single-exon transcripts are also checked on the opposite strand</option>
            </param>
        </xml>
        <xml name="trackname">
            <param name="tname" type="text" value="" size="30" optional="true" label="(-t) Trackname to use in the second column of each GFF output line">
                <validator type="regex">\w+</validator>
            </param>
        </xml>
        <xml name="merge_opts">
             <option value="-K">(-K) also collapse shorter, fully contained transcripts with fewer introns than the container</option>
             <option value="-Q">(-Q) remove the containment restriction (multi-exon transcripts will be collapsed if just their introns match, while single-exon transcripts can partially overlap 80%)</option>
             <option value="-d dupinfo">(-d) output collapsing info</option>
        </xml>
        <xml name="cluster_opts">
             <option value="--force-exons">(--force-exons) make sure that the lowest level GFF features are printed as 'exon' features</option>
             <option value="-Z">(-Z) merge close exons into a single exon (for intron size &lt; 4)</option>
        </xml>
        <xml name="merge_opt_sel">
            <param name="merge_options" type="select" display="checkboxes" multiple="true" label="Merge options">
                <expand macro="cluster_opts" />
                <expand macro="merge_opts" />
            </param>
        </xml>
        <xml name="cluster_opt_sel">
            <param name="merge_options" type="select" display="checkboxes" multiple="true" label="Cluster options">
                <expand macro="cluster_opts" />
            </param>
        </xml>
    </macros>
    <command>
<![CDATA[
    #if $reference_genome.source == 'history':
        ln -s $reference_genome.genome_fasta genomeref.fa &&
    #end if
    gffread $input 
    #if $reference_genome.source == 'cached':
        -g "${reference_genome.fasta_indexes.fields.path}"
        #if $reference_genome.ref_filtering and str($reference_genome.ref_filtering) != '':
            #echo ' '.join(str($reference_genome.ref_filtering).split(','))
        #end if
    #elif $reference_genome.source == 'history':
        -g genomeref.fa
        #if $reference_genome.ref_filtering and str($reference_genome.ref_filtering) != '':
            #echo ' '.join(str($reference_genome.ref_filtering).split(','))
        #end if
    #end if
    #if $filtering and str($filtering) != '':
        #echo " "
        #echo ' '.join(str($filtering).split(','))
    #end if
    #if $maxintron and $maxintron > 0:
        -i $maxintron
    #end if
    #if $region.region_filter == 'filter':
        -r $region.range $region.discard_partial
    #end if
    #if $merging.merge_sel != 'none':
        $merging.merge_cmd
        #echo ' '.join(str($merging.merge_options).split(','))
    #end if
    #if $chr_replace:
        -m "$chr_replace"
    #end if
    ##
    ## Although documented, does not appear to be used in the gffread code
    ## #if $seq_info:
    ##     -A -s "$seq_info"
    ## #end if
    ##
    ## outputs
    #if $reference_genome.source != 'none':
        #if $reference_genome.fa_outputs and str($reference_genome.fa_outputs) != '':
            #echo ' ' + ' '.join(str($reference_genome.fa_outputs).split(','))
        #end if
    #end if
    #if $gffs.gff_fmt != 'none':
        #if $gffs.tname:
            -t "$gffs.tname"
        #end if
        #if $gffs.gff_fmt == 'gff':
            #if $input.datatype.file_ext == 'gft':
                $gffs.ensembl
            #end if
            $gffs.output_cmd
        #elif $gffs.gff_fmt == 'gtf':
            $gffs.output_cmd
        #end if
    #end if
]]>
    </command>
    <inputs>
        <param name="input" type="data" format="gff3,gtf" label="Input GFF3 or GTF feature file"/>
        <!-- filtering -->
        <param name="filtering" type="select" display="checkboxes" multiple="true" label="filters">
            <option value="-U">(-U) discard single-exon transcripts</option>
            <option value="-C">(-C) coding only: discard mRNAs that have no CDS feature</option>
            <option value="-G">(-G) only parse additional exon attributes from the first exon and move them to the mRNA level (useful for GTF input)</option>
            <option value="-O">(-O) process also non-transcript GFF records (by default non-transcript records are ignored)</option>
            <option value="--no-pseudo">(--no-pseudo) filter out records matching the 'pseudo' keyword</option>
        </param> 
        <conditional name="region">
            <param name="region_filter" type="select" label="Filter by genome region">
                <option value="none">No</option>
                <option value="filter">Yes</option>
            </param>
            <when value="none"/>
            <when value="filter">
                <param name="range" type="text" value="" size="60" label="Only show transcripts overlapping coordinate range"
                    help="-r [['strand']'chr':]'start'..'end' &lt;br&gt; examples: &lt;br&gt; 1000..500000 &lt;br&gt; chr1:1000..500000 &lt;br&gt; +chr1:1000..500000 &lt;br&gt; -chr1:1000..500000" >
                    <validator type="regex">(([+-])?(\w+:))?\d+\.\.\d+</validator>
                </param>
                <param name="discard_partial" type="boolean" truevalue="-R" falsevalue="" check="false" 
                       label="(-R) and discard all transcripts that are not fully contained within the given range"/>
            </when>
        </conditional>
        <param name="maxintron" type="integer" value="" optional="true" min="0" label="(-i) max_intron - Filter out transcipts with large introns" 
               help="If set, discard transcripts having an intron larger"/>
        <param name="chr_replace" type="data" format="tabular" optional="true" label="Replace reference sequence names (e.g. chr1 with 1)" >
            <help>(-m chr_replace) &lt;br&gt; 
                  chr_replace is input file is a 2 column tab-delimited file containing a reference (genomic) sequence replacement table with this format: &lt;br&gt; 
                  "original_ref_ID"  "new_ref_ID" &lt;br&gt; 
                  GFF records on reference sequences that are not found among the "original_ref_ID" entries in this file will be filtered out
            </help>
        </param> 

        <!-- Although documented, does not appear to be used in the gffread code
        <param name="seq_info" type="data" format="tabular" optional="true" label="Use the description field as the value for a 'descr' attribute to the GFF record">
            <help>
                   (-s seq_info.fsize -A)  useful with mRNA/EST/protein mappings &lt;br&gt;
                  seq_info input file is a 3 column tab-delimited file providing this info for each of the mapped sequences: &lt;br&gt;
                  "seq-name" "seq-length" "seq-description" &lt;br&gt;
            </help>
        </param> 
        -->

        <!-- merging -->
        <conditional name="merging">
            <param name="merge_sel" type="select" label="(-M) Transcript merging">
                <option value="none">none</option>
                <option value="merge">merge: cluster the input transcripts into loci, collapsing matching transcripts</option>
                <option value="cluster">cluster-only: merge but without collapsing matching transcripts</option>
            </param>
            <when value="none"/>
            <when value="merge">
                <param name="merge_cmd" type="hidden" value="--merge"/>
                <expand macro="merge_opt_sel" />
            </when>
            <when value="cluster">
                <param name="merge_cmd" type="hidden" value="--cluster-only"/>
                <expand macro="cluster_opt_sel" />
            </when>
        </conditional>
        <!-- reference sequence file -->
        <!-- Error: -g option is required for options -w, -x, -y, -V, -N, -M -->
        <conditional name="reference_genome">
            <param name="source" type="select" label="(-g) Reference Genome (Required for fasta outputs)">
                <option value="none">none</option>
                <option value="cached"></option>
                <option value="history">From your history</option>
            </param>
            <when value="none">
            </when>
            <when value="cached">
                <param name="fasta_indexes" type="select" label="Source FASTA Sequence">
                    <options from_data_table="all_fasta"/>
                </param>
                <expand macro="ref_filtering_select" />
                <expand macro="fasta_output_select" />
            </when>
            <when value="history">
                <param name="genome_fasta" type="data" format="fasta" label="Genome Reference Fasta"/> 
                <expand macro="ref_filtering_select" />
                <expand macro="fasta_output_select" />
            </when>
        </conditional>

        <!-- outputs -->
        <conditional name="gffs">
            <param name="gff_fmt" type="select" optional="true" label="(-o) Feature File Output">
                <option value="none">none</option>
                <option value="gff">GFF</option>
                <option value="gtf">GTF</option>
            </param>
            <when value="none">
            </when>
            <when value="gff">
                <param name="output_cmd" type="hidden" value="-o output.gff3"/>
                <param name="ensembl" type="boolean" truevalue="-F" falsevalue="" check="false" label="(-L) Ensembl GTF to GFF3 conversion"/>
                <expand macro="trackname" />
            </when>
            <when value="gtf">
                <param name="output_cmd" type="hidden" value="-T -o output.gtf"/>
                <expand macro="trackname" />
            </when>
        </conditional>

        <param name="full_gff_attribute_preservation" type="boolean" truevalue="-F" falsevalue="" check="false" 
                       label="(-F) full GFF attribute preservation (all attributes are shown)"/>
        <param name="decode_url" type="boolean" truevalue="-D" falsevalue="" check="false" 
                       label="(-D) decode url encoded characters within attributes"/>
        <param name="expose" type="boolean" truevalue="-E" falsevalue="" check="false" 
                       label="(-E) warn about duplicate transcript IDs and other potential problems with the given GFF/GTF records"/>

    </inputs>
    <outputs>
        <data name="output_gff" format="gff3" metadata_source="input" label="${tool.name} on ${on_string}: gff3" from_work_dir="output.gff3">
            <filter>gffs['gff_fmt'] == 'gff'</filter>
        </data>
        <data name="output_gtf" format="gtf" metadata_source="input" label="${tool.name} on ${on_string}: gtf" from_work_dir="output.gtf">
            <filter>gffs['gff_fmt'] == 'gtf'</filter>
        </data>
        <data name="output_exons" format="fasta" label="${tool.name} on ${on_string}: exons.fa" from_work_dir="exons.fa">
            <filter>'fa_outputs' in reference_genome and str(reference_genome['fa_outputs']).find('exons.fa') > 0 </filter>
        </data>
        <data name="output_cds" format="fasta"  label="${tool.name} on ${on_string}: cds.fa" from_work_dir="cds.fa">
            <filter>'fa_outputs' in reference_genome and str(reference_genome['fa_outputs']).find('cds.fa')  > 0</filter>
        </data>
        <data name="output_pep" format="fasta" label="${tool.name} on ${on_string}: pep.fa" from_work_dir="pep.fa">
            <filter>'fa_outputs' in reference_genome and str(reference_genome['fa_outputs']).find('pep.fa')  > 0</filter>
        </data>
        <data name="output_dupinfo" format="txt" label="${tool.name} on ${on_string}: dupinfo" from_work_dir="dupinfo">
            <filter>'merge_options' in merging and merging['merge_options'].find('dupinfo') > 0</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="gff_fmt" value="gff"/>
            <output name="output_gff" file="Homo_sapiens.GRCh37_19.71.gff3" ftype="gff3" />
        </test>

        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="filtering" value="--no-pseudo"/>
            <param name="gff_fmt" value="gtf"/>
            <output name="output_gtf">
                <assert_contents>
                    <not_has_text text="pseudo" />
		</assert_contents>
            </output>
        </test>

        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="region_filter" value="filter"/>
            <param name="range" value="19:496500..504965"/>
            <param name="gff_fmt" value="gtf"/>
            <output name="output_gtf">
                <assert_contents>
                    <has_text text="ENST00000587541" />
                    <has_text text="ENST00000382683" />
		</assert_contents>
            </output>
        </test>

        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="region_filter" value="filter"/>
            <param name="range" value="19:496500..504965"/>
            <param name="discard_partial" value="true"/>
            <param name="gff_fmt" value="gtf"/>
            <output name="output_gtf">
                <assert_contents>
                    <has_text text="ENST00000587541" />
                    <has_text text="ENST00000382683" />
		</assert_contents>
            </output>
        </test>

        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="filtering" value="-C"/>
            <param name="region_filter" value="filter"/>
            <param name="range" value="19:496500..504965"/>
            <param name="gff_fmt" value="gtf"/>
            <output name="output_gtf">
                <assert_contents>
                    <not_has_text text="ENST00000587541" />
                    <has_text text="ENST00000382683" />
		</assert_contents>
            </output>
        </test>

        <test>
            <param name="input" ftype="gtf" value="Homo_sapiens.GRCh37_19.71.gtf"/>
            <param name="source" value="history"/>
            <param name="genome_fasta" ftype="fasta" value="Homo_sapiens.GRCh37.71.dna.chromosome.19.fa"/>
            <param name="fa_outputs" value="-w exons.f,-x cds.fa,-y pep.fa"/>
            <param name="region_filter" value="filter"/>
            <param name="range" value="19:496500..504965"/>
            <param name="gff_fmt" value="gtf"/>
            <output name="output_gtf">
                <assert_contents>
                    <not_has_text text="ENST00000587541" />
                    <has_text text="ENST00000382683" />
		</assert_contents>
            </output>
            <output name="output_exons">
                <assert_contents>
                    <has_text text="ENST00000346144 gene=MADCAM1 CDS=47-932" />
                    <has_text text="CTATTTAAGCGGCTTCCCCGCGGCCTCGGGACAGAGGGGACTGAGCATGGATTTCGGACTGGCCCTCCTG" />
		</assert_contents>
            </output>
            <output name="output_cds">
                <assert_contents>
                    <has_text text="ENST00000346144 gene=MADCAM1" />
                    <has_text text="ATGGATTTCGGACTGGCCCTCCTGCTGGCGGGGCTTCTGGGGCTCCTCCTCGGCCAGTCCCTCCAGGTGA" />
		</assert_contents>
            </output>
            <output name="output_pep">
                <assert_contents>
                    <has_text text="ENST00000346144 gene=MADCAM1" />
                    <has_text text="MDFGLALLLAGLLGLLLGQSLQVKPLQVEPPEPVVAVALGASRQLTCRLACADRGASVQWRGLDTSLGAV" />
		</assert_contents>
            </output>
        </test>

    </tests>
    <help>
<![CDATA[
**gffread   Filters and/or converts GFF3/GTF2 records**

Usage: ::

 gffread "input_gff" [-g "genomic_seqs_fasta" | "dir"][-s "seq_info.fsize"] 
   [-o "outfile.gff"] [-t "tname"] [-r [["strand"]"chr":]"start".."end" [-R]]
   [-CTVNJMKQAFGUBHZWTOLE] [-w "exons.fa"] [-x "cds.fa"] [-y "tr_cds.fa"]
   [-i "maxintron"] 
 
Options: ::

  -g  full path to a multi-fasta file with the genomic sequences
      for all input mappings, OR a directory with single-fasta files
      (one per genomic sequence, with file names matching sequence names)
  -s  <seq_info.fsize> is a tab-delimited file providing this info
      for each of the mapped sequences:
      <seq-name> <seq-length> <seq-description>
      (useful for -A option with mRNA/EST/protein mappings)
  -i  discard transcripts having an intron larger than <maxintron>
  -r  only show transcripts overlapping coordinate range <start>..<end>
      (on chromosome/contig <chr>, strand <strand> if provided)
  -R  for -r option, discard all transcripts that are not fully 
      contained within the given range
  -U  discard single-exon transcripts
  -C  coding only: discard mRNAs that have no CDS feature
  -F  full GFF attribute preservation (all attributes are shown)
  -G  only parse additional exon attributes from the first exon
      and move them to the mRNA level (useful for GTF input)
  -A  use the description field from <seq_info.fsize> and add it
      as the value for a 'descr' attribute to the GFF record
  
  -O  process also non-transcript GFF records (by default non-transcript
      records are ignored)
  -V  discard any mRNAs with CDS having in-frame stop codons
  -H  for -V option, check and adjust the starting CDS phase
      if the original phase leads to a translation with an 
      in-frame stop codon
  -B  for -V option, single-exon transcripts are also checked on the
      opposite strand
  -N  discard multi-exon mRNAs that have any intron with a non-canonical
      splice site consensus (i.e. not GT-AG, GC-AG or AT-AC)
  -J  discard any mRNAs that either lack initial START codon
      or the terminal STOP codon, or have an in-frame stop codon
      (only print mRNAs with a fulll, valid CDS)
  --no-pseudo: filter out records matching the 'pseudo' keyword
 
  -M/--merge : cluster the input transcripts into loci, collapsing matching
       transcripts (those with the same exact introns and fully contained)
  -d <dupinfo> : for -M option, write collapsing info to file <dupinfo>
  --cluster-only: same as --merge but without collapsing matching transcripts
  -K  for -M option: also collapse shorter, fully contained transcripts
      with fewer introns than the container
  -Q  for -M option, remove the containment restriction:
      (multi-exon transcripts will be collapsed if just their introns match,
      while single-exon transcripts can partially overlap (80%))
 
  --force-exons: make sure that the lowest level GFF features are printed as 
      "exon" features
  -E  expose (warn about) duplicate transcript IDs and other potential 
      problems with the given GFF/GTF records
  -D  decode url encoded characters within attributes
  -Z  merge close exons into a single exon (for intron size<4)
  -w  write a fasta file with spliced exons for each GFF transcript
  -x  write a fasta file with spliced CDS for each GFF transcript
  -W  for -w and -x options, also write for each fasta record the exon
      coordinates projected onto the spliced sequence
  -y  write a protein fasta file with the translation of CDS for each record
  -L  Ensembl GTF to GFF3 conversion (implies -F; should be used with -m)
  -m  <chr_replace> is a reference (genomic) sequence replacement table with
      this format:
      <original_ref_ID> <new_ref_ID>
      GFF records on reference sequences that are not found among the
      <original_ref_ID> entries in this file will be filtered out
  -o  the "filtered" GFF records will be written to <outfile.gff>
      (use -o- for printing to stdout)
  -t  use <trackname> in the second column of each GFF output line
  -T  -o option will output GTF format instead of GFF3





]]>
    </help>
</tool>