Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions qsv/src/org/qcmg/qsv/splitread/SplitReadContig.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public SplitReadAlignment getRight() {
}

public static SplitReadAlignment getSingleSplitReadAlignment(SplitReadAlignment left, SplitReadAlignment right) {

if (left == null && right != null) {
return right;
} else if (right == null && left != null) {
Expand Down Expand Up @@ -492,7 +493,7 @@ public void parseConsensusAlign(List<BLATRecord> records) throws QSVException, I
left = null;
right = null;

if (confidenceLevel.equals(QSVConstants.LEVEL_SINGLE_CLIP) || knownSV.equalReference()) {
if (confidenceLevel.equals(QSVConstants.LEVEL_SINGLE_CLIP) || knownSV.equalReference()) {
getSplitReadAlignments(null, records);
} else {
List<BLATRecord> leftRecords = new ArrayList<>();
Expand All @@ -506,12 +507,10 @@ public void parseConsensusAlign(List<BLATRecord> records) throws QSVException, I
rightRecords.add(r);
}
}
getTranslocationSplitReadAlignments(null, leftRecords, rightRecords);
getTranslocationSplitReadAlignments(null, leftRecords, rightRecords);
}



if (left != null & right != null) {
if (left != null & right != null & knownAndPotentialReferencesMatch(knownSV, left, right)) {

//rearrange
reorder();
Expand Down Expand Up @@ -609,6 +608,14 @@ public void parseConsensusAlign(List<BLATRecord> records) throws QSVException, I
}
}

public static boolean knownAndPotentialReferencesMatch(StructuralVariant currentSV, SplitReadAlignment leftAlign, SplitReadAlignment rightAlign) {
if (leftAlign != null & rightAlign != null) {
return (leftAlign.getReference().equals(currentSV.getLeftReference()) && rightAlign.getReference().equals(currentSV.getRightReference())) ||
(rightAlign.getReference().equals(currentSV.getLeftReference()) && leftAlign.getReference().equals(currentSV.getRightReference()));
}
return false;
}

public static boolean leftLower(int leftStart, int rightStart) {
return leftStart < rightStart;
}
Expand Down Expand Up @@ -652,7 +659,6 @@ void calculateMicrohomology() {
}

void recheckMicrohomologyForSingleAlignment() {

String leftRef = getReferenceSequence(splitreadSV.getLeftReference(), splitreadSV.getLeftBreakpoint() + 1, 0, 50, chromosomes);
String rightRef = getReferenceSequence(splitreadSV.getRightReference(), splitreadSV.getRightBreakpoint() - 1, 50, 0, chromosomes);
int end = leftSequence.length();
Expand Down Expand Up @@ -698,7 +704,11 @@ public static String getReferenceSequence(String reference, int breakpoint, int

ConcurrentMap<String,byte[]> referenceMap = QSVUtil.getReferenceMap();
byte[] basesArray = referenceMap.get(reference);


if (start > end) {
logger.info("In getReferenceSequence method - Reference: " + reference + "breakpoint: " + breakpoint + " chromosome: " + c.getName() + " chromosome length: " + c.getTotalLength() + " start: " + start + " end: " + end + " basesArray length: " + basesArray.length);
throw new IllegalArgumentException("Start of reference sequence to retrieve is greater than end: " + start + " " + end);
}
// array is zero-based, and picard is 1-based
return new String(Arrays.copyOfRange(basesArray, start - 1, end - 1));
}
Expand Down Expand Up @@ -937,7 +947,8 @@ private void getTranslocationSplitReadAlignments(SplitReadAlignment align, List<
}
if (index2 != -1) {
rightRecords.remove(index2);
}
}

getTranslocationSplitReadAlignments(getSingleSplitReadAlignment(left, right), leftRecords, rightRecords);
}
}
Expand Down Expand Up @@ -1101,4 +1112,5 @@ public static boolean matchingQueryString(int difference, int queryStart, int qu
public String getMutationType() {
return this.mutationType;
}

}
35 changes: 35 additions & 0 deletions qsv/test/org/qcmg/qsv/splitread/SplitReadContigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,41 @@ public void setSplitReadAlignments() {
assertEquals(true, right == null);
}

@Test
public void testknownAndPotentialReferencesMatch() {
StructuralVariant knownSV = new StructuralVariant("chr10", "chr10", 89700299, 89712341, "1");
SplitReadAlignment left = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
SplitReadAlignment right = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertTrue(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));

knownSV = new StructuralVariant("chr10", "chr10", 89700299, 89712341, "1");
left = new SplitReadAlignment("chr12", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
right = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertFalse(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));

knownSV = new StructuralVariant("chr10", "chr10", 89700299, 89712341, "1");
left = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
right = new SplitReadAlignment("chr12", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertFalse(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));

knownSV = new StructuralVariant("chr10", "chr12", 89700299, 89712341, "1");
left = new SplitReadAlignment("chr12", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
right = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertTrue(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));

knownSV = new StructuralVariant("chr10", "chr12", 89700299, 89712341, "1");
left = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
right = new SplitReadAlignment("chr12", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertTrue(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));

knownSV = new StructuralVariant("chr10", "chr12", 89700299, 89712341, "1");
left = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
right = new SplitReadAlignment("chr10", QSVUtil.MINUS, 89700210, 89700299, 109, 282);
assertFalse(SplitReadContig.knownAndPotentialReferencesMatch(knownSV, left, right));


}

@Test
public void setSplitReadAlignments2() {
/*
Expand Down