INNER CODE UNIT · Python
_corrupted_file
Gabaldonlab/redundans · redundans.py:463
def _corrupted_file(fname):
"""Return True if output file doesn't exists or is corrupted."""
if (
not os.path.isfile(fname)
or not os.path.getsize(fname)
or not os.path.isfile(fname + ".fai")
or not os.path.getsize(fname + ".fai")
):
return True
def _check_fasta(lastOutFn, minSize=1000, log=sys.stderr):
"""Exit if empty FastA file"""
faidx = FastaIndex(open(lastOutFn))
if not len(faidx) or faidx.genomeSize < minSize:
log.write("[ERROR] Empty FastA file encountered: %s !\n" % lastOutFn)
sys.exit(1)