def check_integrity(self):
from subprocess import check_output
reads = 0
try:
p = check_output("samtools view -c %s" % self.path, shell=True)
reads = int(p.split("\n")[0].strip())
except Exception as e:
print e
pass
has_index = False
has_indate_index = None
if os.path.exists(self.path + ".bai"):
has_index = True
if os.path.getmtime(self.path) <= os.path.getmtime(self.path + ".bai"):
has_indate_index = True
else:
has_indate_index = False
return {
("has_reads", "has 0 reads"): reads > 0,
("has_index", "has no BAI"): has_index,
("has_indate_index", "has a BAI older than itself"): has_indate_index,
}
评论列表
文章目录