Closed FranckLejzerowicz closed 1 year ago
Hi,
MIDAS2 actually writes the temporary merging chunks into the midas_outdir
(line 37). From the log, what MIDAS2 was doing is to generate the chunks cache of the contig ids for the repgenome. Because this is related to the MIDASDB and only needed to be run once for a given chunksize, I put it under the midas_db
(line 56). Thanks for the issue. I overlooked the potential writing access problem to local MIDASDB. I will update the fix in the next version.
For a quick and dirty fix, we can modify the _get_local_path()
function as following:
def _get_local_path(file_name, db_dir):
""" Append local MIDAS_DB path to file(s) """
if isinstance(file_name, list):
return [os.path.join(db_dir, f"{fn}") for fn in file_name]
if file_name == "chunks_contig_lists":
return os.path.join(`NEW_TEMP_DB`, f"{file_name}"
else:
return os.path.join(db_dir, f"{file_name}")
And replace the new_temp_db
with the absolute path that you would like to place the cache of the repgenome, build and install MIDAS2 locally.
Hope this can solve the problem.
Thanks Chunyu
Yep - that should do and I will let you know ASAP. Thanks for pointing me to the code to edit so quickly - Kudos on a very versatile tool! High hope to cite you soon:)
Hi @zhaoc1,
I have slightly fixed your fix, since file_name
is never "chunks_contig_lists"
.
Indeed, "chunks_contig_lists"
is the key to the dict looked up in get_midasdb_layout() (called from construct_dest_path()), and not the value of this dict, which is returned and fortunately, is the only value starting with temp
.
Hence, I could adapt the fix like so:
def _get_local_path(file_name, db_dir):
""" Append local MIDAS_DB path to file(s) """
if isinstance(file_name, list):
return [os.path.join(db_dir, f"{fn}") for fn in file_name]
if file_name.startswith("temp"):
return os.path.join(os.environ['TMPDIR'], f"{file_name}")
else:
return os.path.join(db_dir, f"{file_name}")
(In my jobs there is a $TMPDIR
variable that does to trick)
And it works!
Thanks again for the neat code it was fun to look at ;) Best Franck
You are very welcome. My memory of the code is a little rusty and appreciate the nice fix!
Hello,
We are running MIDAS2 on our computer cluster, where I was given temporary rights to install the database in a shared location, for many users to enjoy your tool. Then, the admins removed my rights to write in the install location (which also relieves my storage quota ;) ).
The problem is that when running the merge command, MIDAS2 is trying to write chunks at this database location, where a user may not have write access rights.
See below the stderr for the job affected by this (and the command):
Is there a way to tell MIDAS2 to write elsewhere, maybe in a $TMPDIR location?
Thanks! F