Skip to content

allow offline usage#72

Open
EricDeveaud wants to merge 1 commit intoUMNFuN:masterfrom
EricDeveaud:master
Open

allow offline usage#72
EricDeveaud wants to merge 1 commit intoUMNFuN:masterfrom
EricDeveaud:master

Conversation

@EricDeveaud
Copy link
Copy Markdown

Hello

I was asked to install FUNGuild on our cluster.

as our cluster does not allow compute nodes to access internet I want to propose a PR that enable FUNGuild to work from local saved databases.

this PR add to FUNGuild 2 new options.
*) --download that downloads the databases to FUNGuild_db directory located at the same level than Guilds_v1.1.py (or any other directory specified by FUNGUILD_DB environnement variable
obviously this step need to be run from a node that can connect to internet

*) --local that turns Guilds_v1.1.py to use local databases previously saved.

see an example of usage

  1. download DBs from internet connected node to default db_dir location:
maestro-builder:pull-request/FUNGuild > python Guilds_v1.1.py --download                    
Download DBs to /home/edeveaud/Work/pull-request/FUNGuild/FUNGuild_db
downloading http://www.stbates.org/funguild_db_2.php	 OK
downloading http://www.stbates.org/nemaguild_db.php	 OK
  1. download DBs from internet connected node to default db_dir location superseeded by FUNGUILD_DB environnement variable:
maestro-builder:pull-request/FUNGuild > FUNGUILD_DB=/tmp/db python Guilds_v1.1.py --download
Download DBs to /tmp/db
downloading http://www.stbates.org/funguild_db_2.php	 OK
downloading http://www.stbates.org/nemaguild_db.php	 OK
  1. work with dowloaded DBs from default db_dir location on non network context. simukated using unshare -n
maestro-builder:pull-request/FUNGuild > sudo unshare -n  python  Guilds_v1.1.py -otu example/otu_table.txt  --local                   
FunGuild v1.1 Beta
Connecting with FUNGuild database ... file:///home/edeveaud/Work/pull-request/FUNGuild/FUNGuild_db/funguild_db_2.php

Reading in the OTU table: 'example/otu_table.txt'

Searching the FUNGuild database...
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%

Found 12 matching taxonomy records in the database.
Dereplicating and sorting the result...
FunGuild tried to assign function to 10 OTUs in 'example/otu_table.txt'.
FUNGuild made assignments on 6 OTUs.
Result saved to 'example/otu_table.guilds.txt'

Total calculating time: 0.15 seconds.

same applies with overwritting db_dir using FUNGUILD_DB environnement varaible.

I have a question regarding the Databases, how regularly are they upsdated ?
is there some notification when they are ?

regards

Eric

add download databases option
@EricDeveaud
Copy link
Copy Markdown
Author

EricDeveaud commented Dec 1, 2022

hummmm sorry a small error.

a more robust way of handling the env var will be to change
DB_DIR=os.environ.get('FUNGUILD_DB', os.path.abspath(os.path.join(os.path.dirname(__file__), 'FUNGuild_db')))

to
DB_DIR=os.path.abspath(os.environ.get('FUNGUILD_DB', os.path.join(os.path.dirname(__file__), 'FUNGuild_db')))

this will allow FUNGUILD_DB=<some_relative_path> and avoid an error in such situation.

regards

Eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant