# pbcore.io.align package

## Submodules

## pbcore.io.align.BamAlignment module

class pbcore.io.align.BamAlignment.BamAlignment(bamReader, pysamAlignedRead, rowNumber=None)

  Bases: `pbcore.io.align._AlignmentMixin.AlignmentRecordMixin`

  DeletionQV(aligned=True, orientation='native')
  DeletionTag(aligned=True, orientation='native')
  property HoleNumber
  IPD(aligned=True, orientation='native')
  InsertionQV(aligned=True, orientation='native')
  property MapQV
  MergeQV(aligned=True, orientation='native')
  PulseWidth(aligned=True, orientation='native')
  SubstitutionQV(aligned=True, orientation='native')
  property barcode
  property barcodeName
  baseFeature(featureName, aligned=True, orientation='native')

    Retrieve the base feature as indicated. - aligned : whether gaps should be inserted to reflect the alignment - orientation: “native” or “genomic”

    Note that this function assumes the the feature is stored in native orientation in the file, so it is not appropriate to use this method to fetch the read or the qual, which are oriented genomically in the file.

  clippedTo(refStart, refEnd)

    Return a new BamAlignment that refers to a subalignment of this alignment, as induced by clipping to reference coordinates refStart to refEnd.

    Warning

    This function takes time linear in the length of the alignment.

  property hasPbi
  property hqRegionSnr

    Return the per-channel SNR averaged over the HQ region.

    Note

    This capability was not available in cmp.h5 files, so use of this property can result in code that won’t work on legacy data.

  property identity
  property isCCS
  property isForwardStrand
  property isMapped
  property isReverseStrand
  property isTranscript
  property isUnmapped
  property mapQV
  property movieName
  property numPasses
  property qEnd
  property qId
  property qLen
  property qName
  property qStart
  property queryEnd
  property queryName
  property queryStart
  read(aligned=True, orientation='native')
  property readGroupInfo
  readPositions(aligned=True, orientation='native')

    Returns an array of read positions.

    If aligned is True, the array has the same length as the alignment and readPositions[i] = read position of the i’th column in the oriented alignment.

    If aligned is False, the array has the same length as the mapped reference segment and readPositions[i] = read position of the i’th base in the oriented reference segment.

  property readScore

    Return the “read score”, a de novo prediction (not using any alignment) of the accuracy (between 0 and 1) of this read.

    Note

    This capability was not available in cmp.h5 files, so use of this property can result in code that won’t work on legacy data.

  property readType
  property reader
  reference(aligned=True, orientation='native')
  property referenceId
  property referenceInfo
  property referenceName
  referencePositions(aligned=True, orientation='native')

    Returns an array of reference positions.

    If aligned is True, the array has the same length as the alignment and referencePositions[i] = reference position of the i’th column in the oriented alignment.

    If aligned is False, the array has the same length as the read and referencePositions[i] = reference position of the i’th base in the oriented read.

  property scrapType
  property sequencingChemistry
  property tId
  transcript(orientation='native', style='gusfield')

    A text representation of the alignment moves (see Gusfield). This can be useful in pretty-printing an alignment.

  unrolledCigar(orientation='native')

    Run-length decode the CIGAR encoding, and orient. Clipping ops are removed.

  property zScore

## pbcore.io.align.BamIO module

class pbcore.io.align.BamIO.BamReader(fname, referenceFastaFname=None)

  Bases: `pbcore.io.align.BamIO._BamReaderBase`, `pbcore.io.align._AlignmentMixin.AlignmentReaderMixin`

  Reader for a BAM with a bam.bai (SAMtools) index, but not a bam.pbi (PacBio) index. Supports basic BAM operations.

  property index
  readsInRange(winId, winStart, winEnd, justIndices=False)

class pbcore.io.align.BamIO.IndexedBamReader(fname, referenceFastaFname=None, sharedIndex=None)

  Bases: `pbcore.io.align.BamIO._BamReaderBase`, `pbcore.io.align._AlignmentMixin.IndexedAlignmentReaderMixin`

  A IndexedBamReader is a BAM reader class that uses the `bam.pbi` (PacBio BAM index) file to enable random access by “row number” and to provide access to precomputed semantic information about the BAM records

  atRowNumber(rn)
  property identity

    Fractional alignment sequence identities as numpy array.

  property index
  readsInRange(winId, winStart, winEnd, justIndices=False)

## pbcore.io.align.BlasrIO module

class pbcore.io.align.BlasrIO.M4Reader(f)

  Bases: `pbcore.io.base.ReaderBase`

  Reader for -m 4 formatted alignment summary information from BLASR

class pbcore.io.align.BlasrIO.M4Record

  Bases: `object`

  Record for alignment summary record output from BLASR -m 4 option

  classmethod fromString(s)

class pbcore.io.align.BlasrIO.M5Reader(f)

  Bases: `pbcore.io.base.ReaderBase`

  Reader for -m 5 formatted alignment summary information from BLASR

class pbcore.io.align.BlasrIO.M5Record

  Bases: `object`

  Record for alignment summary record output from BLASR -m 5 option

  classmethod fromString(s)

## pbcore.io.align.PacBioBamIndex module

class pbcore.io.align.PacBioBamIndex.PacBioBamIndex(pbiFilename, chunk_start=None, chunk_size=None, to_virtual_offset=None)

  Bases: `pbcore.io.align.PacBioBamIndex.PbIndexBase`

  The PacBio BAM index is a companion file allowing modest semantic queries on PacBio BAM files without iterating over the entire file. By convention, the PacBio BAM index has extension “bam.pbi”.

  property columnNames
  property hasBarcodeInfo
  property hasCoordinateSortedInfo
  property hasMappingInfo
  property identity
  property isChunk
  rangeQuery(winId, winStart, winEnd)
  property version

## Module contents