-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_snp_yield.py
executable file
·36 lines (21 loc) · 1.05 KB
/
get_snp_yield.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/env python
import sys
import re
import os
FastqToTagCount_stdout=sys.argv[1] # e.g. /dataset/gseq_processing/scratch/gbs/200626_D00390_0557_ACECFLANXX/SQ1345.all.cattle.PstI/200626_D00390_0557_ACECFLANXX.SQ1345.all.cattle.PstI.key.PstI.tassel3_qc.FastqToTagCount.stdout
HapMap_hmc=sys.argv[2] # e.g. /dataset/gseq_processing/scratch/gbs/200626_D00390_0557_ACECFLANXX/SQ1345.all.cattle.PstI/hapMap/HapMap.hmc.txt
read_count = 0
with open(FastqToTagCount_stdout,"r") as f:
for record in f:
hit=re.search("^Total number of good barcoded reads=(\d+)$", record.strip())
if hit is not None:
read_count +=float(hit.groups()[0])
snp_count=0
with open(HapMap_hmc,"r") as f:
for record in f:
snp_count += 1
snp_count -= 1
if read_count > 0:
print "%d SNPs<br/> %d good barcoded reads <br/> (%7.3f%%)"%(snp_count, read_count, 100 * ( snp_count / read_count ))
else:
print "read count zero !"