call module

class mavis.validate.call.EventCall(b1, b2, source_evidence, event_type, call_method, break2_call_method=None, contig=None, contig_alignment=None, untemplated_seq=None)[source]

Bases: mavis.breakpoint.BreakpointPair

class for holding evidence and the related calls since we can’t freeze the evidence object directly without a lot of copying. Instead we use call objects which are basically just a reference to the evidence object and decisions on class, exact breakpoints, etc

Parameters:
  • evidence (Evidence) – the evidence object we are calling based on
  • event_type (SVTYPE) – the type of structural variant
  • breakpoint_pair (BreakpointPair) – the breakpoint pair representing the exact breakpoints
  • call_method (CALL_METHOD) – the way the breakpoints were called
  • contig (Contig) – the contig used to call the breakpoints (if applicable)
add_break1_split_read(read)[source]
Parameters:read (pysam.AlignedSegment) – putative split read supporting the first breakpoint
add_break2_split_read(read)[source]
Parameters:read (pysam.AlignedSegment) – putative split read supporting the second breakpoint
add_flanking_support(flanking_pairs, is_compatible=False)[source]

counts the flanking read-pair support for the event called. The original source evidence may have contained evidence for multiple events and uses a larger range so flanking pairs here are checked specifically against the current breakpoint call

Returns:
  • set of str - set of the read query_names
  • int - the median insert size
  • int - the standard deviation (from the median) of the insert size
Return type:tuple

see theory - determining flanking support

add_spanning_read(read)[source]
Parameters:read (pysam.AlignedSegment) – putative spanning read
break1_tgt_align_split_read_names()[source]
break2_tgt_align_split_read_names()[source]
flanking_metrics()[source]

computes the median and standard deviation of the flanking pairs. Note that standard deviation is calculated wrt the median and not the average. Also that the fragment size is calculated as a range so the start and end of the range are used in computing these metrics

Returns:
  • float - the median fragment size
  • float - the fragment size standard deviation wrt the median
Return type:tuple
flatten()[source]
get_bed_repesentation()[source]
has_compatible

bool – True if compatible flanking pairs are appropriate to collect

linking_split_read_names()[source]
support()[source]
mavis.validate.call.call_events(source_evidence)[source]

generates a set of event calls based on the evidence associated with the source_evidence object will also narrow down the event type

Parameters:
  • source_evidence (Evidence) – the input evidence
  • event_type (SVTYPE) – the type of event we are collecting evidence for
Returns:

list of calls

Return type:

list of EventCall

mavis.validate.call.distance(start, end)[source]
mavis.validate.call.filter_consumed_pairs(pairs, consumed_reads)[source]

given a set of read tuples, returns all tuples where neither read in the tuple is in the consumed set

Parameters:
Returns:

set of filtered tuples

Return type:

set of tuples of pysam.AlignedSegment and pysam.AlignedSegment

Note

this will work with any hash-able object

Example

>>> pairs = {(1, 2), (3, 4), (5, 6)}
>>> consumed_reads = {1, 2, 4}
>>> filter_consumed_pairs(pairs, consumed_reads)
{(5, 6)}
mavis.validate.call.traverse(start, distance, orientation)[source]