### Manual pip installation with virtualenv Source: https://olc-bioinformatics.github.io/ConFindr/install Manual installation steps: create an empty directory, create a virtualenv with Python 3, activate it, and install ConFindr via pip. Using a virtual environment is highly recommended. After installation, you must install the listed dependencies (BBMap, Mash, KMA, Python, SAMtools, pysam) and add them to your $PATH. ```bash mkdir ~/Virtual_Environments/ConFindr ``` ```bash virtualenv -p /usr/bin/python3 ~/Virtual_Environments/ConFindr ``` ```bash source ~/Virtual_Environments/ConFindr/bin/activate ``` ```bash pip install confindr ``` -------------------------------- ### Download and extract example dataset Source: https://olc-bioinformatics.github.io/ConFindr/usage Downloads the ConFindr example dataset from FigShare and extracts it into the current working directory. ```bash wget https://figshare.com/ndownloader/files/41228577 -O test_samples.tar.gz && \ tar -xzvf test_samples.tar.gz && \ rm test_samples.tar.gz ``` -------------------------------- ### ConFindr terminal output example Source: https://olc-bioinformatics.github.io/ConFindr/usage Example of the terminal output generated when running ConFindr for the first time, showing database downloading and indexing. ```text $ confindr -i test_samples -o output 2023-05-16 15:25:51 Welcome to ConFindr 0.8.1! Beginning analysis of your samples... 2023-05-16 15:25:51 Could not find Escherichia_db_cgderived.fasta 2023-05-16 15:25:51 Could not find Listeria_db_cgderived.fasta 2023-05-16 15:25:51 Could not find Salmonella_db_cgderived.fasta 2023-05-16 15:25:51 Could not find refseq.msh 2023-05-16 15:25:51 Databases not present - downloading basic databases now... 2023-05-16 15:25:51 Downloading mash refseq sketch... 2023-05-16 15:25:53 Downloading cgMLST-derived data for Escherichia, Salmonella, and Listeria... 2023-05-16 15:25:55 Since this is the first time you are using this database, it needs to be indexed by KMA. This might take a while 2023-05-16 15:25:57 Since this is the first time you are using this database, it needs to be indexed by KMA. This might take a while 2023-05-16 15:25:58 Since this is the first time you are using this database, it needs to be indexed by KMA. This might take a while 2023-05-16 15:25:59 Did not find rMLST databases, if you want to use ConFindr on genera other than Listeria, Salmonella, and Escherichia, you'll need to download them. Instructions are available at https://olc-bioinformatics.github.io/ConFindr/install/#downloading-confindr-databases 2023-05-16 15:25:59 Beginning analysis of sample SRX5084910_SRR8268082... 2023-05-16 15:25:59 Checking for cross-species contamination... 2023-05-16 15:26:00 Extracting conserved core genes... 2023-05-16 15:26:01 Quality trimming... 2023-05-16 15:26:01 Detecting contamination... 2023-05-16 15:26:05 Done! Number of contaminating SNVs found: 208 ... 2023-05-16 15:26:51 Contamination detection complete! ``` -------------------------------- ### Create conda environment and install ConFindr Source: https://olc-bioinformatics.github.io/ConFindr/install Creates a new conda environment named 'confindr' and installs ConFindr version 0.8.2 from the Bioconda channel. Requires the Bioconda channel to be added to your conda configuration first. ```bash conda create -n confindr -c bioconda confindr=0.8.2 ``` -------------------------------- ### Install ConFindr in development mode Source: https://olc-bioinformatics.github.io/ConFindr/usage Clones the repository and installs ConFindr in development mode within a Conda environment, including the necessary test data. ```bash conda activate confindr git clone https://github.com/OLC-Bioinformatics/ConFindr cd ConFindr/ pip install -e . wget https://figshare.com/ndownloader/files/41228577 -O tests/test_samples.tar.gz && \ tar -xzvf tests/test_samples.tar.gz -C tests/ && \ rm tests/test_samples.tar.gz ``` -------------------------------- ### Example pytest output Source: https://olc-bioinformatics.github.io/ConFindr/usage Shows the expected output when all automated tests pass. ```text ================================================ test session starts ================================================= platform linux -- Python 3.7.12, pytest-4.5.0, py-1.11.0, pluggy-0.11.0 -- /home/liam/miniconda3/envs/confindr-8.0/bin/python cachedir: .pytest_cache rootdir: /media/liam/Cerulean/projects/PRJ-LPB-00001/bin/confindr-8.0/ConFindr collected 38 items ``` -------------------------------- ### PubMLST consumer key and secret file Source: https://olc-bioinformatics.github.io/ConFindr/install Place the PubMLST consumer key on the first line and the consumer secret on the second line. This file is required by the `confindr_database_setup` command's `-s` argument. ```text efKXmqp2D0EBlMBkZaGC2lPf F$M+fQ2AFFB2YBDfF9fpHF^qSWJdmmN%L4Fxf5Gur3 ``` -------------------------------- ### Run ConFindr with core-gene databases Source: https://olc-bioinformatics.github.io/ConFindr/usage Command to analyze samples in the test_samples directory with output directed to an output folder. ```bash confindr -i test_samples -o output ``` -------------------------------- ### Run ConFindr with rMLST databases Source: https://olc-bioinformatics.github.io/ConFindr/usage Command to analyze samples using the --rmlst option after downloading the required databases. ```bash confindr -i test_samples -o output --rmlst ``` -------------------------------- ### Download Escherichia cgMLST FASTA Source: https://olc-bioinformatics.github.io/ConFindr/usage Download the pre-clustered cgMLST FASTA file for Escherichia using wget. ```bash wget 'https://scist01.blob.core.windows.net/olc/Escherichia_cgmlst.fasta?sp=r&st=2020-07-15T13:17:25Z&se=2029-07-15T21:17:25Z&spr=https&sv=2019-10-10&sr=b&sig=zF01kDCgmsmBWJ0cSpyfYi6CLldIjalwU2RgsswKmmI%3D' -O Escherichia_cgmlst.fasta ``` -------------------------------- ### Run ConFindr with cgMLST Source: https://olc-bioinformatics.github.io/ConFindr/usage Execute ConFindr using a custom cgMLST scheme file. ```bash confindr.py -i folder-with-Escherichia-files -o cgmlst-output -cgmlst /path/to/Escherichia_cgmlst.fasta ``` -------------------------------- ### Download Salmonella cgMLST FASTA Source: https://olc-bioinformatics.github.io/ConFindr/usage Download the pre-clustered cgMLST FASTA file for Salmonella using wget. ```bash wget 'https://scist01.blob.core.windows.net/olc/Salmonella_cgmlst.fasta?sp=r&st=2020-07-15T13:13:16Z&se=2029-07-15T21:13:16Z&spr=https&sv=2019-10-10&sr=b&sig=ncG%2F5MzKt57p1BUdyFtnhJUk9Yfi6x3rFhSQWPlT2Ek%3D' -O Salmonella_cgmlst.fasta ``` -------------------------------- ### Activate conda environment Source: https://olc-bioinformatics.github.io/ConFindr/install Activates the conda environment named 'confindr' created in the previous step. After activation, typing `confindr -h` shows the help menu. ```bash conda activate confindr ``` -------------------------------- ### Integrate ConFindr into a Python script Source: https://olc-bioinformatics.github.io/ConFindr/usage Use the confindr module to find paired reads and run contamination detection. Ensure databases are downloaded before execution. ```python from confindr_src import confindr # Find read files. paired_reads = confindr.find_paired_reads('path_to_fastq_folder', forward_id='_R1', reverse_id='_R2') # Run confindr. This assumes that you have already downloaded the databases. If you haven't, # you can run confindr.check_for_databases_and_download(database_location='path/where/you/want/to/download, tmpdir='a/tmp/dir') for pair in paired_reads: confindr.find_contamination(pair=pair, forward_id='_R1', # change if yours is different threads=4, output_folder='path/to/output', databases_folder='path/to/databases') ``` -------------------------------- ### Run automated tests with pytest Source: https://olc-bioinformatics.github.io/ConFindr/usage Executes the ConFindr test suite using pytest within the activated Conda environment. ```bash conda activate confindr cd ConFindr/ python -m pytest tests/ -vvv ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.