Changing ReadUtils behavior to comply with GenomeLocParser
Now the functions getRefCoordSoftUnclippedStart and getRefCoordSoftUnclippedEnd will return getUnclippedStart if the read is all contained within an insertion. Updated the contracts accordingly. This should give the same behavior as the GenomeLocParser now.
This commit is contained in:
parent
080c957547
commit
56106d54ed
|
|
@ -667,7 +667,7 @@ public class ReadUtils {
|
||||||
return ReadAndIntervalOverlap.OVERLAP_RIGHT;
|
return ReadAndIntervalOverlap.OVERLAP_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ensures({"(result >= read.getUnclippedStart() && result <= read.getUnclippedEnd()) || readIsEntirelyInsertion(read)"})
|
@Ensures({"result >= read.getUnclippedStart()", "result <= read.getUnclippedEnd() || readIsEntirelyInsertion(read)"})
|
||||||
public static int getRefCoordSoftUnclippedStart(SAMRecord read) {
|
public static int getRefCoordSoftUnclippedStart(SAMRecord read) {
|
||||||
int start = read.getUnclippedStart();
|
int start = read.getUnclippedStart();
|
||||||
for (CigarElement cigarElement : read.getCigar().getCigarElements()) {
|
for (CigarElement cigarElement : read.getCigar().getCigarElements()) {
|
||||||
|
|
@ -679,9 +679,13 @@ public class ReadUtils {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ensures({"(result >= read.getUnclippedStart() && result <= read.getUnclippedEnd()) || readIsEntirelyInsertion(read)"})
|
@Ensures({"result >= read.getUnclippedStart()", "result <= read.getUnclippedEnd() || readIsEntirelyInsertion(read)"})
|
||||||
public static int getRefCoordSoftUnclippedEnd(SAMRecord read) {
|
public static int getRefCoordSoftUnclippedEnd(SAMRecord read) {
|
||||||
int stop = read.getUnclippedStart();
|
int stop = read.getUnclippedStart();
|
||||||
|
|
||||||
|
if (readIsEntirelyInsertion(read))
|
||||||
|
return stop;
|
||||||
|
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
CigarOperator lastOperator = null;
|
CigarOperator lastOperator = null;
|
||||||
for (CigarElement cigarElement : read.getCigar().getCigarElements()) {
|
for (CigarElement cigarElement : read.getCigar().getCigarElements()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue