A Python tool for fetching metadata for bacterial genomes.
Project description
FetchM: Metadata Fetching and Analysis Tool
Overview
FetchM is a Python-based tool for fetching and analyzing genomic metadata from NCBI BioSample records. When you download ncbi_dataset.tsv from the NCBI genome database, the metadata fields such as 'Collection Date', 'Host', 'Geographic Location', and 'Isolation Source' are missing. This tool helps fetch the associated metadata for each BioSample ID. FetchM requires an input file (ncbi_dataset.tsv) from the NCBI genome database, retrieves additional annotations from NCBI, filters the data based on quality thresholds, and generates visualizations to help interpret the results. You can also download the filtered sequences.
Features
- Fetch metadata from NCBI BioSample API.
- Filter genomes based on CheckM completeness and ANI check status.
- Generate metadata summaries and annotation statistics.
- Create various visualizations for geographic distribution, collection dates, gene counts, continent, and subcontinent.
- Download genome sequences (optional).
- Download sequences after filtering by host species, year, country, continent, and subcontinent.
Installation
Install in a New Conda Environment
conda create -n fetchm python=3.9
conda activate fetchm
pip install fetchM
Usage
Run FetchM with the following command:
fetchM --input input.tsv --outdir results/
For retrieving all available sequence data
fetchM --input input.tsv --outdir results/ --ani all
For downloading sequences with sequence information
fetchM --input input.tsv --outdir results/ --seq
For downloading filtered sequences add the available Options below:
Options:
--checkm CHECKM(Minimum CheckM completeness threshold, default: NA)--ani(Filter genomes by ANI status. Choices: OK, Inconclusive, Failed, all. Default is OK)--sleep(Time to wait between requests, default: 0.5s)--seq(Enable sequence download mode)
Downloading sequences based on different criteria
--host HOST [HOST ...](Filter by host species, e.g.,"Homo sapiens" "Bos taurus")--year YEAR [YEAR ...](Filter by year or year range, e.g.,"2015" "2018-2025")--country COUNTRY [COUNTRY ...](Filter by country, e.g.,"Bangladesh" "United States")--cont CONT [CONT ...](Filter by continent, e.g.,"Asia" "Africa")--subcont SUBCONT [SUBCONT ...](Filter by subcontinent, e.g.,"Southern Asia" "Western Africa")
Input
Download ncbi_dataset.tsv of your target organism(s) from the NCBI genome database. -ncbi_dataset.tsv
📋 Required Columns for ncbi_dataset.tsv in FetchM
Before running FetchM, ensure that your ncbi_dataset.tsv file includes the following columns. These columns are necessary for metadata enrichment, quality filtering, and downstream analysis.
🧬 Required Columns
| Column Name | Description |
|---|---|
Assembly Accession |
Unique identifier for the assembly |
Assembly Name |
Name of the genome assembly |
Organism Name |
Scientific name of the organism |
ANI Check status |
Status of Average Nucleotide Identity (ANI) check |
Annotation Name |
Annotation version or label used |
Assembly Stats Total Sequence Length |
Total length (in base pairs) of all sequences in the assembly |
Assembly BioProject Accession |
Accession ID for the related BioProject |
Assembly BioSample Accession |
Accession ID for the related BioSample |
Annotation Count Gene Total |
Total number of genes annotated |
Annotation Count Gene Protein-coding |
Number of protein-coding genes |
Annotation Count Gene Pseudogene |
Number of pseudogenes |
CheckM completeness |
Completeness score from CheckM (in %) |
CheckM contamination |
Contamination score from CheckM (in %) |
✅ Tips
- The file must be tab-separated (
.tsvformat). - Don't change Column headers
Output
FetchM creates a subdirectory in /results/ based on the organism name provided in the input file. Inside this subdirectory, the following folders are created:
- Metadata summaries in
metadata_output/annotation_summary.csvassembly_summary.csvmetadata_summary.csvncbi_clean.csvncbi_filtered.csvncbi_dataset_updated.tsv
- Figures in
figures/Annotation Count Gene Protein-coding_distribution.tiffAnnotation Count Gene Pseudogene_distribution.tiffAnnotation Count Gene Total_distribution.tiffAssembly Stats Total Sequence Length_distribution.tiffCollection Date_bar_plots.tiffContinent_bar_plots.tiffGeographic Location_bar_plots.tiffGeographic Location_map.jpgHost_bar_plots.tiffscatter_plot_gene_protein_coding_vs_collection_date.tiffscatter_plot_gene_total_vs_collection_date.tiffscatter_plot_total_sequence_length_vs_collection_date.tiffSubcontinent_bar_plots.tiff
- Sequences in
sequences/(if--seqis enabled, it will contain the downloaded genome sequences).
Visualizations
Annotation Distributions
Assembly Statistics
Metadata Summaries
Scatter Plots
License
This project is licensed under the MIT License.
Author
Developed by Tasnimul Arabi Anik.
Contributions
Contributions and improvements are welcome! Feel free to submit a pull request or report issues.
Project details
Release history Release notifications | RSS feed
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 fetchm-0.1.7.tar.gz.
File metadata
- Download URL: fetchm-0.1.7.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f00364a6667c34487ca98d87e84524c07124b950062dd29a2773222e5105ab0
|
|
| MD5 |
46f2ee4a44ebecaa582f26cc89be7da7
|
|
| BLAKE2b-256 |
07293000371b292f7353ac464d49b9d5bad940713f569747bb12bf6bf085d717
|
File details
Details for the file fetchm-0.1.7-py3-none-any.whl.
File metadata
- Download URL: fetchm-0.1.7-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
162ea7eb7c7216cb389d5f6f4b89b899da16a8a31ad669e09a6d5554786dff9b
|
|
| MD5 |
9fa37e040dfcc7b977ab391224923571
|
|
| BLAKE2b-256 |
73e8e32293da7471b650d3b79e4d9a6bf9331c295673dee3feeedeb73fbfb663
|