View Single Post
Old 09-01-2017, 05:37 AM   #1
foolishbrat
Member
 
Location: South East Asia

Join Date: Nov 2008
Posts: 44
Default Can or should we perform feature counting with `bedtools intersect -c`?

I have the following BAM file and a annotation file.
What I want to do is to calculate reads count in
I can do it with the following three methods.

Below is the code

Code:
    #!/bin/bash
    INPUT_BAM=my_paired_end_alignment.bam
    ANNNOT_BED=peak_annot.bed
    ANNNOT_GTF=peak_annot.gtf
    
    # Temporary file
    ALIGNMENT_BED=my_paired_end_alignment.bed
    
    #-----------
    # Method 1
    #-----------
    FINAL_COUNT_METHOD1=output_method1.txt
    bedtools bamtobed -bedpe -i $INPUT_BAM > $ALIGNMENT_BED
    bedtools intersect -a $ANNOT_BED -b $ALIGNMENT_BED -c > $FINAL_COUNT_METHOD1
    
    #-----------
    # Method 2
    #-----------
    FINAL_COUNT_METHOD2=output_method2.txt
    bedtools multicov -bams $INPUT_BAM -bed $ANNOT_BED > $FINAL_COUNT_METHOD2
    
    #-----------
    # Method 3
    #-----------
    featureCounts  -a $ANNOT_GTF -o counts.txt $INPUT_BAM
The result given by Method1 is so different from Method2 (totally uncorrelated),
whereas Method2 is highly correlated with Method3.

My question is Method1 the right way to count feature? If not why?
Should we use Method2 or Method3 instead?
foolishbrat is offline   Reply With Quote