From 2481f393354a68229ac96ab3d1e8e7db41c124c5 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 8 Oct 2024 09:13:39 -0500 Subject: [PATCH 1/2] Remove reference to secondary coordinates --- civicpy/civic.py | 14 ++++++-------- civicpy/tests/test_civic.py | 12 ++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/civicpy/civic.py b/civicpy/civic.py index 6562352..1362a48 100644 --- a/civicpy/civic.py +++ b/civicpy/civic.py @@ -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 @@ -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'] diff --git a/civicpy/tests/test_civic.py b/civicpy/tests/test_civic.py index d43d34f..368820d 100644 --- a/civicpy/tests/test_civic.py +++ b/civicpy/tests/test_civic.py @@ -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 = [ @@ -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') @@ -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 From f1601c60ee297c7212417e4c4d2ca89ae4c3e93d Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Tue, 8 Oct 2024 09:14:11 -0500 Subject: [PATCH 2/2] Update version --- civicpy/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/civicpy/__version__.py b/civicpy/__version__.py index 6b5bec6..5d31d7e 100644 --- a/civicpy/__version__.py +++ b/civicpy/__version__.py @@ -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__)