Skip to content

mavis/validate/gather

Module which contains functions related to picking reads from a BAM file which support a putative event

collect_split_read()

adds a split read if it passes the criteria filters and raises a warning if it does not

def collect_split_read(evidence_bpp: Evidence, read: pysam.AlignedSegment, first_breakpoint: bool):

Args

  • evidence_bpp (Evidence)
  • read (pysam.AlignedSegment): the read to add
  • first_breakpoint (bool): add to the first breakpoint (or second if false)

Returns

  • bool: - True: the read was collected and stored in the current evidence object - False: the read was not collected

Raises

collect_flanking_pair()

checks if a given read meets the minimum quality criteria to be counted as evidence as stored as support for this event

def collect_flanking_pair(
    evidence_bpp: Evidence, read: pysam.AlignedSegment, mate: pysam.AlignedSegment
):

Args

  • evidence_bpp (Evidence)
  • read (pysam.AlignedSegment): the read to add
  • mate (pysam.AlignedSegment): the mate

Returns

  • bool: - True: the pair was collected and stored in the current evidence object - False: the pair was not collected

Raises

collect_compatible_flanking_pair()

checks if a given read meets the minimum quality criteria to be counted as evidence as stored as support for this event

def collect_compatible_flanking_pair(
    evidence_bpp: Evidence,
    read: pysam.AlignedSegment,
    mate: pysam.AlignedSegment,
    compatible_type: str,
) -> bool:

Args

  • evidence_bpp (Evidence)
  • read (pysam.AlignedSegment): the read to add
  • mate (pysam.AlignedSegment): the mate
  • compatible_type (str): the type we are collecting for

Returns

  • bool: - True: the pair was collected and stored in the current evidence object - False: the pair was not collected

Raises

  • ValueError: if the input reads are not a valid pair

collect_spanning_read()

spanning read: a read covering BOTH breakpoints

This is only applicable to small events. Do not need to look for soft clipped reads here since they will be collected already

def collect_spanning_read(evidence_bpp: Evidence, read: pysam.AlignedSegment):

Args

  • evidence_bpp (Evidence)
  • read (pysam.AlignedSegment): the putative spanning read

Returns

  • bool: - True: the read was collected and stored in the current evidence object - False: the read was not collected

load_evidence()

open the associated bam file and read and store the evidence does some preliminary read-quality filtering

def load_evidence(evidence_bpp: Evidence):

Args