Hi Lukas,
I have a question about MeDIP R script.
MEDIPS/R/MEDIPS.readRegionsFile.R
regions = data.frame(chr=as.character(as.vector(regions$rname)), start=as.numeric(as.vector(regions$pos)), stop=as.numeric(as.vector(regions$pos)+as.vector(regions$qwidth)-1), strand=as.character(as.vector(regions$strand)), isize=as.numeric(as.vector(regions$isize)), stringsAsFactors=F)
plus=regions$strand=="+"
regions[plus, "stop"] = regions[plus, "stop"] + regions[plus, "isize"] + extend <------ line 153
regions[!plus, "start"] = regions[!plus, "start"] + regions[!plus,"isize" ] - extend <------ line 154
regions[, "stop"]=regions[, "stop"]+shift
regions[, "start"]=regions[, "start"]+shift
Let's take 'extend' to be zero, then template/fragment should be from start of first mate to end of second mate.
Insertion length is defined as distance between start of first mate and end of second mate. So it should have been
regions[plus, "stop"] = regions[plus, "start"] + regions[plus, "isize"]
| | |
| | |
end of second mate start of first mate insertion size
Your implementation is adding extra length which is equal to read length of first mate.
And I have same opinion for line 154 as well.
Have it been done intentionally?
Please! Correct me if my understanding is wrong.
Image link given below will help to understand if still the question is not clear.
https://cloud.githubusercontent.com/assets/1637382/6764850/66028a8e-cfeb-11e4-8cbc-2605d664acb3.jpg
Thanks for any help.