mavis/annotate/genomic
class Template
inherits BioInterval
class IntergenicRegion
inherits BioInterval
IntergenicRegion.key()
see :func:structural_variant.annotate.base.BioInterval.key
def key(self):
IntergenicRegion.chr()
returns the name of the chromosome that this region resides on
@property
def chr(self):
Args
- self
IntergenicRegion.to_dict()
see :func:structural_variant.annotate.base.BioInterval.to_dict
def to_dict(self):
class Gene
inherits BioInterval
Gene.transcript_priority()
prioritizes transcripts from 0 to n-1 based on best transcript flag and then alphanumeric name sort
def transcript_priority(self, transcript):
Args
- transcript
Warning
Lower number means higher priority. This is to make sort work by default
Gene.transcripts()
list of unspliced transcripts
@property
def transcripts(self) -> List['PreTranscript']:
Args
- self
Returns
- List[PreTranscript]
Gene.translations()
list of translations
@property
def translations(self) -> List[Translation]:
Args
- self
Returns
- List[Translation]
Gene.chr()
returns the name of the chromosome that this gene resides on
@property
def chr(self):
Args
- self
Gene.key()
see :func:structural_variant.annotate.base.BioInterval.key
def key(self):
Gene.get_seq()
gene sequence is always given wrt to the positive forward strand regardless of gene strand
def get_seq(self, reference_genome: ReferenceGenome, ignore_cache: bool = False) -> str:
Args
- reference_genome (ReferenceGenome): dict of reference sequence by template/chr name
- ignore_cache (
bool
): if True then stored sequences will be ignored and the function will attempt to retrieve the sequence using the positions and the input reference_genome
Returns
str
: the sequence of the gene
Gene.spliced_transcripts()
list of transcripts
@property
def spliced_transcripts(self) -> List['Transcript']:
Args
- self
Returns
- List[Transcript]
Gene.to_dict()
see :func:structural_variant.annotate.base.BioInterval.to_dict
def to_dict(self):
class Exon
inherits BioInterval
Exon.transcript()
PreTranscript: the transcript this exon belongs to
@property
def transcript(self):
Args
- self
Exon.donor_splice_site()
the genomic range describing the splice site
@property
def donor_splice_site(self) -> SpliceSite:
Args
- self
Returns
Exon.acceptor_splice_site()
the genomic range describing the splice site
@property
def acceptor_splice_site(self) -> SpliceSite:
Args
- self
Returns
Exon.donor()
returns the genomic exonic position of the donor splice site
@property
def donor(self) -> int:
Args
- self
Returns
int
Exon.acceptor()
returns the genomic exonic position of the acceptor splice site
@property
def acceptor(self) -> int:
Args
- self
Returns
int
class PreTranscript
inherits BioInterval
PreTranscript.__init__()
creates a new transcript object
def __init__(
self,
exons: List[Exon],
gene: Optional[Gene] = None,
name: Optional[str] = None,
strand: Optional[str] = None,
spliced_transcripts: Optional[List['Transcript']] = None,
seq: Optional[str] = None,
is_best_transcript: bool = False,
):
Args
- exons (List[Exon]): list of Exon that make up the transcript
- gene (Optional[Gene]): the gene this transcript belongs to
- name (
Optional[str]
): name of the transcript - strand (
Optional[str]
): strand the transcript is on, defaults to the strand of the Gene if not specified - spliced_transcripts (Optional[List[Transcript]])
- seq (
Optional[str]
): unspliced cDNA seq - is_best_transcript (
bool
)
PreTranscript.generate_splicing_patterns()
returns a list of splice sites to be connected as a splicing pattern
def generate_splicing_patterns(self) -> List[SplicingPattern]:
Returns
- List[SplicingPattern]: List of positions to be spliced together
PreTranscript.gene()
Gene: the gene this transcript belongs to
@property
def gene(self):
Args
- self
PreTranscript.convert_genomic_to_nearest_cdna()
converts a genomic position to its cdna equivalent or (if intronic) the nearest cdna and shift
def convert_genomic_to_nearest_cdna(
self, pos: int, splicing_pattern: SplicingPattern, stick_direction=None, allow_outside=True
) -> Tuple[int, int]:
Args
- pos (
int
): the genomic position - splicing_pattern (SplicingPattern): the splicing pattern
- stick_direction
- allow_outside
Returns
Tuple[int, int]
: the exonic cdna position and the intronic shift
PreTranscript.exon_number()
exon numbering is based on the direction of translation
def exon_number(self, exon: Exon) -> int:
Args
- exon (Exon): the exon to be numbered
Returns
int
: the exon number (1 based)
Raises
AttributeError
: if the strand is not given or the exon does not belong to the transcript
PreTranscript.translations()
list of translations associated with this transcript
@property
def translations(self) -> List[Translation]:
Args
- self
Returns
- List[Translation]
PreTranscript.transcripts()
list of spliced transcripts
@property
def transcripts(self) -> List['Transcript']:
Args
- self
Returns
- List[Transcript]
class Transcript
inherits BioInterval
Attributes
- reference_object (PreTranscript)
Transcript.__init__()
splicing pattern is given in genomic coordinates
def __init__(
self,
pre_transcript: PreTranscript,
splicing_patt: SplicingPattern,
seq: Optional[str] = None,
translations: Optional[List[Translation]] = None,
):
Args
- pre_transcript (PreTranscript): the unspliced transcript
- splicing_patt (SplicingPattern): the list of splicing positions
- seq (
Optional[str]
): the cdna sequence - translations (Optional[List[Translation]]): the list of translations of this transcript
Transcript.unspliced_transcript()
the unspliced transcript this splice variant belongs to
@property
def unspliced_transcript(self) -> PreTranscript:
Args
- self
Returns