From f8b8d135baad24054ac0ed492ef4b9374188b7f1 Mon Sep 17 00:00:00 2001 From: Alec Wysoker Date: Mon, 22 Jul 2019 17:09:31 -0400 Subject: [PATCH] Skip entries in genotype matrix that are not in filtered genotype position file This enables a genotype matrix file to contain entries for multiple chromosomes, and still allow a single chromosome to be processed per invocation. --- eigenMT.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eigenMT.py b/eigenMT.py index ccd98c1..898eb5c 100644 --- a/eigenMT.py +++ b/eigenMT.py @@ -74,6 +74,9 @@ def make_gen_dict(GEN_fh, pos_dict): for line in GEN: #Go through each line of the genotype matrix and add line to gen_dict line = line.rstrip().split() + if line[0] not in pos_dict: + # skip entries in genotype matrix that are not on selected chromosome + continue snp = pos_dict[line[0]] genos = np.array(line[1:]) genos[genos == 'NA'] = -1