forked from fjruizruano/ngs-protocols
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbg_count.py
More file actions
executable file
·32 lines (23 loc) · 764 Bytes
/
bg_count.py
File metadata and controls
executable file
·32 lines (23 loc) · 764 Bytes
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
#!/usr/bin/python
import sys
from subprocess import call
print "Usage: bg_count.py ListOfBamFiles Reference"
try:
li = sys.argv[1]
except:
li = raw_input("Introduce List of indexed BAM files: ")
try:
ref = sys.argv[2]
except:
ref = raw_input("Introduce Reference in FASTA format: ")
files = open(li).readlines()
li_bg = []
li_names = []
for file in files:
file = file[:-1]
li_bg.append(file+".bg")
name = file.split(".")
li_names.append(name[0])
call("genomeCoverageBed -bg -ibam %s > %s.bg" % (file,file), shell=True)
call("unionBedGraphs -header -i %s -names %s -g %s -empty > samples1and2.txt" % (" ".join(li_bg), " ".join(li_names), ref+".fai"), shell=True)
call("coverage_seq_bed.py samples1and2.txt", shell=True)