Skip to content

Commit

Permalink
Check RNA stats before 3rd gen to detect long-read rna seq. Fixes #1491.
Browse files Browse the repository at this point in the history
Fix bug interpreting read sequence = "*".  Was interpreting as mismatch to reference.
  • Loading branch information
jrobinso committed Jul 26, 2024
1 parent e9ccb3b commit 0f0b4fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/broad/igv/sam/AlignmentBlockImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public AlignmentBlockImpl(int start, byte[] bases, byte[] qualities, int offset,

this.start = start;
this.offset = offset;
this.bases = new ByteSubarray(bases, offset, nBases, (byte) '?');
this.bases = bases.length == 0 ? EMPTY_ARRAY :new ByteSubarray(bases, offset, nBases, (byte) '?');
this.basesLength = nBases;

// qualities are optional in a SAMRecord, we might get null or an array of zero
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/broad/igv/sam/ReadStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ReadStats {

public void addAlignment(Alignment alignment) {

if(readCount > MAX_READ_COUNT) return;
if (readCount > MAX_READ_COUNT) return;

if (alignment.isMapped()) {

Expand Down Expand Up @@ -135,10 +135,10 @@ private double[] downsample(DoubleArrayList list, int size) {
public AlignmentTrack.ExperimentType inferType() {
compute();
if (readCount < 20) return AlignmentTrack.ExperimentType.UNKOWN; // Not enough reads
if ((readLengthStdDev > 100 || medianReadLength > 1000) && averageCigarLength > 10) { // Cigar length to filter consensus reads
return AlignmentTrack.ExperimentType.THIRD_GEN;
} else if (medianRefToReadRatio > 5 || fracReadsWithNs > 0.01) {
if (medianRefToReadRatio > 5 || fracReadsWithNs > 0.01) {
return AlignmentTrack.ExperimentType.RNA;
} else if ((readLengthStdDev > 100 || medianReadLength > 1000) && averageCigarLength > 10) { // Cigar length to filter consensus reads
return AlignmentTrack.ExperimentType.THIRD_GEN;
} else {
return AlignmentTrack.ExperimentType.OTHER;
}
Expand Down

0 comments on commit 0f0b4fb

Please sign in to comment.