Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __eq__(self, other):
return (
other.__class__ is Transcript and
self.id == other.id and
self.genome == other.genome)
if len(result) < 5 or len(result) > (5 + len(optional_field_names)):
raise ValueError(
"Result is not the expected length: %d" % len(result))
contig, start, end, strand, gene_id = result[:5]
if len(result) > 5:
extra_field_names = [f for f in optional_field_names if f in field_names]
extra_data = dict(zip(extra_field_names, result[5:]))
transcript_name = extra_data.get("transcript_name")
transcript_biotype = extra_data.get("transcript_biotype")
tsl = extra_data.get("transcript_support_level")
if not tsl or tsl == 'NA':
tsl = None
else:
tsl = int(tsl)
self._transcripts[transcript_id] = Transcript(
transcript_id=transcript_id,
transcript_name=transcript_name,
contig=contig,
start=start,
end=end,
strand=strand,
biotype=transcript_biotype,
gene_id=gene_id,
genome=self,
support_level=tsl)
return self._transcripts[transcript_id]
Parameters
----------
variant : Variant
Genomic variant
transcript : Transcript
Transcript we're going to mutate
"""
if not isinstance(variant, Variant):
raise TypeError(
"Expected %s : %s to have type Variant" % (
variant, type(variant)))
if not isinstance(transcript, Transcript):
raise TypeError(
"Expected %s : %s to have type Transcript" % (
transcript, type(transcript)))
# check for non-coding transcripts first, since
# every non-coding transcript is "incomplete".
if not is_coding_biotype(transcript.biotype):
return NoncodingTranscript(variant, transcript)
if not transcript.complete:
return IncompleteTranscript(variant, transcript)
if not overlaps_any_exon(variant, transcript):
return Intronic(variant, transcript)
return infer_exonic_effect(variant, transcript)