WrightonLabCSU / DRAM

Distilled and Refined Annotation of Metabolism: A tool for the annotation and curation of function for microbial and viral genomes
GNU General Public License v3.0
239 stars 50 forks source link

DRAM database config should be accessible / configurable by users #208

Closed gregvonkuster closed 1 year ago

gregvonkuster commented 1 year ago

The DRAM database config file is restricted from users - it is written and maintained fully within the DRAM code (e.g., https://github.com/WrightonLabCSU/DRAM/blob/a5f225718c5ff312ec8ccaefbb61daaa12452705/mag_annotator/database_handler.py#L28-L33).

Storing / maintaining the config file in the DRAM installation directory (e.g., ~/_conda/envs/__dram@1.3.5/lib/python3.10/site-packages/...) does not work for all installations, and is most difficult when installed on HPC cluster environments.

More difficulties arise because the DRAM-setup.py set_database_locations script requires the database to be actually located in the "new" location prior to the script being run.

Making the config file a simple text file (e.g., xml, yaml, etc) that the user can edit would make DRAM installations much easier to maintain. It would also likely eliminate many of the open issues related to the config file (e.g., https://github.com/WrightonLabCSU/DRAM/issues/196, https://github.com/WrightonLabCSU/DRAM/issues/171, https://github.com/WrightonLabCSU/DRAM/issues/157, https://github.com/WrightonLabCSU/DRAM/issues/152, etc).

rmFlynn commented 1 year ago

An option to specify a config file at run time is already in dram1.4 and will be available in the coming weeks.

gregvonkuster commented 1 year ago

Awesome! Thanks!

Aiswarya-prasad commented 1 year ago

Are we now able to specify a config file?

rmFlynn commented 1 year ago

@Aiswarya-prasad if you have upgraded to DRAM1.4 then yes use --help to see all options but to check version use DRAM-setup.py version to specify the config use --config_loc with DRAM.py or DRAM-v.py or set the environment variable DRAM_CONFIG_LOCATION.

Aiswarya-prasad commented 1 year ago

Great. Where will I find the documentation detailing how the config file must be formatted? I see the following warning using this option (v1.4.0)

/scratch/aprasad/built-envs/358e2aba62b05c15419547f98620f6d9/lib/python3.10/site-packages/mag_annotator/database_handler.py:74: UserWarning: The DRAM version in your config is empty. This may not be a problem, but if this import fails then you should check that the origin of the file is valid.
  warnings.warn("The DRAM version in your config is empty."
/scratch/aprasad/built-envs/358e2aba62b05c15419547f98620f6d9/lib/python3.10/site-packages/mag_annotator/database_handler.py:136: UserWarning: Database does not exist at path None
  warnings.warn('Database does not exist at path %s' % self.config.get('description_db'))
rmFlynn commented 1 year ago

Well, you can get the empty config here: https://github.com/WrightonLabCSU/DRAM/blob/master/mag_annotator/CONFIG

That said, most people would probably be making new configs with dram1.4 and exporting them. The warnings seem to be clipped, but if you are using a config from a past version of dram, then that error should tell you that it is older and everything should be fine. The description db is a problem, this could be an incomplete setup run. In any case, DRAM-setup.py --update_descriptiondb will fix that, it may be a slightly different command I am pulling that from memory.