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

Dev min dist fix #25

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 0 additions & 2 deletions genomic_address_service/classes/assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self,dist_file,membership_file,threshold_map,linkage_method,address
self.assignments = {}
self.nomenclature_cluster_tracker = {}
self.query_ids = set()

if not linkage_method in self.avail_methods:
self.status = False
self.error_msgs.append(f'Provided {linkage_method} is not one of the accepted {self.avail_methods}')
Expand Down Expand Up @@ -221,7 +220,6 @@ def assign(self, n_records=1000,delim="\t"):
if value is None:
query_addr[idx] = self.nomenclature_cluster_tracker[rank_ids[idx]]
self.nomenclature_cluster_tracker[rank_ids[idx]]+=1

break

self.memberships_dict[qid] = ".".join([str(x) for x in query_addr])
10 changes: 6 additions & 4 deletions genomic_address_service/classes/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def read_pd(self):
continue
qid = line[0]
rid = line[1]

d = float(line[2])
#print(f'{qid} {rid} {d}')
Copy link
Contributor

Choose a reason for hiding this comment

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

Guessing this a vestige of testing

if qid not in self.record_ids and len(self.dists) >= self.n_records:
self.sort_distances()
yield self.dists
Expand All @@ -69,6 +71,7 @@ def read_pd(self):
if d > self.max_dist:
continue
self.dists[qid][rid] = d
yield self.dists
self.sort_distances()


Expand All @@ -95,9 +98,6 @@ def read_matrix(self):
rid = self.header[i]
d = values[i]
if self.filter:
if self.min_dist is not None:
if d < self.min_dist:
continue
if self.max_dist is not None:
if d > self.max_dist:
continue
Expand All @@ -114,6 +114,7 @@ def read_data(self):
self.header = next(self.file_handle).split(self.delim)
elif ftype == 'parquet':
self.file_handle = ParquetFile(self.fpath)

if ftype == 'text' and dist_type == 'pd':
for chunk in self.read_pd():
if chunk is not None:
Expand All @@ -126,7 +127,8 @@ def read_data(self):
yield chunk
if chunk is None:
chunk = self.dists
yield chunk

return chunk



Expand Down