Skip to content

Commit

Permalink
Quick hacky version hard-coding metadata filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromekelleher committed Sep 27, 2024
1 parent 7fd5b44 commit 02f8697
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion sc2ts/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,12 @@ def extend(
f"mutations={base_ts.num_mutations};date={base_ts.metadata['sc2ts']['date']}"
)

metadata_matches = list(metadata_db.get(date))
additional_metadata_clause = None
# Quick hack
if date > "2020-03-01":
additional_metadata_clause = "Viridian_cons_het == '0' AND Viridian_cons_het != '.'"

metadata_matches = list(metadata_db.get(date, additional_metadata_clause))

logger.info(f"Got {len(metadata_matches)} metadata matches")
# first check for samples that are in the alignment_store
Expand Down
5 changes: 4 additions & 1 deletion sc2ts/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ def query(self, sql, args=None):
for row in self.conn.execute(sql):
yield row

def get(self, date):
def get(self, date, additional_clause=None):
sql = "SELECT * FROM samples WHERE date==?"
if additional_clause is not None:
sql = f"{sql} AND {additional_clause}"
with self.conn:
logger.debug(f"Running {sql}")
for row in self.conn.execute(sql, [date]):
yield row

Expand Down

0 comments on commit 02f8697

Please sign in to comment.