Hello biostars,
I am new to this type of analysis. I have IDR.NarrowPeak data and I would like to normalise it to FPKM using R. I read that the packages limma and DESeq are helpful but I still have problems creating the count matrix. Is there a step I am missing?
Any help/suggestion will be appreciated.
2 answers
You should try DiffBind, which uses DESeq and edgeR in the background and automates this process: https://bioconductor.org/packages/release/bioc/html/DiffBind.html
The peak file is the template for the count matrix. You can e.g. use featureCounts to get the counts per peak and sample directly from the BAM files:
## 1. Transform narrowPeak to the featureCount SAF format:
awk 'OFS="\t" {print $1"_"$2+1"_"$3, $1, $2+1, $3, "+"}' in.narrowPeak > out.saf
## 2. Run fC:
featureCounts -a out.saf -F SAF -o countmatrix.txt *.bam
This countmatrix you can normalize with e.g. DESeq2 or edgeR or transformations such as vst and rlog. Stay away from naive methods such as R/FPKM. They are not suitable for inter-sample comparisons.
Log in to answer this question.
The count matrix is created outside of DEseq, have a look at featureCounts (subread toolkit, outside of R) or the countOverlaps function from GenomicRanges, in case you want to do it in R (not recommended as it requires he loading of bam files into R which is a waste of memory, so better use featureCounts directly on the bam files in the disk).