Ejemplo n.º 1
0
 /**
  * Returns the base qualities for the read as a string.
  *
  * @param read read whose base qualities should be returned
  * @return Base qualities string as printable ASCII values (encoded as a FASTQ string).
  */
 public static String getBaseQualityString(final GATKRead read) {
   Utils.nonNull(read);
   if (Arrays.equals(SAMRecord.NULL_QUALS, read.getBaseQualities())) {
     return SAMRecord.NULL_QUALS_STRING;
   }
   return SAMUtils.phredToFastq(read.getBaseQualities());
 }
Ejemplo n.º 2
0
 public static byte[] getBaseQualities(final GATKRead read, final EventType errorModel) {
   switch (errorModel) {
     case BASE_SUBSTITUTION:
       return read.getBaseQualities();
     case BASE_INSERTION:
       return getBaseInsertionQualities(read);
     case BASE_DELETION:
       return getBaseDeletionQualities(read);
     default:
       throw new GATKException("Unrecognized Base Recalibration type: " + errorModel);
   }
 }
Ejemplo n.º 3
0
 /**
  * Default utility to query the base deletion quality of a read. If the read doesn't have one, it
  * creates an array of default qualities (currently Q45) and assigns it to the read.
  *
  * @return the base deletion quality array
  */
 public static byte[] getBaseDeletionQualities(final GATKRead read) {
   byte[] quals = getExistingBaseDeletionQualities(read);
   if (quals == null) {
     quals = new byte[read.getBaseQualities().length];
     Arrays.fill(
         quals,
         DEFAULT_INSERTION_DELETION_QUAL); // Some day in the future when base insertion and base
                                           // deletion quals exist the samtools API will
     // be updated and the original quals will be pulled here, but for now we assume the original
     // quality is a flat Q45
   }
   return quals;
 }