Skip to content

Commit

Permalink
fix (bruteForce): MNV combined from two variants located at two adjac…
Browse files Browse the repository at this point in the history
…ent exons should be excluded for circRNA
  • Loading branch information
zhuchcn committed Oct 27, 2023
1 parent 6362444 commit a299f22
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions moPepGen/gtf/GenomicAnnotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ def variant_coordinates_to_gene(self, variant:seqvar.VariantRecord,
ref = variant.ref
if end_gene - start_gene != end - start:
if not (variant.type == 'INDEL' and variant.is_deletion()):
raise ValueError(f'''
The variant is spanning over at least one entire intron with
the type of '{variant.type}'. Don't know how to handle it.
''')
raise ValueError(
'The variant is spanning over at least one entire intron with'
f"the type of '{variant.type}'. Don't know how to handle it."
)
ref = variant.id.split('-')[2]

attrs = copy.copy(variant.attrs)
Expand Down
7 changes: 6 additions & 1 deletion moPepGen/seqvar/VariantRecordPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ def _filter(x):
for record in self[tx_id].transcriptional:
if record.type in exclude_type:
continue
record_gene = self.anno.variant_coordinates_to_gene(record, gene_id)
try:
record_gene = self.anno.variant_coordinates_to_gene(record, gene_id)
except ValueError:
if record.is_merged_mnv():
continue
raise e
if _filter(record_gene):
if return_coord == 'gene':
records.add(record_gene)
Expand Down
2 changes: 1 addition & 1 deletion moPepGen/svgraph/PeptideVariantGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ def jsonfy(self):
variants = set()
for v in cur.variants:
if v.variant.attrs.get('MERGED_MNV'):
variants.update([v.variant.attrs['INDIVIDUAL_VARIANT_IDS']])
variants.update(v.variant.attrs['INDIVIDUAL_VARIANT_IDS'])
else:
variants.add(v.variant.id)
node['variants'] = list(variants)
Expand Down
2 changes: 1 addition & 1 deletion moPepGen/svgraph/ThreeFrameTVG.py
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ def jsonfy(self):
variants = set()
for v in cur.variants:
if v.variant.attrs.get('MERGED_MNV'):
variants.update([v.variant.attrs['INDIVIDUAL_VARIANT_IDS']])
variants.update(v.variant.attrs['INDIVIDUAL_VARIANT_IDS'])
else:
variants.add(v.variant.id)
node['variants'] = list(variants)
Expand Down

0 comments on commit a299f22

Please sign in to comment.