Closed sjfleck closed 1 year ago
Hi sjfleck! Thanks for reporting this. The lines above are generated by i-ADHoRe. Even though they are considered a warning, i-ADHoRe handles them in its code as an error and thus ksrates does the same, stopping the workflow. I believe however that the warnings above are not really a reason to exit, especially if they are only a few lines. I previously made a workaround to avoid that ksrates exists at that point, but it's not the most elegant solution and I haven't implemented it yet. I'll show it here below, and I could implement it in the next days. Basically, if the i-ADHoRe error message starts with "warning" it is tolerated, else ksrates exits.
In module fc_wgd.py
, function _run_iadhore
, I would add a few lines to tolerate such situation (see long comment in function below).
The lines generating the message in i-ADHoRe are by the way here.
Thanks a lot, let me know should you have any feedback. Cecilia
def _run_iadhore(config_file):
"""
Modified from wgd/colinearity.py
Run i-ADHoRe for a given config file.
:param config_file: path to i-ADHoRe configuration file
"""
command = ['i-adhore', config_file]
logging.info(' '.join(command))
try:
sp = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', check=True)
out = sp.stdout.strip()
err = sp.stderr.strip()
if out:
logging.info("i-ADHoRe output:\n" + out)
if err:
# i-ADHoRe can fail without a proper exit/return code, but just with an error on stderr
logging.error("i-ADHoRe execution failed with standard error output:\n" + err)
# Some i-ADHoRe error output is an actual fatal error and the pipeline must be interrupted,
# but there is at least one i-ADHoRe message that is passed as error output ("cerr" in source code)
# that is only a warning (it starts with "Warning:"): this kind of cerr is not supposed
# to interrupt ksrates pipeline! To take this into account, the following if-clause allows any
# i-ADHoRe error output message starting with "Warning" to be tolerated.
if not err.lower().startswith("warning"):
logging.error("Exiting.")
sys.exit(1)
except subprocess.CalledProcessError as e:
logging.error(f"i-ADHoRe execution failed with return code: {e.returncode}")
if e.stderr:
logging.error("i-ADHoRe standard error output:\n" + e.stderr.strip())
logging.error("Exiting.")
sys.exit(e.returncode)
return
This worked! thanks!
I'm currently trying to solve this error:
Any recommendation on how to fix this? Thanks