phac-nml / staramr

Scans genome contigs against the ResFinder, PlasmidFinder, and PointFinder databases.
Apache License 2.0
120 stars 26 forks source link

Add option to specify database path #200

Open pimarin opened 1 year ago

pimarin commented 1 year ago

Hello, Is there a way to manually add the database folder to plasmidfinder, resfinder and pointfinder ? Using the argument --database i failed to try it. Especially on galaxy we need to bind a data manager (which deal with all version of databases) and I need an entry point to speificy the path.

apetkau commented 1 year ago

Hello @pimarin

You will have to build a separate staramr database first within a particular directory:

staramr db build --dir db

Now, you can use the --database argument with the built database in the db/ directory:

staramr search --database db ...
Leonervin commented 1 year ago

Hi. I am running the following command

staramr search --database staramr_databases/ -o Baumanii barcode05.asm.contigs.fasta --no-exclude-genes 

I am getting the following error. ERROR: error with [blastn -out /tmp/tmpsfc0otw4/

Any ways to solve?

apetkau commented 1 year ago

Hello @Leonervin

Was that the full error message?

I built a new directory with the staramr databases as described above, and I get the error message:

error with [blastn -out /tmp/tmpjahnntev/SRR1952908.fasta.all.resfinder.blast.tsv
...
stderr=FASTA-Reader: Ignoring invalid residues at position(s): On line 44207: 58, 63-66, 68-72

Does this match what you got?

Creating a separate directory with the staramr databases will by default download the latest commits in the ResFinder/PointFinder/PlasmidFinder git repositories. As I do not maintain or have control over those repositories, I cannot guarantee that any commits other than the commits used by the database files distributed with staramr work. I would recommend using the version of the ResFinder/PointFinder/PlasmidFinder databases that are distributed with staramr rather than updating them (i.e., run staramr search without the --database option).

If you instead wish to have the ResFinder/PointFinder/PlasmidFinder databases stored in a separate directory (and use the --database staramr_databases as described above), then I would recommend specifying the particular commits that are used by staramr by default:

# Build database in directory staramr_databases/
staramr db build --dir staramr_databases --resfinder-commit fa32d9a3cf0c12ec70ca4e90c45c0d590ee810bd --pointfinder-commit 8c694b9f336153e6d618b897b3b4930961521eb8 --plasmidfinder-commit c18e08c17a5988d4f075fc1171636e47546a323d

# Search using the database files in the passed directory
staramr search --database staramr_databases/ -o Baumanii barcode05.asm.contigs.fasta --no-exclude-genes 

Those specific commits can be found here for your reference:

https://github.com/phac-nml/staramr/blob/d8370b70b83f08711d53421d10d06a4cee369af5/staramr/databases/AMRDatabasesManager.py#L16-L20

splaisan commented 1 year ago

nice, was looking for it, this could best be added to the doc to be found by others