Skip to content

Commit 171db8b

Browse files
committed
Use Ben's less memory intensive row-filtering for comments
1 parent 3180e6e commit 171db8b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pgscatalog.match/src/pgscatalog/match/cli/intersect_cli.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ def run_intersect():
6161

6262
def read_var_general(path, chrom=None):
6363
with xopen(path, "rt") as f:
64-
# pvars do have a header column and support arbitrary columns
65-
reader = csv.DictReader(filter(lambda row: row[:2]!='##', f), delimiter="\t") # need to remove comments of VCF-like characters
64+
for line in f:
65+
if line.startswith("##"):
66+
continue
67+
else:
68+
fieldnames = line.strip().split("\t")
69+
reader = csv.DictReader(f, fieldnames=fieldnames, delimiter="\t")
6670
if chrom is None:
6771
for row in reader:
6872
yield row

0 commit comments

Comments
 (0)