Updating the bam list is a bit trickier than most of us originally thought. Need to ensure that *3* files exist: the .bam, the .bai, and the finished.txt (or else bad things can happen)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5960 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
0f43b10c39
commit
d035d8eb7b
|
|
@ -0,0 +1,30 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
in_list = sys.argv[1]
|
||||
out_list = sys.argv[2]
|
||||
|
||||
inp = open(in_list)
|
||||
out = open(out_list,'w')
|
||||
|
||||
for line in inp.readlines():
|
||||
path = line.strip()
|
||||
#print(path)
|
||||
tries = 0
|
||||
index = path.strip(".bam")+".bai"
|
||||
finished = path.rsplit("/",1)[0]+"/finished.txt"
|
||||
while ( not (os.path.exists(path) and os.path.exists(finished) and os.path.exists(index) ) and tries < 15 ):
|
||||
base = path.rsplit("/",1)[0]
|
||||
vers = base.rsplit("/",1)[1]
|
||||
base = base.rsplit("/",1)[0]
|
||||
bam = path.rsplit("/",1)[1]
|
||||
vers = "v%d" % (int(vers.lstrip("v"))+1)
|
||||
path = "%s/%s/%s" % (base,vers,bam)
|
||||
finished = "%s/%s/%s" % (base,vers,"finished.txt")
|
||||
index = path.strip(".bam")+".bai"
|
||||
#print(path)
|
||||
tries += 1
|
||||
if ( os.path.exists(path) and os.path.exists(finished) and os.path.exists(index) ):
|
||||
out.write(path+"\n")
|
||||
else:
|
||||
print("No filepath on the file system contains bam, index, and finished.txt for entry "+path)
|
||||
Loading…
Reference in New Issue