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
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?
What I want to do is to calculate reads count in
I can do it with the following three methods.
- Method1 bedtools intersect
- Method2 bedtools multicov
- Method3 featureCounts
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
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?
Comment