Skip to content

Commit

Permalink
Merge pull request #150 from griffithlab/fusions
Browse files Browse the repository at this point in the history
Remove reference to secondary coordinates
  • Loading branch information
susannasiebert authored Oct 8, 2024
2 parents e67f53f + f1601c6 commit eb7ccc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion civicpy/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__url__ = 'http://civicpy.org'
__major__ = '3'
__minor__ = '1'
__patch__ = '1'
__patch__ = '2'
__meta_label__ = ''
__short_version__ = "{}.{}".format(__major__, __minor__)
__version__ = "{}.{}".format(__short_version__, __patch__)
Expand Down
14 changes: 6 additions & 8 deletions civicpy/civic.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,7 @@ def is_deletion(self):
return (ref is not None and alt is None) or (ref is not None and alt is not None and len(ref) > len(alt))

def is_valid_for_vcf(self, emit_warnings=False):
if self.coordinates.chromosome2 or self.coordinates.start2 or self.coordinates.stop2:
warning = "Variant {} has a second set of coordinates. Skipping".format(self.id)
elif self.coordinates.chromosome and self.coordinates.start and (self.coordinates.reference_bases or self.coordinates.variant_bases):
if self.coordinates.chromosome and self.coordinates.start and (self.coordinates.reference_bases or self.coordinates.variant_bases):
if self._valid_ref_bases():
if self._valid_alt_bases():
return True
Expand Down Expand Up @@ -2083,11 +2081,11 @@ def _build_coordinate_table(variants):
variant_records.append([chr, start, stop, alt, ref, hash(v)])
else:
continue
start = getattr(c, 'start2', None)
stop = getattr(c, 'stop2', None)
chr = getattr(c, 'chromosome2', None)
if all([start, stop, chr]):
variant_records.append([chr, start, stop, None, None, hash(v)])
#start = getattr(c, 'start2', None)
#stop = getattr(c, 'stop2', None)
#chr = getattr(c, 'chromosome2', None)
#if all([start, stop, chr]):
# variant_records.append([chr, start, stop, None, None, hash(v)])
df = pd.DataFrame.from_records(
variant_records,
columns=['chr', 'start', 'stop', 'alt', 'ref', 'v_hash']
Expand Down
12 changes: 4 additions & 8 deletions civicpy/tests/test_civic.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ def test_bulk_any_search_variants(self):
CoordinateQuery('7', 140453136, 140453137, 'TT')
]
search_results = civic.bulk_search_variants_by_coordinates(sorted_queries, search_mode='any')
assert len(search_results[sorted_queries[0]]) == 19
assert len(search_results[sorted_queries[1]]) >= 19
assert len(search_results[sorted_queries[0]]) == 12
assert len(search_results[sorted_queries[1]]) >= 13

def test_bulk_exact_search_variants(self):
sorted_queries = [
Expand Down Expand Up @@ -390,8 +390,8 @@ def test_bulk_re_search_variants(self):
CoordinateQuery('7', 140453136, 140453137)
]
search_results = civic.bulk_search_variants_by_coordinates(sorted_queries, search_mode='record_encompassing')
assert len(search_results[sorted_queries[0]]) == 19
assert len(search_results[sorted_queries[1]]) == 16
assert len(search_results[sorted_queries[0]]) == 12
assert len(search_results[sorted_queries[1]]) == 9

def test_build38_exact_search_variants(self, v600e):
query = CoordinateQuery('7', 140753336, 140753336, 'T', 'A', 'GRCh38')
Expand Down Expand Up @@ -482,10 +482,6 @@ def test_has_ncit_id(self, v600e_assertion):
LOGGER = logging.getLogger(__name__)

def test_is_valid_for_vcf_warnings(caplog):
fusion_variant = civic.get_variant_by_id(287)
fusion_variant.is_valid_for_vcf(emit_warnings=True)
assert "Variant 287 has a second set of coordinates. Skipping" in caplog.text

incomplete_coordinates_variant = civic.get_variant_by_id(27)
incomplete_coordinates_variant.is_valid_for_vcf(emit_warnings=True)
assert "Incomplete coordinates for variant 27. Skipping." in caplog.text
Expand Down

0 comments on commit eb7ccc4

Please sign in to comment.