コード例 #1
0
    def bySite(self):

        for row in vcf_iter(self.FileObject):
            yield row
コード例 #2
0
key = args[0]
filename = args[1]

names1 = []
names2 = []

for k in open(filename, 'r'):
    ksplit = k.rstrip().split(":")
    if ksplit[0] == key:
        if ksplit[1] == "case":
            names1 += ksplit[2].split(",")
        elif ksplit[1] == "control":
            names2 += ksplit[2].split(",")

for row in vcf_iter(sys.stdin):
            
    pop1 = list((row[ind1]['GT'] for ind1 in names1 if row[ind1]['GT'] != './.' and row[ind1]['DP'] > 7))
    pop2 = list((row[ind2]['GT'] for ind2 in names2 if row[ind2]['GT'] != './.' and row[ind2]['DP'] > 7))

    n1 = len(pop1)
    n2 = len(pop2)

    hom1 = pop1.count('0/0')
    het1 = pop1.count('0/1')
    alt1 = pop1.count('1/1')

    hom2 = pop2.count('0/0')
    het2 = pop2.count('0/1')
    alt2 = pop2.count('1/1')
コード例 #3
0
ファイル: vcf2n.py プロジェクト: padraicc/Evolib
#startB = time.time()

#clB = TestB()
#for j in xrange(10000):
#    clB.init_string = str(j)

#print time.time() - startB
######
# iter population sample

# need direct access to name of each sample from

######

vcfstream = vcf_iter(sys.stdin)
#vcfstream = vcf_iter4(sys.stdin)

#for line in sys.stdin:
#    #if line.startswith('#') is False:
#    if line[0] != '#':
#        values = line.rstrip().split('\t')
#        chrom = values[0]
#    elif line[:2] == '##':
#        pass
#    else:
#        pass

inc_chr = sys.argv[1].split(',')

for row in vcfstream:
コード例 #4
0
ファイル: vcf2n.py プロジェクト: mspopgen/Evolib
    
#startB = time.time()

#clB = TestB()
#for j in xrange(10000):
#    clB.init_string = str(j)
    
#print time.time() - startB
######
# iter population sample

# need direct access to name of each sample from 

######

vcfstream = vcf_iter(sys.stdin)
#vcfstream = vcf_iter4(sys.stdin)

#for line in sys.stdin:
#    #if line.startswith('#') is False:
#    if line[0] != '#':
#        values = line.rstrip().split('\t')
#        chrom = values[0]
#    elif line[:2] == '##':
#        pass
#    else:
#        pass

inc_chr = sys.argv[1].split(',')

for row in vcfstream:
コード例 #5
0
ファイル: NGSFormats.py プロジェクト: mspopgen/Evolib
 def bySite(self):
     
     for row in vcf_iter(self.FileObject):
         yield row