展开

featureCount

最后发布时间 : 2023-05-09 00:02:19 浏览量 :
featureCounts \
    -B -C \
    -p \
    -g gene_id \
    -t exon \
     --countReadPairs \
    -T 10 \
    -a genome.gtf \
    -s 0 \
    -o M5.gene_id.featureCounts.txt \
    M5.sorted.bam

参数说明

  • -s: Perform strand-specific read counting. A single integer value (applied to all input files) or a string of comma- separated values (applied to each corresponding input file) should be provided. Possible values include: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). Default value is 0 (ie. unstranded read counting carried out for all input files).
  • -B: Only count read pairs that have both ends aligned.
  • -C: Do not count read pairs that have their two ends mapping to different chromosomes or mapping to same chromosome but on different strands.

subread

New parameter '--countReadPairs' is added to featureCounts to explicitly specify that read pairs will be counted, and the '-p' option in featureCounts now only specifies if the input reads are paired end (it also implied that counting of read pairs would be performed in previous versions).
注意在subread2.0.2以上的版本中-B参数不起作用,需要使用--countReadPairs

HISAT2 summary stats:
	Total pairs: 11358194
		Aligned concordantly or discordantly 0 time: 3028860 (26.67%)
		Aligned concordantly 1 time: 7950038 (69.99%)
		Aligned concordantly >1 times: 219881 (1.94%)
		Aligned discordantly 1 time: 159415 (1.40%)
	Total unpaired reads: 6057720
		Aligned 0 time: 3587203 (59.22%)
		Aligned 1 time: 2364281 (39.03%)
		Aligned >1 times: 106236 (1.75%)
	Overall alignment rate: 84.21%

(7950038+219881)*2 = 16339838

featureCounts -t exon  \
            -g gene_id             \
             --primary            \
            -s 0             \
            -p            \
            -T 24           \
            -a  resources/genome.gtf         \
            -o  gwat_ABX_OLZ_18.featureCounts       \
            results/hisat2/gwat_ABX_OLZ_18/hisat2.bam 
featureCounts(2.0.3)
        ==========     _____ _    _ ____  _____  ______          _____  
        =====         / ____| |  | |  _ |  __ |  ____|   /\   |  __ \ 
          =====      | (___ | |  | | |_) | |__) | |__     /  \  | |  | |
            ====      ___ | |  | |  _ <|  _  /|  __|   / /\ \ | |  | |
              ====    ____) | |__| | |_) | | \ | |____ / ____ | |__| |
        ==========   |_____/ ____/|____/|_|  _______/_/    ______/
          v2.0.3

//========================== featureCounts setting ===========================\
||                                                                            ||
||             Input files : 1 BAM file                                       ||
||                                                                            ||
||                           hisat2.bam                                       ||
||                                                                            ||
||             Output file : gwat_ABX_OLZ_18.featureCounts                    ||
||                 Summary : gwat_ABX_OLZ_18.featureCounts.summary            ||
||              Paired-end : yes                                              ||
||        Count read pairs : no                                               ||
||              Annotation : genome.gtf (GTF)                                 ||
||      Dir for temp files : ./                                               ||
||                                                                            ||
||                 Threads : 24                                               ||
||                   Level : meta-feature level                               ||
||      Multimapping reads : not counted                                      ||
||     Multiple alignments : primary alignment only                           ||
|| Multi-overlapping reads : not counted                                      ||
||   Min overlapping bases : 1                                                ||
||                                                                            ||
\============================================================================//

//================================= Running ==================================\
||                                                                            ||
|| Load annotation file genome.gtf ...                                        ||
||    Features : 526640                                                       ||
||    Meta-features : 30560                                                   ||
||    Chromosomes/contigs : 48                                                ||
||                                                                            ||
|| Process BAM file hisat2.bam...                                             ||
||    Paired-end reads are included.                                          ||
||    The reads are assigned on the single-end mode.                          ||
||    Total alignments : 23750177                                             ||
||    Successfully assigned alignments : 12709161 (53.5%)                     ||
||    Running time : 0.05 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
|| Summary of counting results can be found in file "gwat_ABX_OLZ_18.feature  ||
|| Counts.summary"                                                            ||
||                                                                            ||
\============================================================================//
samtools view results/hisat2/gwat_ABX_OLZ_18/hisat2.bam  | wc -l
23750177

featureCounts参数--countReadPairs结果

featureCounts -t exon  \
            --countReadPairs \
            -g gene_id             \
             --primary            \
            -s 0             \
            -p            \
            -T 24           \
            -a  resources/genome.gtf         \
            -o  gwat_ABX_OLZ_18.featureCounts       \
            results/hisat2/gwat_ABX_OLZ_18/hisat2.bam 
featureCounts(2.0.3)
        ==========     _____ _    _ ____  _____  ______          _____  
        =====         / ____| |  | |  _ |  __ |  ____|   /\   |  __ \ 
          =====      | (___ | |  | | |_) | |__) | |__     /  \  | |  | |
            ====      ___ | |  | |  _ <|  _  /|  __|   / /\ \ | |  | |
              ====    ____) | |__| | |_) | | \ | |____ / ____ | |__| |
        ==========   |_____/ ____/|____/|_|  _______/_/    ______/
          v2.0.3

//========================== featureCounts setting ===========================\
||                                                                            ||
||             Input files : 1 BAM file                                       ||
||                                                                            ||
||                           hisat2.bam                                       ||
||                                                                            ||
||             Output file : gwat_ABX_OLZ_18.featureCounts                    ||
||                 Summary : gwat_ABX_OLZ_18.featureCounts.summary            ||
||              Paired-end : yes                                              ||
||        Count read pairs : yes                                              ||
||              Annotation : genome.gtf (GTF)                                 ||
||      Dir for temp files : ./                                               ||
||                                                                            ||
||                 Threads : 24                                               ||
||                   Level : meta-feature level                               ||
||      Multimapping reads : not counted                                      ||
||     Multiple alignments : primary alignment only                           ||
|| Multi-overlapping reads : not counted                                      ||
||   Min overlapping bases : 1                                                ||
||                                                                            ||
\============================================================================//

//================================= Running ==================================\
||                                                                            ||
|| Load annotation file genome.gtf ...                                        ||
||    Features : 526640                                                       ||
||    Meta-features : 30560                                                   ||
||    Chromosomes/contigs : 48                                                ||
||                                                                            ||
|| Process BAM file hisat2.bam...                                             ||
||    Paired-end reads are included.                                          ||
||    Total alignments : 11973112                                             ||
||    Successfully assigned alignments : 5785413 (48.3%)                      ||
||    Running time : 0.08 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
|| Summary of counting results can be found in file "gwat_ABX_OLZ_18.feature  ||
|| Counts.summary"                                                            ||
||                                                                            ||
\============================================================================//
featureCounts -t exon  \
            -g gene_id             \
             --primary            \
            -s 0             \
            -p            \
            -T 24           \
            -B \
            -a  resources/genome.gtf         \
            -o  gwat_ABX_OLZ_18.featureCounts       \
            results/hisat2/gwat_ABX_OLZ_18/hisat2.bam 
featureCounts(2.0.1)
        ==========     _____ _    _ ____  _____  ______          _____  
        =====         / ____| |  | |  _ |  __ |  ____|   /\   |  __ \ 
          =====      | (___ | |  | | |_) | |__) | |__     /  \  | |  | |
            ====      ___ | |  | |  _ <|  _  /|  __|   / /\ \ | |  | |
              ====    ____) | |__| | |_) | | \ | |____ / ____ | |__| |
        ==========   |_____/ ____/|____/|_|  _______/_/    ______/
          v2.0.1

//========================== featureCounts setting ===========================\
||                                                                            ||
||             Input files : 1 BAM file                                       ||
||                           o hisat2.bam                                     ||
||                                                                            ||
||             Output file : gwat_ABX_OLZ_18.featureCounts                    ||
||                 Summary : gwat_ABX_OLZ_18.featureCounts.summary            ||
||              Annotation : genome.gtf (GTF)                                 ||
||      Dir for temp files : ./                                               ||
||                                                                            ||
||                 Threads : 24                                               ||
||                   Level : meta-feature level                               ||
||              Paired-end : yes                                              ||
||      Multimapping reads : not counted                                      ||
||     Multiple alignments : primary alignment only                           ||
|| Multi-overlapping reads : not counted                                      ||
||   Min overlapping bases : 1                                                ||
||                                                                            ||
||          Chimeric reads : counted                                          ||
||        Both ends mapped : required                                         ||
||                                                                            ||
\============================================================================//

//================================= Running ==================================\
||                                                                            ||
|| Load annotation file genome.gtf ...                                        ||
||    Features : 526640                                                       ||
||    Meta-features : 30560                                                   ||
||    Chromosomes/contigs : 48                                                ||
||                                                                            ||
|| Process BAM file hisat2.bam...                                             ||
||    Paired-end reads are included.                                          ||
||    Total alignments : 11973112                                             ||
||    Successfully assigned alignments : 5785413 (48.3%)                      ||
||    Running time : 0.08 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
|| Summary of counting results can be found in file "gwat_ABX_OLZ_18.feature  ||
|| Counts.summary"                                                            ||
||                                                                            ||
\============================================================================//

小数据实例

featureCount(2.0.3)
featureCounts -t exon  \
            -g gene_id             \
             --primary            \
            -s 0             \
            -p            \
            -T 24           \
            -a  genome/genome.gtf        \
            -o  220613-95       \
            output/hisat2/220613-95.bam
			
//================================= Running ==================================\
||                                                                            ||
|| Load annotation file genome.gtf ...                                        ||
||    Features : 526640                                                       ||
||    Meta-features : 30560                                                   ||
||    Chromosomes/contigs : 48                                                ||
||                                                                            ||
|| Process BAM file 220613-95.bam...                                          ||
||    Paired-end reads are included.                                          ||
||    The reads are assigned on the single-end mode.                          ||
||    Total alignments : 250                                                  ||
||    Successfully assigned alignments : 124 (49.6%)                          ||
||    Running time : 0.00 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
|| Summary of counting results can be found in file "220613-95.summary"       ||
||                                                                            ||
\============================================================================//

samtools view -c output/hisat2/220613-95.bam
250
featureCount(2.0.1)
featureCounts -t exon  \
            -g gene_id             \
             --countReadPairs   \
             --primary            \
            -s 0             \
            -p            \
            -T 24           \
            -a  genome/genome.gtf        \
            -o  220613-95       \
            output/hisat2/220613-95.bam
			
//================================= Running ==================================\
||                                                                            ||
|| Load annotation file genome.gtf ...                                        ||
||    Features : 526640                                                       ||
||    Meta-features : 30560                                                   ||
||    Chromosomes/contigs : 48                                                ||
||                                                                            ||
|| Process BAM file 220613-95.bam...                                          ||
||    Paired-end reads are included.                                          ||
||    Total alignments : 125                                                  ||
||    Successfully assigned alignments : 63 (50.4%)                           ||
||    Running time : 0.00 minutes                                             ||
||                                                                            ||
|| Write the final count table.                                               ||
|| Write the read assignment summary.                                         ||
||                                                                            ||
|| Summary of counting results can be found in file "220613-95.summary"       ||
||                                                                            ||
\============================================================================//