tl;dr: I find many motifPos that imply TF binds completely outside the variant range (start AND end are negative), but also it starts after it ends (end < start)? Also, motif length != end-start.
I got this result from running motifBreakeR on a list of variants that are 12bp substitution (a bit odd, maybe why this happens):
chr8 48582443 48582454 12 + mutant CTGTTGTTATTC TCACCACCGCCT Other c(-6, -9) MSANTD3 jaspar2022 MA1523.1 MA1523.1 gctctccacTCACCACCGCCTtggtcccaa 0.6356006 0.9892791 4.870919 7.465608 NA NA 1:12 2.5946893 0.34392895 strong
Note motifPos: c(-6,9)
I think start is correct (in this and similar cases), but end should simply be start+motifLen.
It seems the bug lies here:
if ((mresult$varType == "Insertion" & score < 0) |
(mresult$varType == "Deletion" & score > 0)) {
motif.end <- motif.start + len
} else {
if (motif.start > 0) {
motif.end <- len - length(motif.start:length(alt_loc[1]:alt_loc[2]))
} else {
motif.end <- motif.start + len - length(alt_loc[1]:alt_loc[2])
}
}
I'm not completely sure what is calculated under else, but it results in this weird bug. First case (motif.start+len) would work well in here. I can't think of a case when, after establishing where motif starts in reference, the end wouldn't be motif.start+len. In any case may be worth throwing a warning if start>=end.
tl;dr: I find many motifPos that imply TF binds completely outside the variant range (start AND end are negative), but also it starts after it ends (end < start)? Also, motif length != end-start.
I got this result from running motifBreakeR on a list of variants that are 12bp substitution (a bit odd, maybe why this happens):
Note motifPos: c(-6,9)
I think start is correct (in this and similar cases), but end should simply be start+motifLen.
It seems the bug lies here:
I'm not completely sure what is calculated under
else, but it results in this weird bug. First case (motif.start+len) would work well in here. I can't think of a case when, after establishing where motif starts in reference, the end wouldn't be motif.start+len. In any case may be worth throwing a warning if start>=end.