From b0422acb5c0948c1c0c429d397889df9b67cf2e3 Mon Sep 17 00:00:00 2001 From: Jason Stajich Date: Tue, 24 Oct 2023 11:14:15 -0700 Subject: [PATCH 1/3] make mask log file unique --- funannotate/mask.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/funannotate/mask.py b/funannotate/mask.py index c87fd80..dba97df 100755 --- a/funannotate/mask.py +++ b/funannotate/mask.py @@ -125,9 +125,8 @@ def __init__(self, prog): args = parser.parse_args(args) # create log file for Repeats(capture stderr) - log_name = 'funannotate-mask.log' - if os.path.isfile(log_name): - os.remove(log_name) + # make this filename unique so multiple mask runs can happen in same folder + log_name = "funannotate-mask." + str(uuid.uuid4())[-8:] + ".log" # initialize script, log system info and cmd issue at runtime lib.setupLogging(log_name) From b2cb2e703549dbe8deeb8ec98e44569f7c6cce4e Mon Sep 17 00:00:00 2001 From: Jason Stajich Date: Tue, 24 Oct 2023 11:22:40 -0700 Subject: [PATCH 2/3] copy the mask file into the log folder --- funannotate/mask.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/funannotate/mask.py b/funannotate/mask.py index dba97df..621a5cf 100755 --- a/funannotate/mask.py +++ b/funannotate/mask.py @@ -127,7 +127,9 @@ def __init__(self, prog): # create log file for Repeats(capture stderr) # make this filename unique so multiple mask runs can happen in same folder log_name = "funannotate-mask." + str(uuid.uuid4())[-8:] + ".log" - + # this next seems unncessary as filenames should be unique but will leave in + if os.path.isfile(log_name): + os.remove(log_name) # initialize script, log system info and cmd issue at runtime lib.setupLogging(log_name) cmd_args = " ".join(sys.argv)+'\n' @@ -195,7 +197,13 @@ def __init__(self, prog): if tmpdir: lib.SafeRemove(tmpdir) print("-------------------------------------------------------") - + if os.path.isfile(log_name): + if not os.path.isdir(os.path.join(outputdir, "logfiles")): + os.makedirs(os.path.join(outputdir, "logfiles")) + shutil.copyfile( + log_name, os.path.join(outputdir, "logfiles", "funannotate-mask.log") + ) + os.remove(log_name) if __name__ == "__main__": main(sys.argv[1:]) From a8955c057f268565e34908d9b6f0604c036662b5 Mon Sep 17 00:00:00 2001 From: Jason Stajich Date: Tue, 24 Oct 2023 11:24:59 -0700 Subject: [PATCH 3/3] no outputdir expected for masking step so nvm --- funannotate/mask.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/funannotate/mask.py b/funannotate/mask.py index 621a5cf..2175ac3 100755 --- a/funannotate/mask.py +++ b/funannotate/mask.py @@ -197,13 +197,6 @@ def __init__(self, prog): if tmpdir: lib.SafeRemove(tmpdir) print("-------------------------------------------------------") - if os.path.isfile(log_name): - if not os.path.isdir(os.path.join(outputdir, "logfiles")): - os.makedirs(os.path.join(outputdir, "logfiles")) - shutil.copyfile( - log_name, os.path.join(outputdir, "logfiles", "funannotate-mask.log") - ) - os.remove(log_name) if __name__ == "__main__": main(sys.argv[1:])