Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reference to secondary coordinates #150

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to comment this out rather than just deleting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a reminder to myself to put something similar back in its place once we have fusion support added.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, good to leave it in then!

#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
Loading