@@ -89,7 +89,7 @@ def get_sample_ids(sample_input):
8989 return samples
9090
9191
92- def load_vcf_wrapper (path , seqid , samples ):
92+ def load_vcf_wrapper (path , seqid , samples , samples_path ):
9393
9494 callset = allel .read_vcf (
9595 path ,
@@ -98,8 +98,11 @@ def load_vcf_wrapper(path, seqid, samples):
9898 tabix = "tabix" ,
9999 samples = samples )
100100
101+ assert "samples" in callset .keys (), "None of the samples provided in {0!r} are found in {1!r}" .format (
102+ samples_path , path )
103+
101104 p = allel .SortedIndex (callset ["variants/POS" ])
102- g = allel .GenotypeArray (callset ['calldata/genotype ' ])
105+ g = allel .GenotypeArray (callset ['calldata/GT ' ])
103106
104107 return p , g
105108
@@ -109,8 +112,8 @@ def load_vcf_format_data(vcf_fn, chrom, s1, s2, gdistkey=None):
109112 # geno1, geno2, pos = q, q, q
110113 samples1 = get_sample_ids (s1 )
111114 samples2 = get_sample_ids (s2 )
112- pos1 , geno1 = load_vcf_wrapper (vcf_fn , chrom , samples1 )
113- pos2 , geno2 = load_vcf_wrapper (vcf_fn , chrom , samples2 )
115+ pos1 , geno1 = load_vcf_wrapper (vcf_fn , chrom , samples1 , s1 )
116+ pos2 , geno2 = load_vcf_wrapper (vcf_fn , chrom , samples2 , s2 )
114117
115118 assert np .array_equal (pos1 , pos2 ), "POS fields not the same"
116119 assert geno1 .shape [0 ] == pos1 .shape [0 ], "For samples 1, genotypes do not match positions"
0 commit comments