how do we deal with tools that try to write to dir...
# nostupidquestions
l
how do we deal with tools that try to write to directories that are not writable when working on cluster? I have a python script which uses ete3 to find the species names of some taxids, but it needs to download a taxonomy database before doing that. Locally, the script works great, but when trying to run my pipeline, it fails with this error:
Copy code
Command error:
  NCBI database not present yet (first time used?)
  Traceback (most recent call last):
    File "/home/l/lea-picard/genephylo/bin/rename_seqs.py", line 131, in module
      main()
    File "/home/l/lea-picard/genephylo/bin/rename_seqs.py", line 87, in main
      taxid_to_name = fetch_taxid_to_name_ete3([int(t) for t in taxids_needed if t.isdigit()])
    File "/home/l/lea-picard/genephylo/bin/rename_seqs.py", line 55, in fetch_taxid_to_name_ete3
      ncbi = NCBITaxa()
    File "/usr/local/lib/python3.7/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 112, in __init__
      self.update_taxonomy_database(taxdump_file)
    File "/usr/local/lib/python3.7/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 131, in update_taxonomy_database
      update_db(self.dbfile)
    File "/usr/local/lib/python3.7/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 750, in update_db
      os.mkdir(basepath)
  OSError: [Errno 30] Read-only file system: '/home/l/lea-picard/.etetoolkit'
Is there an "easy" way to deal with this kind of behavior in Nextflow?
j
Uh... @Maxime Borry didn't you at some point fix
ete3
to accept custom non-home locations for databases?
So you should be able to customise that @Lea Picard (leapfroggie_) unless that bit of code as removed?
p
Generally, this is solved by trying to stop what's run see your home directory, e.g. by repointing
HOME
to the your task work directory. (I don't know this tooling, if it expects to store something in the home directory which a later process expects to be there, it needs additional management.)
l
so I tried the solution you pointed me to @James Fellows Yates but it doesn't work and I get this error message:
Copy code
ValueError: Cannot open taxonomy database: /flash/YamamotoU/Lea/work/36/643e4e98b44481dbdaed603b8dc911/taxa.sqlite
Granted, it might be my implementation that's lacking, I've tried:
Copy code
dbpath = f"{args.workdir}/taxa.sqlite"
ncbi = NCBITaxa(dbfile = dbpath)
(args.workdir being the current work directory) it doesn't seem like the database is downloading.
However, repointing the different paths seems to have worked @pontus! I'd tried before but I had not repointed all of the paths the tool assumes so it failed.
Thank you both for your help 🙏