Repository revision
29:4418229c501e

Repository 'htseq_count'
hg clone https://toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count

htseq-count tool metadata
Miscellaneous
htseq-count
- Count aligned reads in a BAM file that overlap features in a GFF file
htseq_count
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/2.0.5+galaxy0
2.0.5+galaxy0
htseq-count --version
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/2.0.5+galaxy0 (this tool)
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.9.1+galaxy1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.9.1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.6.1galaxy3
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.6.1galaxy2
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.6.1galaxy1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.4.1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.4
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.3.2
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.3.1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.3
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.2.1
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.2
toolshed.g2.bx.psu.edu/repos/lparsons/htseq_count/htseq_count/0.1
htseq_count
Requirements (dependencies defined in the <requirements> tag set)
name version type
htseq 2.0.5 package
samtools 1.19.2 package
gawk 5.3.0 package
coreutils 9.4 package
Additional information about this tool
##set up input files
    #set $name_sorted_alignment_filename = "name_sorted.bam"
    #set $ref_index = "ref.fai"
    #if $samfile.extension == 'sam':
        #if str($reference_source.reference_source_selector) == "history":
            samtools faidx --fai-idx $ref_index '${reference_source.ref_file}' 2>&1 || echo "Error running samtools faidx for htseq-count" >&2 &&
        #elif str($reference_source.reference_source_selector) == "cached":
            ln -s '${reference_source.ref_file.fields.path}.fai' $ref_index
        #end if
    #end if

    #if $samfile.extension == 'sam' and str($reference_source.reference_source_selector):
        samtools view -u -t $ref_index '$samfile' | samtools sort -n -T "\${TMPDIR:-.}" -o $name_sorted_alignment_filename - &&
    #else:
        samtools sort -n -T "\${TMPDIR:-.}" -o $name_sorted_alignment_filename '$samfile' &&
    #end if

    #if $gfffile.is_of_type('gtf'):
      ## htseq-count requires .gtf suffix to recognize GTF-formatted feature files
      ## and to handle textual attributes should surrounded by doublequotes correctly
      #set $genomic_features = 'features.gtf'
      ln -s '$gfffile' $genomic_features &&
    #else:
      #set $genomic_features = $gfffile
    #end if

    htseq-count
        --mode=$mode
        --stranded=$stranded
        --minaqual=$minaqual
        --type='$featuretype'
        --idattr='$idattr'

    #if str( $advanced_options.advanced_options_selector ) == "advanced":
        --nonunique=$advanced_options.nonunique
        --secondary-alignments=${advanced_options.secondary_alignments}
        --supplementary-alignments=${advanced_options.supplementary_alignments}
        #if $advanced_options.samout:
            -o samout.sam
        #end if
    #end if

    --order=name
    $name_sorted_alignment_filename

    '$genomic_features' | csplit -q - /^__/ &&

    ## csplit above creates two files,
    ## xx00 with the feature counts and xx01 with category counts.
    ## Now we calculate the sum over all feature counts in xx00 and append that
    ## sum as the __aligned count to xx01.
    echo -e "__aligned\t\$(cut -f2 xx00 | awk '{s+=$1}END{print s}' -)" >> xx01

    #if str( $advanced_options.advanced_options_selector ) == "advanced":
        #if $advanced_options.samout:
            && samtools sort -T "\${TMPDIR:-.}" -o out.bam samout.sam
        #end if
    #end if
    
    
None
False
Functional tests
name inputs outputs required files
Test-1 samfile: htseq-test.sam
gfffile: htseq-test.gtf
name: value
name: value
htseq-test.sam
htseq-test.gtf
value
Test-2 samfile: htseq-test.sam
gfffile: htseq-test.gff
name: value
name: value
htseq-test.sam
htseq-test.gff
value
Test-3 samfile: htseq-test_nosq.sam
gfffile: htseq-test.gff
reference_source|ref_file: htseq-test_reference.fasta
reference_source|reference_source_selector: history
name: value
name: value
htseq-test_nosq.sam
htseq-test.gff
htseq-test_reference.fasta
value
Test-4 samfile: htseq-test.bam
gfffile: htseq-test.gff
name: value
name: value
htseq-test.bam
htseq-test.gff
value
Test-5 samfile: htseq-test-paired.bam
gfffile: htseq-test.gff
name: value
name: value
htseq-test-paired.bam
htseq-test.gff
value
Test-6 samfile: htseq-test-paired.bam
gfffile: htseq-test.gff
name: value
name: value
htseq-test-paired.bam
htseq-test.gff
value
Test-7 samfile: htseq-test.sam
gfffile: htseq-test.gff
advanced_options|samout: True
advanced_options|advanced_options_selector: advanced
name: value
name: value
name: value
htseq-test.sam
htseq-test.gff
value
Test-8 samfile: htseq-test.sam
gfffile: htseq-test.gff
advanced_options|nonunique: all
advanced_options|secondary_alignments: True
advanced_options|supplementary_alignments: True
advanced_options|advanced_options_selector: advanced
name: value
name: value
htseq-test.sam
htseq-test.gff
value