view rmarkdown_feature_counts.xml @ 2:8519371cc6d1 draft

update
author mingchen0919
date Fri, 29 Dec 2017 22:05:45 -0500
parents 5af86972b408
children 40704501d8c4
line wrap: on
line source

<tool id="feature_counts" name="featureCounts" version="1.0.0">
    <requirements>
        <requirement type="package" version="1.15.0.6-0">pandoc</requirement>
        <requirement type="package" version="1.20.0">r-getopt</requirement>
        <requirement type="package" version="1.3">r-rmarkdown</requirement>
        <requirement type="package" version="0.3.5">r-htmltools</requirement>
        <requirement type="package" version="0.5.0">r-dplyr</requirement>
        <requirement type="package" version="0.2">r-dt</requirement>
        <requirement type="package" version="1.25.2">bioconductor-rsubread</requirement>
    </requirements>
    <description>This function assigns mapped sequencing reads to genomic features</description>
    <stdio>
        <regex source="stderr" match="XXX" level="warning"
               description="Check the warnings_and_errors.txt file for more details."/>
    </stdio>
    <command><![CDATA[
                    Rscript '${__tool_directory__}/rmarkdown_feature_counts_render.R'
                        -e $echo
                        ##----- code chunk to get file paths and raw file names for a multiple inputs data field ----
                        #set $sep = ''
                        #set $input_bam_paths = ''
                        #set $input_bam_names = ''
                        #for $input_bam in $input_bams:
                            #set $input_bam_paths += $sep + str($input_bam)
                            #set $input_bam_names += $sep + str($input_bam.name)
                            #set $sep = ','
                        #end for
                        ##----------------- end for getting file names and file paths ------------------------------
                        -a '$input_bam_paths'
                        -N '$input_bam_names'
                        -b $annot_inbuilt
                        -c '$annot_ext'
                        -f $isGTFAnnotationFile
                        -g $gtf_feature_type
                        -h $gtf_attr_type
                        -i $chr_aliases
                        -j $use_meta_features
                        -k $allow_multi_overlap
                        -l $min_overlap
                        -m $largest_overlap
                        -n $read_extension_5
                        -o $read_extension_3
                        -p $read_2_pos
                        -q $count_multi_mapping_reads
                        -u $fraction
                        -v $min_mqs
                        -w $split_only
                        -x $non_split_only
                        -y $primary_only
                        -z $ignore_dup
                        -A $strand_specific
                        -B $junc_counts
                        -C $genome
                        -D $is_paired_end
                        -E $require_both_ends_mapped
                        -F $check_frag_length
                        -G $min_frag_length
                        -H $max_frag_length
                        -I $count_chimeric_fragments
                        -J $auto_sort
                        -K $n_threads
                        -L $max_mop
                        -M $report_reads
                        -r $report
                        -d $report.files_path
                        -s $sink_message
                        -t '${__tool_directory__}/rmarkdown_feature_counts.Rmd'
                    ]]></command>
    <inputs>
        <param type="boolean" name="echo" label="Display analysis code in report?" optional="False" checked="False"
               truevalue="TRUE" falsevalue="FALSE"/>
        <param type="data" name="input_bams" label="BAM/SAM files"
               help="The files can be in either SAM format or BAM format. The file format is automatically detected by the function"
               optional="False" format="bam,sam" multiple="True"/>
        <param type="text" name="annot_inbuilt" label="annot.inbuilt"
               help="a character string specifying an in-built annotation used for read summarization. It has four possible values including mm10, mm9, hg38 and hg19, corresponding to the NCBI RefSeq annotations for genomes 'mm10', 'mm9', 'hg38' and 'hg19', respectively. mm10 by default. The in-built annotation has a SAF format (see below)."
               optional="False" value="mm10"/>
        <param type="data" name="annot_ext" label="External annotation (GTF)"
               help="A character string giving name of a user-provided annotation file or a data frame including user-provided annotation data"
               optional="False" format="gtf,gff,saf" multiple="False"/>
        <param type="boolean" name="isGTFAnnotationFile" optional="False" checked="True" truevalue="TRUE"
               falsevalue="FALSE"/>
        <param type="text" name="gtf_feature_type" label="GTF.featureType"
               help="a character string giving the feature type used to select rows in the GTF annotation which will be used for read summarization. exon by default. This argument is only applicable when isGTFAnnotationFile is TRUE"
               optional="False" value="exon"/>
        <param type="text" name="gtf_attr_type" label="GTF.attrType"
               help="a character string giving the attribute type in the GTF annotation which will be used to group features (eg. exons) into meta-features (eg. genes). gene_id by default. This argument is only applicable when isGTFAnnotationFile is TRUE"
               optional="False" value="gene_id"/>
        <param type="data" name="chr_aliases" label="chrAliases"
               help="a character string giving the name of a file that contains aliases of chromosome names. The file should be a comma delimited text file that includes two columns. The first column gives the chromosome names used in the annotation and the second column gives the chromosome names used by reads. This file should not contain header lines. Names included in this file are case sensitive."
               optional="True" format="csv"/>
        <param type="boolean" name="use_meta_features" label="useMetaFeatures"
               help="logical indicating whether the read summarization should be performed at the feature level (eg. exons) or meta-feature level (eg genes). If TRUE, features in the annotation (each row is a feature) will be grouped into meta-features using their values in the &quot;GeneID&quot; column in the SAF-format annotation file or using the &quot;gene_id&quot; attribute in the GTF-format annotation file, and reads will assiged to the meta-features instead of the features. See below for more details."
               optional="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="allow_multi_overlap" label="allowMultiOverlap"
               help="logical indicating if a read is allowed to be assigned to more than one feature (or meta-feature) if it is found to overlap with more than one feature (or meta-feature). FALSE by default."
               optional="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="min_overlap" label="minOverlap"
               help="integer giving the minimum number of overlapped bases required for assigning a read to a feature (or a meta-feature). For assignment of read pairs (fragments), numbers of overlapping bases from each read in the same pair will be summed. If a negative value is provided, the read will be extended from both ends. 1 by default."
               optional="False" value="1"/>
        <param type="boolean" name="largest_overlap" label="largestOverlap"
               help="If TRUE, a read (or read pair) will be assigned to the feature (or meta-feature) that has the largest number of overlapping bases, if the read (or read pair) overlaps with multiple features (or meta-features)."
               optional="False" checked="True" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="read_extension_5" label="readExtension5"
               help="integer giving the number of bases extended upstream from 5' end of each read. 0 by default."
               optional="False" value="1"/>
        <param type="integer" name="read_extension_3" label="readExtension3"
               help="integer giving the number of bases extended downstream from 3' end of each read. 0 by default."
               optional="False" value="1"/>
        <param type="text" name="read_2_pos" label="read2pos"
               help="Specifying whether each read should be reduced to its 5' most base or 3' most base. It has three possible values: NULL, 5 (denoting 5' most base) and 3 (denoting 3' most base). The default value is NULL. With the default value, the whole read is used for summarization. When read2pos is set to 5 (or 3), read summarization will be performed based on the 5' (or 3') most base position. read2pos can be used together with readExtension5 and readExtension3 parameters to set any desired length for reads."
               optional="False" value="NULL"/>
        <param type="boolean" name="count_multi_mapping_reads" label="countMultiMappingReads"
               help="logical indicating if multi-mapping reads/fragments should be counted, FALSE by default. If TRUE, a multi-mapping read will be counted up to N times if it has N reported mapping locations. This function uses the 'NH' tag to find multi-mapping reads."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="fraction" label="fraction"
               help="logical indicating if fractional counts will be produced for multi-mapping reads. If TRUE, a fractional count, 1/n, will be generated for each reported alignment of a multi-mapping read, where n is the total number of alignments reported for that read. countMultiMappingReads must be set to TRUE when fraction is TRUE."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="min_mqs" label="minMQS"
               help="integer giving the minimum mapping quality score a read must satisfy in order to be counted. For paired-end reads, at least one end should satisfy this criteria. 0 by default."
               optional="False" value="0"/>
        <param type="boolean" name="split_only" label="splitOnly"
               help="logical indicating whether only split alignments (their CIGAR strings contain letter 'N') should be included for summarization. FALSE by default. Example split alignments are exon-spanning reads from RNA-seq data. useMetaFeatures should be set to FALSE and allowMultiOverlap should be set to TRUE, if the purpose of summarization is to assign exon-spanning reads to all their overlapping exons."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="non_split_only" label="nonSplitOnly"
               help="logical indicating whether only non-split alignments (their CIGAR strings do not contain letter 'N') should be included for summarization. FALSE by default."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="primary_only" label="primaryOnly"
               help="logical indicating if only primary alignments should be counted. Primary and secondary alignments are identified using bit 0x100 in the Flag field of SAM/BAM files. If TRUE, all primary alignments in a dataset will be counted no matter they are from multi-mapping reads or not (ie. countMultiMappingReads is ignored)."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="ignore_dup" label="ignoreDup"
               help="logical indicating whether reads marked as duplicates should be ignored. FALSE by default. Read duplicates are identified using bit Ox400 in the FLAG field in SAM/BAM files. The whole fragment (read pair) will be ignored if paired end."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="strand_specific" label="strandSpecific"
               help="integer indicating if strand-specific read counting should be performed. It has three possible values: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). 0 by default."
               optional="False" value="0"/>
        <param type="boolean" name="junc_counts" label="juncCounts"
               help="integer indicating if strand-specific read counting should be performed. It has three possible values: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). 0 by default."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="data" name="genome" label="genome"
               help="a character string giving the name of a FASTA-format file that includes the reference genome sequences. The reference genome provided here should be the same as the one used in read mapping. NULL by default."
               optional="False" format="fasta"/>
        <param type="boolean" name="is_paired_end" label="isPairedEnd"
               help="logical indicating if paired-end reads are used. If TRUE, fragments (templates or read pairs) will be counted instead of individual reads. FALSE by default."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="require_both_ends_mapped" label="requireBothEndsMapped"
               help="logical indicating if both ends from the same fragment are required to be successfully aligned before the fragment can be assigned to a feature or meta-feature. This parameter is only appliable when isPairedEnd is TRUE."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="check_frag_length" label="checkFragLength"
               help="logical indicating if the two ends from the same fragment are required to satisify the fragment length criteria before the fragment can be assigned to a feature or meta-feature. This parameter is only appliable when isPairedEnd is TRUE. The fragment length criteria are specified via minFragLength and maxFragLength."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="min_frag_length" label="minFragLength"
               help="integer giving the minimum fragment length for paired-end reads. 50 by default." optional="False"
               value="50"/>
        <param type="integer" name="max_frag_length" label="maxFragLength"
               help="integer giving the maximum fragment length for paired-end reads. 600 by default. minFragLength and maxFragLength are only applicable when isPairedEnd is TRUE. Note that when a fragment spans two or more exons, the observed fragment length might be much bigger than the nominal fragment length."
               optional="False" value="600"/>
        <param type="boolean" name="count_chimeric_fragments" label="countChimericFragments"
               help="logical indicating whether a chimeric fragment, which has its two reads mapped to different chromosomes, should be counted or not. TRUE by default."
               optional="False" checked="True" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="boolean" name="auto_sort" label="autosort"
               help="logical specifying if the automatic read sorting is enabled. This option is only applicable for paired-end reads. If TRUE, reads will be automatically sorted by their names if reads from the same pair are found not to be located next to each other in the input. No read sorting will be performed if there are no such reads found."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
        <param type="integer" name="n_threads" label="nthreads"
               help="integer giving the number of threads used for running this function. 1 by default."
               optional="False" value="1" min="1"/>
        <param type="integer" name="max_mop" label="maxMOp"
               help="integer giving the maximum number of 'M' operations (matches or mis-matches) allowed in a CIGAR string. 10 by default. Both 'X' and '=' operations are treated as 'M' and adjacent 'M' operations are merged in the CIGAR string."
               optional="False" value="10"/>
        <param type="boolean" name="report_reads" label="reportReads"
               help="logical indicating if read counting result for each read/fragment is saved to a file. If TRUE, read counting results for reads/fragments will be saved to a tab-delimited file that contains four columns including name of read/fragment, status(assigned or the reason if not assigned), name of target feature/meta-feature and number of hits if the read/fragment is counted multiple times. Name of the file is the same as name of the input read file except a suffix '.featureCounts' is added. Multiple files will be generated if there is more than one input read file."
               optional="False" checked="False" truevalue="TRUE" falsevalue="FALSE"/>
    </inputs>
    <outputs>
        <data name="report" format="html" label="tool name report" hidden="false"/>
        <data name="sink_message" format="txt" label="Warnings and Errors" from_work_dir="warnings_and_errors.txt"
              hidden="false"/>
        <data name="feature_counts" format="rdata" label="feature counts" from_work_dir="feature_counts.RData"
              hidden="false"/>
        <data name="feature_counts_csv" format="tabular" label="feature counts (.txt)"
              from_work_dir="feature_counts.txt"
              hidden="false"/>
    </outputs>
    <help><![CDATA[some help text]]></help>
    <citations>
        <citation type="bibtex"><![CDATA[
                    @article{allaire2016rmarkdown,
                        title={rmarkdown: Dynamic Documents for R, 2016},
                        author={Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff
                        and Wickham, Hadley and Atkins, Aron and Hyndman, Rob},
                        journal={R package version 0.9},
                        volume={6},
                        year={2016}
                    ]]></citation>
        <citation type="bibtex"><![CDATA[@article{liao2013featurecounts,
  title={featureCounts: an efficient general purpose program for assigning sequence reads to genomic features},
  author={Liao, Yang and Smyth, Gordon K and Shi, Wei},
  journal={Bioinformatics},
  volume={30},
  number={7},
  pages={923--930},
  year={2013},
  publisher={Oxford University Press}
}]]></citation>
    </citations>
</tool>