INNER CODE UNIT · Python
generate_gfa_file
Gabaldonlab/redundans · redundans.py:153
def generate_gfa_file(file, threads="4"):
"""Return a gfa file generated using gfastats"""
# First process the filename to add the new extension
abs_path_gfa = os.path.abspath(re.sub(".fa", ".gfa", file))
with open(abs_path_gfa, "wb") as f:
args1 = ["gfastats", "-f", file, "--threads", str(threads), "-o", "gfa"]
proc1 = subprocess.Popen(args1, stderr=subprocess.DEVNULL, stdout=f)
proc1.communicate()
if os.path.exists(abs_path_gfa):
return True
else:
return False