Skip to content

Commit 9ee2712

Browse files
committed
snp_dist_search_all
1 parent 5cf1f3d commit 9ee2712

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

tb-profiler

-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ algorithm.add_argument('--call_whole_genome',action="store_true",help="Call vari
381381
algorithm.add_argument('--snp_dist',type=int,help="Store variant set and get all samples with snp distance less than this cutoff (experimental feature)")
382382
algorithm.add_argument('--snp_diff_db',type=str,help=argparse.SUPPRESS)
383383
algorithm.add_argument('--snp_diff_no_store',action='store_true',help=argparse.SUPPRESS)
384-
algorithm.add_argument('--snp_dist_search_all',action='store_true',help=argparse.SUPPRESS)
385384
algorithm.add_argument('--no_trim',action="store_true",help="Don't trim files using trimmomatic")
386385
algorithm.add_argument('--no_coverage_qc',action="store_true",help="Don't collect flagstats")
387386
algorithm.add_argument('--no_samclip',action="store_false",help="Don't remove clipped reads from variant calling")

tbprofiler/snp_dists.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ def store(self,result: ProfileResult, vcf_file: str) -> None:
7373
self.conn.commit()
7474
self.diffs = diffs
7575
self.missing = missing
76-
def search(self,result: ProfileResult, vcf_file: str, cutoff: int = 20, snp_dist_search_all: bool = False) -> List[LinkedSample]:
76+
def search(self,result: ProfileResult, vcf_file: str, cutoff: int = 20) -> List[LinkedSample]:
7777
logging.info("Searching for close samples in %s" % self.filename)
78-
if snp_dist_search_all:
79-
self.c.execute("SELECT sample, diffs, missing FROM variants")
80-
else:
81-
self.c.execute("SELECT sample, diffs, missing FROM variants WHERE lineage=?",(result.sub_lineage,))
78+
self.c.execute("SELECT sample, diffs, missing FROM variants WHERE lineage=?",(result.sub_lineage,))
8279
self.diffs,self.missing = extract_variant_set(vcf_file)
8380
sample_dists = []
8481
for s,d,m in tqdm(self.c.fetchall(),desc="Searching for close samples"):
@@ -118,7 +115,7 @@ def run_snp_dists(args: argparse.Namespace,result: ProfileResult) -> None:
118115
lock = f"{dbname}.lock"
119116
with filelock.SoftFileLock(lock):
120117
db = DB(dbname)
121-
linked_samples = db.search(result,input_vcf,args.snp_dist,args.snp_dist_search_all)
118+
linked_samples = db.search(result,input_vcf,args.snp_dist)
122119
if not args.snp_diff_no_store:
123120
db.store(result,input_vcf)
124121
result.linked_samples = [d for d in linked_samples if d.sample!=result.id]

0 commit comments

Comments
 (0)