The application identifies plasmids in total or partial sequenced isolates of bacteria.
Project description
PlasmidFinder
This project documents the PlasmidFinder service
IMPORTANT: It must be noted that a webserver implementing the methods is freely available at the CGE website and can be found here: https://cge.food.dtu.dk/services/PlasmidFinder/.
Documentation
The PlasmidFinder service is a service that identifies plasmids in total or partial sequenced isolates of bacteria, and it is implemented in the three following python scripts:
- _init_.py contains the current version of the service.
- _main_.py is the file that runs the service.
- functions.py defines some of the functions called by _main_.py.
Content of the repository
- _init_.py, _main_.py and functions.py - the program
- test - this folder contains fsa and fq files for testing purposes. Refer to the file called READ_ME_test_info.md for more information.
- tests - this folder contains pytest
- README.md
- Dockerfile - dockerfile for building the plasmidfinder docker container
Installation
We only recommend installation using pip
1. Recommended: Installation using pip
pip install PlasmidFinder
This will install the PlasmifFinder tool. You can find the database here: https://bitbucket.org/genomicepidemiology/plasmidfinder_db/src/master/ which will also need to be downloaded and installed in order to use the tool.
2. Installation by cloning the repository
We do not recommend cloning the repository. Instead, you should use pip install and download the database. This ensures the latest stable version is installed.
In order to run this program without docker, the user must first make sure to have all needed dependencies installed in their device. In order to run the program without using docker, Python 3.5 (or newer) should be installed along with the following versions of the modules (or newer).
It may be advisable to use a virtual environment for these installations.
Modules
- cgecore 1.5.5
- tabulate 0.7.7
Modules can be installed using the following command. Here, the installation of the module cgecore is used as an example:
pip3 install cgecore
KMA and BLAST
Additionally KMA and BLAST version 2.8.1 or newer should be installed. The newest version of KMA and BLAST can be installed from here:
https://bitbucket.org/genomicepidemiology/kma
ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/
3. Installation with Docker
As mentioned, the Dockerfile is included in the repository and will be downloaded when it is cloned.
Setting up PlasmidFinder program
# Go to wanted location for plasmidfinder
cd /path/to/some/dir
# Clone and enter the plasmidfinder directory
git clone https://bitbucket.org/genomicepidemiology/plasmidfinder.git
cd plasmidfinder
Build Docker container
# Build container
docker build -t plasmidfinder .
# Run test: this should bring up the help message
docker run plasmidfinder -h
Download and install PlasmidFinder database
# Go into the directory where you installed plasmidfinder
cd /path/to/some/dir/plasmidfinder
# Clone database from git repository (develop branch)
git clone https://bitbucket.org/genomicepidemiology/plasmidfinder_db.git
cd plasmidfinder_db
PLASMID_DB=$(pwd)
# Install PlasmidFinder database with executable kma_index program
python3 INSTALL.py
If kma_index has no bin install please install kma_index from the kma repository: https://bitbucket.org/genomicepidemiology/kma
Example run with Docker
#This will only work if you have cloned plasmidfinder_db inside plasmidfinder. You can of course clone plasmidfinder_db where you like, just make sure to mount the directory into the container.
docker run -v "$(pwd):/app" plasmidfinder -i ./test/test_1_1.fq -o ./test_results -tmp ./test_results -p ./plasmidfinder_db -x -j ./test_results/new_json_test_1.json
Usage
The program can be invoked with the -h option to get help and more information of the service.
Usage:
__main__.py [-h] -i INFILE [INFILE ...] [-o OUTDIR] [-tmp TMP_DIR] [-mp METHOD_PATH] [-p DB_PATH] [-d DATABASES] [-l MIN_COV] [-t THRESHOLD] [-x] [-q] [-j OUT_JSON]
Options:
-h, --help show this help message and exit
-i INFILE, --infile INFILE FASTA or FASTQ input files relative to pwd, up to two files. (REQUIRED)
-o OUTDIR, --outputPath OUTDIR Output directory relative to pwd. (RECOMMENDED)
-tmp TMP_DIR, --tmp_dir TMP_DIR Temporary directory for storage of the results from the external software.
-mp METHOD_PATH, --methodPath METHOD_PATH Path to the method to use (kma or blastn).
-p DB_PATH, --databasePath DB_PATH Path to the databases directory.
-d DATABASES, --databases DATABASES Databases chosen to search in - if nothing is specified, all databases available will be used by default.
-l MIN_COV, --mincov MIN_COV Minimum coverage: minimum percentage of coverage between a plasmid and uploaded data. All plasmids with a % coverage equal or larger than the selected threshhold will be shown in the output. DEFAULT VALUE= 0.60
-t THRESHOLD, --threshold THRESHOLD Minimum threshold for identity: the minimum percentage of nucleotides that are identical between the best matching resistance gene in the database and the corresponding sequence in the genome. All genes with a %ID equal or larger than the selected threshold will be shown in the output. DEFAULT VALUE= 0.90.
-x, --extented_output Gives extented output with allignment files, template and query hits in fasta and a tab seperated file with gene profile results.
-q, --quiet
-j OUT_JSON, --json OUT_JSON Path to the file in the (new) BeOne JSON format. If no argument is provided, the program will output the results to the default name.
--legacy Only choose this option if you want the legacy JSON file (PlasmidFinder < 3.0.0)
Example usage (if downloaded using pip)
To test the installation , this should bring up the options menu:
python -m plasmidfinder -h
An example of a run could be:
python -m plasmidfinder -i my_file_to_analyse.fsa -o path/to/output/folder -tmp path/to/tmp/folder -p /path/to/database/plasmidfinder_db/ -x -j my_output_file.json
Notes
- If neither -j or --legacy are chosen, the program will output the newer (BeOne) format by default. The file will be written to the current directory with the name "results_<INPUT_FILE_NAME>.json". The extended output option can stil be chosen regardless.
For developers
a. Using a dependency manager
In order to simplify the installation of this service, the dependencies are managed by PDM. Please refer to this web page for an in-depth explanation of this library and alternative installation methods: https://pdm.fming.dev/latest/ . To install PDM please run the following lines. Note that Python 3.7 or higher is required to run PDM. An alternative to using PDM is provided below.
In short, the following commands must be run for Linux or Mac:
curl -sSL https://pdm.fming.dev/install-pdm.py | python3 -w
And the following should be run for Windows:
(Invoke-WebRequest -Uri https://pdm.fming.dev/install-pdm.py -UseBasicParsing).Content | python -
b. Without using a dependency manager
If you do not wish to use the dependency manager, you must keep in mind the following depedencies:
- Python 3.5 (or newer)
- cgecore 1.5.5 (or newer)
- tabulate 0.7.7 (or newer)
- cgelib
- pandas
- biopython
These can be installed using pip as follows:
pip3 install cgecore
Attention! KMA and BLAST
Additionally KMA and BLAST version 2.8.1 or newer should be installed. The newest version of KMA and BLAST can be installed from here:
https://bitbucket.org/genomicepidemiology/kma
ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/
Installation of the library and database
Setting up PlasmidFinder program. The following code will download the library in your chosen directory.
# Go to wanted location for plasmidfinder
cd /path/to/some/dir
# Clone and enter the plasmidfinder directory
git clone https://bitbucket.org/genomicepidemiology/plasmidfinder.git
Then, the PlasmidFinder database will be downloaded into your chosen directory.
# Go to the directory where you want to store the plasmidfinder database
cd /path/to/some/dir
# Clone database from git repository (develop branch)
git clone https://bitbucket.org/genomicepidemiology/plasmidfinder_db.git
cd plasmidfinder_db
PLASMID_DB=$(pwd)
# Install PlasmidFinder database. NOTE that KMA needs to have been installed for the following comand.
python3 INSTALL.py
Citation
When using the method please cite:
PlasmidFinder and pMLST: in silico detection and typing of plasmids. Carattoli A, Zankari E, Garcia-Fernandez A, Volby Larsen M, Lund O, Villa L, Aarestrup FM, Hasman H. Antimicrob. Agents Chemother. 2014. April 28th. [Epub ahead of print]
References
- Camacho C, Coulouris G, Avagyan V, Ma N, Papadopoulos J, Bealer K, Madden TL. BLAST+: architecture and applications. BMC Bioinformatics 2009; 10:421.
- Clausen PTLC, Aarestrup FM, Lund O. Rapid and precise alignment of raw reads against redundant databases with KMA. BMC Bioinformatics 2018; 19:307.
License
Copyright (c) 2014, Ole Lund, Technical University of Denmark All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plasmidfinder-3.0.2.tar.gz.
File metadata
- Download URL: plasmidfinder-3.0.2.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00f1362a2e2bd85a6fd2e8b762d59c9ed0eae0ba1360b0f89ad487acf55f2938
|
|
| MD5 |
ca8c24fe35099a912739c953f9b100ba
|
|
| BLAKE2b-256 |
3b3b56280c85046f9679d860650bcd1c619b8ce03f71d888d09e1c0cbe71c0b8
|
File details
Details for the file plasmidfinder-3.0.2-py3-none-any.whl.
File metadata
- Download URL: plasmidfinder-3.0.2-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01e934da48cecbff38fabbf0e25329512948b0d8c419cf21961777d5e3be8fa6
|
|
| MD5 |
347e51903e27bb53015d6577bb14da0a
|
|
| BLAKE2b-256 |
2c8d1de8a9bc2d32124f33eb71d424ad5b6b3921081e0df6f1ea63002a89a263
|