Hi, it seems that the function ProperOrientation returns the read pairs in FR. But in the code:
if (b->core.pos < b->core.mpos) {
return (b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0 ? true : false;
} else {
return (b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0 ? false : true; # here meet a bug?
}
In the "else" part, it return the read pairs in FR, also the FF and RR, as the code only remove the pairs in RF.
It will be better that rewrite it like this?
}else{
return (b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0 ? true : false;
}
Second, in small insert size data, such as cfDNA data, mpos may == pos. So need add supporting for this situation.
if (b->core.pos < b->core.mpos) {
return (b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0 ? true : false;
} else if(b->core.pos > b->core.mpos) {
return (b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0 ? true : false;
}
else{
return (((b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0) || ((b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0)) ? true : false;
}
Hi, it seems that the function ProperOrientation returns the read pairs in FR. But in the code:
In the "else" part, it return the read pairs in FR, also the FF and RR, as the code only remove the pairs in RF.
It will be better that rewrite it like this?
}else{
return (b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0 ? true : false;
}
Second, in small insert size data, such as cfDNA data, mpos may == pos. So need add supporting for this situation.
if (b->core.pos < b->core.mpos) {
return (b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0 ? true : false;
} else if(b->core.pos > b->core.mpos) {
return (b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0 ? true : false;
}
else{
return (((b->core.flag&BAM_FREVERSE) == 0 && (b->core.flag&BAM_FMREVERSE) != 0) || ((b->core.flag&BAM_FREVERSE) != 0 && (b->core.flag&BAM_FMREVERSE) == 0)) ? true : false;
}