/** * Get the Base Deletion quality at this pileup position * @return a phred-scaled quality score as a byte */ public byte getBaseDeletionQual() { return isDeletion() ? DELETION_QUAL : read.getBaseDeletionQualities()[offset]; }
private void performBatchAdditions(final List<GATKSAMRecord> reads, final List<Haplotype> haplotypes, Map<GATKSAMRecord,byte[]> gcp) { for(final GATKSAMRecord read : reads){ final byte[] readBases = read.getReadBases(); final byte[] readQuals = read.getBaseQualities(); final byte[] readInsQuals = read.getBaseInsertionQualities(); final byte[] readDelQuals = read.getBaseDeletionQualities(); final byte[] overallGCP = gcp.get(read); batchAdd(haplotypes, readBases, readQuals, readInsQuals, readDelQuals, overallGCP); } }
@Override public void recordValues(final GATKSAMRecord read, final ReadCovariates values) { final byte[] baseQualities = read.getBaseQualities(); final byte[] baseInsertionQualities = read.getBaseInsertionQualities(); final byte[] baseDeletionQualities = read.getBaseDeletionQualities(); for (int i = 0; i < baseQualities.length; i++) { values.addCovariate((int)baseQualities[i], (int)baseInsertionQualities[i], (int)baseDeletionQualities[i], i); } }
public byte[] getBaseQualities( final EventType errorModel ) { switch( errorModel ) { case BASE_SUBSTITUTION: return getBaseQualities(); case BASE_INSERTION: return getBaseInsertionQualities(); case BASE_DELETION: return getBaseDeletionQualities(); default: throw new ReviewedGATKException("Unrecognized Base Recalibration type: " + errorModel ); } }
private void writeDebugLikelihoods(final GATKSAMRecord processedRead, final Haplotype haplotype, final double log10l){ likelihoodsStream.printf("%s %s %s %s %s %s %f%n", haplotype.getBaseString(), new String(processedRead.getReadBases() ), SAMUtils.phredToFastq(processedRead.getBaseQualities()), SAMUtils.phredToFastq(processedRead.getBaseInsertionQualities() ), SAMUtils.phredToFastq(processedRead.getBaseDeletionQualities() ), SAMUtils.phredToFastq(constantGCP), log10l); }
/** * Loads the read that is going to be evaluated in following calls to {@link #calculateLocalLikelihoods}. * * @param read the target read. * @throws NullPointerException if {@code read} is null. */ @Override public void loadRead(final GATKSAMRecord read) { loadRead(read.getReadBases(),read.getBaseQualities(),read.getBaseInsertionQualities(),read.getBaseDeletionQualities(),read.getMappingQuality()); }
readDataArray[idx].readQuals = read.getBaseQualities(); readDataArray[idx].insertionGOP = read.getBaseInsertionQualities(); readDataArray[idx].deletionGOP = read.getBaseDeletionQualities(); readDataArray[idx].overallGCP = gcp.get(read); ++idx;
final byte[] readQuals = read.getBaseQualities(); final byte[] readInsQuals = read.getBaseInsertionQualities(); final byte[] readDelQuals = read.getBaseDeletionQualities(); final byte[] overallGCP = gcp.get(read);
/** * Pre-processing of the reads to be evaluated at the current location from the current sample. * We apply the PCR Error Model, and cap the minimum base, insertion, and deletion qualities of each read. * Modified copies of reads are packed into a new list, while original reads are retained for downstream use * * @param reads The original list of unmodified reads * @return processedReads. A new list of reads, in the same order, whose qualities have been altered by PCR error model and minimal quality thresholding */ private List<GATKSAMRecord> modifyReadQualities(final List<GATKSAMRecord> reads) { final List<GATKSAMRecord> result = new ArrayList<>(reads.size()); for (final GATKSAMRecord read : reads) { final byte[] readBases = read.getReadBases(); // NOTE -- must clone anything that gets modified here so we don't screw up future uses of the read final byte[] readQuals = read.getBaseQualities().clone(); final byte[] readInsQuals = read.getBaseInsertionQualities().clone(); final byte[] readDelQuals = read.getBaseDeletionQualities().clone(); applyPCRErrorModel(readBases, readInsQuals, readDelQuals); capMinimumReadQualities(read, readQuals, readInsQuals, readDelQuals); // Create a new copy of the read and sets its base qualities to the modified versions. // Pack this into a new list for return result.add(GATKSAMRecord.createQualityModifiedRead(read, readBases, readQuals, readInsQuals, readDelQuals)); } return result; }
/** * Clears all attributes except ReadGroup of the read. */ public GATKSAMRecord simplify () { GATKSAMReadGroupRecord rg = getReadGroup(); // save the read group information byte[] insQuals = (this.getAttribute(BQSR_BASE_INSERTION_QUALITIES) == null) ? null : getBaseInsertionQualities(); byte[] delQuals = (this.getAttribute(BQSR_BASE_DELETION_QUALITIES) == null) ? null : getBaseDeletionQualities(); this.clearAttributes(); // clear all attributes from the read this.setReadGroup(rg); // restore read group if (insQuals != null) this.setBaseQualities(insQuals, EventType.BASE_INSERTION); // restore base insertion if we had any if (delQuals != null) this.setBaseQualities(delQuals, EventType.BASE_DELETION); // restore base deletion if we had any return this; }
debugDump("reads_java.txt",String.format("%d\n",(int)read.getBaseQualities()[i]),true); debugDump("reads_java.txt",String.format("%d\n",(int)read.getBaseInsertionQualities()[i]),true); debugDump("reads_java.txt",String.format("%d\n",(int)read.getBaseDeletionQualities()[i]),true); debugDump("reads_java.txt",String.format("%d\n",(int)overallGCP[i]),true); debugDump("debug_dump.txt",new String(tmpByteArray)+" ",true); for(int k=0;k<read.getReadBases().length;++k) tmpByteArray[k] = (byte)((int)((read.getBaseDeletionQualities())[k]) + 33); debugDump("debug_dump.txt",new String(tmpByteArray)+" ",true); for(int k=0;k<read.getReadBases().length;++k)
final byte[] newBaseDeletionQuals = new byte[newLength]; System.arraycopy(read.getBaseInsertionQualities(), copyStart, newBaseInsertionQuals, 0, newLength); System.arraycopy(read.getBaseDeletionQualities(), copyStart, newBaseDeletionQuals, 0, newLength); hardClippedRead.setBaseQualities(newBaseInsertionQuals, EventType.BASE_INSERTION); hardClippedRead.setBaseQualities(newBaseDeletionQuals, EventType.BASE_DELETION);
/** * Creates a hard-clipped view on a existing read record. * @param read the underlying unclipped read. * @param start inclusive first position in {@code read} included in the clipped view. * @param end inclusive last position in {@code read} included in the clipped view. */ public ClippedGATKSAMRecord(final GATKSAMRecord read, int start, int end) { super(read.getHeader()); this.setReferenceIndex(read.getReferenceIndex()); this.setAlignmentStart(read.getAlignmentStart() + start); this.setMappingQuality(100); // setting read indexing bin below this.setFlags(read.getFlags()); this.setMateReferenceIndex(read.getMateReferenceIndex()); this.setMateAlignmentStart(read.getMateAlignmentStart()); this.setInferredInsertSize(read.getInferredInsertSize()); this.setReadBases(Arrays.copyOfRange(read.getReadBases(), start, end)); this.setBaseQualities(Arrays.copyOfRange(read.getBaseQualities(),start,end)); this.setReadName(read.getReadName()); insertionQuals = Arrays.copyOfRange(read.getBaseInsertionQualities(),start,end); deletionQuals = Arrays.copyOfRange(read.getBaseDeletionQualities(),start,end); // Set these to null in order to mark them as being candidates for lazy initialization. // If this is not done, they will have non-null defaults. super.setReadName(null); super.setCigarString(null); super.setReadBases(null); super.setBaseQualities(null); // Do this after the above because setCigarString will clear it. GATKBin.setReadIndexingBin(this, -1); }
if ( read.hasBaseIndelQualities() ) { baseInsertionQualities = Arrays.copyOfRange(read.getBaseInsertionQualities(), numStartSoftClippedBases, endOfCopy); baseDeletionQualities = Arrays.copyOfRange(read.getBaseDeletionQualities(), numStartSoftClippedBases, endOfCopy); } else { baseInsertionQualities = contextLogGapOpenProbabilities;
final byte[] firstReadDeletionQuals = firstRead.getBaseDeletionQualities(); final byte[] secondReadInsertionQuals = secondRead.getBaseInsertionQualities(); final byte[] secondReadDeletionQuals = secondRead.getBaseDeletionQualities(); for(int iii = 0; iii < firstReadStop; iii++) { insertionQuals[iii] = firstReadInsertionQuals[iii];
final byte[] bq = r.getBaseQualities(); final byte[] iq = r.getBaseInsertionQualities(); final byte[] dq = r.getBaseDeletionQualities(); int refOffset = r.getAlignmentStart() - 1; int readOffset = 0;