seismicrna.relate.py package

Subpackages

Submodules

class seismicrna.relate.py.ambindel.Deletion(opposite: int, lateral3: int, pod: IndelPod)

Bases: Indel

lateral3
opposite
pod
try_move(rels: dict[int, int], pods: list[IndelPod], insert3: bool, ref_seq: str, read_seq: str, read_qual: str, min_qual: str, ref_end5: int, ref_end3: int, read_end5: int, read_end3: int, move5to3: bool)

Try to move the indel a step in one direction.

class seismicrna.relate.py.ambindel.DeletionPod

Bases: IndelPod

classmethod indel_type()

All indels in the pod must be of this type.

indels: list[Indel]
class seismicrna.relate.py.ambindel.Indel(opposite: int, lateral3: int, pod: IndelPod)

Bases: ABC

Insertion or Deletion.

get_lateral(insert3: bool)
lateral3
property lateral5
move(opposite: int, lateral3: int)

Move the indel to a new position.

opposite
pod
abstract try_move(rels: dict[int, int], pods: list[IndelPod], insert3: bool, ref_seq: str, read_seq: str, read_qual: str, min_qual: str, ref_end5: int, ref_end3: int, read_end5: int, read_end3: int, move5to3: bool) bool

Try to move the indel a step in one direction.

class seismicrna.relate.py.ambindel.IndelPod

Bases: ABC

add(indel: Indel)

Add an indel to the pod, performing validation.

get_indel_by_opp(opposite: int)

Return the indel that lies opposite the given position (opposite), or None if such an indel does not exist.

abstract classmethod indel_type() type[Indel]

All indels in the pod must be of this type.

indels: list[Indel]
sort()

Sort the indels in the pod by their positions.

class seismicrna.relate.py.ambindel.Insertion(opposite: int, lateral3: int, pod: IndelPod)

Bases: Indel

lateral3
opposite
pod
try_move(rels: dict[int, int], pods: list[IndelPod], insert3: bool, ref_seq: str, read_seq: str, read_qual: str, min_qual: str, ref_end5: int, ref_end3: int, read_end5: int, read_end3: int, move5to3: bool)

Try to move the indel a step in one direction.

class seismicrna.relate.py.ambindel.InsertionPod

Bases: IndelPod

classmethod indel_type()

All indels in the pod must be of this type.

indels: list[Indel]
seismicrna.relate.py.ambindel.calc_lateral5(lateral3: int)
seismicrna.relate.py.ambindel.find_ambindels(rels: dict[int, int], pods: list[IndelPod], insert3: bool, ref_seq: str, read_seq: str, read_qual: str, min_qual: str, ref_end5: int, ref_end3: int, read_end5: int, read_end3: int)
seismicrna.relate.py.ambindel.get_ins_rel(insert3: bool)
seismicrna.relate.py.ambindel.get_lateral(lateral3: int, insert3: int)
seismicrna.relate.py.cigar.op_consumes_read(op: str)

Whether the CIGAR operation consumes the read.

seismicrna.relate.py.cigar.op_consumes_ref(op: str)

Whether the CIGAR operation consumes the reference.

seismicrna.relate.py.cigar.parse_cigar(cigar_string: str)

Yield the fields of a CIGAR string as pairs of (operation, length), where operation is 1 byte indicating the CIGAR operation and length is a positive integer indicating the number of bases from the read that the operation consumes. Note that in the CIGAR string itself, each length precedes its corresponding operation.

Parameters:

cigar_string (bytes) – CIGAR string from a SAM file. For full documentation, refer to https://samtools.github.io/hts-specs/

Yields:
  • bytes (length = 1) – Current CIGAR operation

  • int (≥ 1) – Length of current CIGAR operation

seismicrna.relate.py.encode.encode_relate(ref_base: str, read_base: str, read_qual: str, min_qual: str)

Encode the relationship between a base in the read and a base in the reference sequence.

Parameters:
  • ref_base (DNA) – Base in the reference sequence.

  • read_base (DNA) – Base in the read sequence.

  • read_qual (str) – ASCII encoding for the Phred quality score of the read base.

  • min_qual (str) – Minimum value of read_qual to not call the relation ambiguous.

seismicrna.relate.py.encode.is_acgt(base: str)

Check whether a character is a standard DNA base.

exception seismicrna.relate.py.error.RelateError

Bases: RuntimeError

Any error that occurs during the relate algorithm.

class seismicrna.relate.py.relate.SamFlag(flag: int)

Bases: object

Represents the set of 12 boolean flags for a SAM record.

flag
paired
proper
read1
read2
rev
class seismicrna.relate.py.relate.SamRead(line: str)

Bases: object

One read in a SAM file.

cigar
flag
mapq
name
pos
quals
ref
seq
seismicrna.relate.py.relate.calc_rels_lines(line1: str, line2: str, ref: str, refseq: str, min_mapq: int, min_qual: int, insert3: bool, ambindel: bool, overhangs: bool, clip_end5: int = 0, clip_end3: int = 0)
seismicrna.relate.py.relate.merge_mates(end5f: int, end3f: int, relsf: dict[int, int], end5r: int, end3r: int, relsr: dict[int, int], overhangs: bool)