I read this post ( C: Compute Binned Gc-Normalized Read Counts From Bam File ) and I am wondering how can I remove GC content bias with Loess regression?
I read this post ( C: Compute Binned Gc-Normalized Read Counts From Bam File ) and I am wondering how can I remove GC content bias with Loess regression?
bedtools makewindows -g hg38.chrom.size -w 300000 > hg38_300.bed
chr13   114364328 
chr18   80373285 
chr21   46709983  
bedtools nuc -fi hs38DH.fa  -bed hg38_300.bed | cut -f 1-3,5 >  300.gc.bed
bedtools coverage  -a hg38_300.bed -b S1901020.aln.bam > S1901020.counts
paste <(grep -v '#' 300.gc.bed) <(cut -f4 S1901020.counts)|sed '1i chr\tstart\tend\tGC\tRC' > nipt
RC_DT<- read.table('nipt',sep='\t',head=TRUE)
gcCount.loess <- loess(RC~GC,data=RC_DT,control = loess.control(surface = "direct"),degree=2)
predictions1<- predict (gcCount.loess,RC_DT$GC) 
resi <- RC_DT$RC-predictions1 
RC_DT$RC <- resi 
the corrected RC in RC_DT$RC, more help about loess can be got in help document in R.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
If you have an issue with GC-bias, why not use computeGCBias and correctGCBias from deepTools?
Actually I want write my own code. I want to know about the method that use loess output and do correction for read counts. but Thanks for your answer. I will look at them maybe I can find their methods.