Class FastqKMerMatcher.MatcherReadEntry

java.lang.Object
org.metagene.genestrip.fastq.AbstractFastqReader.ReadEntry
org.metagene.genestrip.match.FastqKMerMatcher.MatcherReadEntry
Enclosing class:
FastqKMerMatcher

public static class FastqKMerMatcher.MatcherReadEntry extends AbstractFastqReader.ReadEntry
Per-read working state used during matching: the candidate taxonomic paths and their counts, the resolved classification node, and a growable byte buffer holding the read's Kraken-style output.
  • Field Details

    • buffer

      public byte[] buffer
      Growable byte buffer holding the read's Kraken-style output.
    • bufferPos

      public int bufferPos
      Current write position within buffer.
    • badPos

      public int[] badPos
      Single-element scratch array receiving the position of a bad (non-CGAT) base.
    • usedPaths

      public int usedPaths
      Number of candidate taxonomic paths currently used.
    • readTaxIdNode

      public SmallTaxTree.SmallTaxIdNode[] readTaxIdNode
      The candidate taxonomic path nodes tracked for this read.
    • counts

      public int[] counts
      Vote counts associated with the candidate paths.
    • indexPos

      public long[] indexPos
      Single-element scratch array holding the store index of the last matched k-mer.
    • classNode

      public SmallTaxTree.SmallTaxIdNode classNode
      The resolved classification node for this read, or null if unclassified.
  • Constructor Details

    • MatcherReadEntry

      public MatcherReadEntry(int maxReadSizeBytes, boolean withProbs, int paths)
      Creates a read entry with buffers sized for the given number of candidate paths.
      Parameters:
      maxReadSizeBytes - the initial read size in bytes
      withProbs - whether quality/probability information is processed
      paths - the maximum number of candidate taxonomic paths
  • Method Details

    • printChar

      public void printChar(char c)
      Appends a single character (as a byte) to the output buffer.
      Parameters:
      c - the character to append
    • printString

      public void printString(String s)
      Appends the bytes of the given string to the output buffer.
      Parameters:
      s - the string to append
    • growPrintBuffer

      protected void growPrintBuffer(int additionalSize)
      Ensures the output buffer has room for at least additionalSize more bytes, allocating or doubling it as needed.
      Parameters:
      additionalSize - the number of additional bytes that must fit
    • printInt

      public void printInt(int value)
      Appends the decimal representation of the given integer to the output buffer.
      Parameters:
      value - the integer value to append
    • writeMatchDetails

      public void writeMatchDetails(OutputStream out) throws IOException
      Writes this read's Kraken-style classification line to the given stream: the classified/unclassified flag, read descriptor, assigned tax id, read length and the buffered per-segment output.
      Parameters:
      out - the stream to write the classification line to
      Throws:
      IOException - if writing to the stream fails