-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecks.py
47 lines (30 loc) · 1.01 KB
/
checks.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
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
import glob
def readsNumber(fastq_file):
f=open(fastq_file,"r")
lines=f.readlines()
numberOfLines=len(lines)//4
return str(numberOfLines)
def readsCount(input_path):
print("---Check---")
salida=open(input_path+"reads_counts.txt","w")
fastq_files=(glob.glob(input_path+"/FullDemux/"+"*.fastq"))
fastq_files.sort()
fastq_demux_sum=0
for fastq in fastq_files:
fastq_name=fastq.split("/")[-1][:-6]
reads_count=readsNumber(fastq)
salida.write(fastq_name+"\t"+reads_count+"\n")
fastq_demux_sum = fastq_demux_sum + int(reads_count)
salida.write("suma"+"\t"+str(fastq_demux_sum)+"\n")
sam_files=(glob.glob(input_path+"SAM*"))
sam_sum=0
for sam in sam_files:
sam_name=sam
reads_count=readsNumber(sam)
salida.write(sam_name+"\t"+reads_count+"\n")
sam_sum = sam_sum + int(reads_count)
salida.write("suma"+"\t"+str(sam_sum)+"\n")
salida.write("Porcentaje de perdida de reads:"+"\t"+str(100-(fastq_demux_sum*100/sam_sum))+"\n")
salida.close()
return 0