rectify sfs comp

master
tforest 2021-10-19 10:43:58 +02:00
parent 0e25049a58
commit a7490aed15
1 changed files with 18 additions and 6 deletions

View File

@ -38,13 +38,25 @@ with gzip.open(sys.argv[1], "rb") as inputgz:
smpl_genotype = [int(a) for a in sample.split(':')[0].split('/') if a != '.']
nb_alleles = set(smpl_genotype)
snp_genotypes += smpl_genotype
if len(set(snp_genotypes)) == 1:
line = inputgz.readline()
continue
#print(snp_genotypes)
for k in set(snp_genotypes):
allele_counts[snp_genotypes.count(k)] = k
if 7 in allele_counts.keys():
print(allele_counts)
#print(allele_counts)
if folded :
for count in allele_counts.keys():
if count <= len(snp_genotypes)/2 :
SFS_values[count-1] += 1
else:
SFS_values[len(snp_genotypes)-count] += 1
#for count in allele_counts.keys():
# for count in allele_counts.keys():
# if count <= len(snp_genotypes)/2 :
# SFS_values[count-1] += 1
# else:
# SFS_values[len(snp_genotypes)-count-1] += 1
SFS_values[min(allele_counts.keys())-1] += 1
line = inputgz.readline()
print(SFS_values)
#print(SFS_values)
# Note : tout est doublé là