Fast-Part is an efficient tool for partitioning and clustering sequences. It uses CD-HIT or MMseqs2 for clustering, along with DIAMOND for alignments, to enable streamlined handling of biological sequences, automated partitioning into training and test sets, and iterative reassignment based on DIAMOND alignments.
- Clustering Options: Supports clustering with CD-HIT or MMseqs2.
- Automatic Word Length Adjustment: For CD-HIT, automatically adjusts word length based on the identity threshold.
- Default to MMseqs2: Automatically defaults to MMseqs2 if the identity threshold is set below 0.4.
- Train-Test Partitioning: Automatically applies a 5% adjustment to the specified train ratio.
- Detailed Summary: Outputs a summary file with configuration details, partition sizes, removed sequences, and execution time.
- Python 3.6+
- CD-HIT
- MMseqs2
- DIAMOND
- Biopython library (
pip install biopython)
Ensure that CD-HIT, MMseqs2, and DIAMOND are installed and accessible in your system’s PATH.
Before using Fast_Part, ensure that CD-HIT, MMseqs2, and DIAMOND are installed on your system. Below are installation instructions for each tool.
CD-HIT is a clustering tool for protein and nucleotide sequences.
-
Download CD-HIT:
- Go to the CD-HIT website and download the latest release.
-
Install CD-HIT:
- Extract the downloaded file and navigate to the extracted folder.
- Run the following commands:
make sudo make install
- Ensure the
cd-hitbinary is accessible in your PATH. You can test it with:cd-hit --help
MMseqs2 (Many-against-Many sequence searching) is used for fast and sensitive sequence similarity searches and clustering.
-
Download MMseqs2:
- Visit the MMseqs2 GitHub repository and download the appropriate release for your operating system.
-
Install MMseqs2:
- Extract the downloaded file.
- Add MMseqs2 to your PATH or move it to a directory already in your PATH.
- You can verify the installation with:
mmseqs --help
DIAMOND is a fast sequence aligner for protein and translated DNA searches.
-
Download DIAMOND:
- Go to the DIAMOND GitHub page and download the latest release for your platform.
-
Install DIAMOND:
- Extract the downloaded file.
- Move the
diamondexecutable to a directory in your PATH. - Test the installation with:
diamond --help
To install fast-part, you can use pip directly from your terminal:
pip install fast-partOr you can use this repository -
- Clone this repository:
git clone https://github.com/Shafayat115/Fast-Part.git cd Fast_Part - Install dependencies:
pip install biopython
To use Fast-Part effectively, ensure that your input FASTA file follows these formatting guidelines:
-
File Extension: The input file should be in the standard FASTA format and typically have a
.fastaor.faextension. -
Sequence Header: Each sequence must begin with a header line starting with a
>symbol. The header should contain information separated by pipes (|) in the following format: AccessionID|Label|Other_Info -
AccessionID: A unique identifier for the sequence.
-
Label: The label that categorizes the sequence (e.g., resistance mechanism or organism name).
-
Other_Info: Optional additional information (e.g., description of the protein or sequence origin).
Example:
>ABC123|Resistant|Bacterial Protein
MKTIIALSYIFCLVFADYKDDDDK
>XYZ789|Susceptible|Viral Protein
GGDEKRAYVREAEVKQITQGDQFFTRY-
Sequence Data: The sequence should appear immediately after the header line without any blank lines in between. It should only contain standard nucleotide or protein letters (A, T, C, G for nucleotides; or standard amino acid codes for proteins).
-
Consistency in Labeling: Ensure that labels (the second field in the header) are consistent across sequences, as these labels will be used for clustering and partitioning into training and test sets.
Missing Header Lines: Ensure each sequence has a header line starting with >.
Incorrect Separator: Use | as the separator between fields in the header, especially for the AccessionID and Label fields.
Special Characters: Avoid non-standard characters in the sequence data; only use valid nucleotide (A, T, C, G, N) or amino acid codes.
Run Fast_Part with a specified fasta_file and output_dir, along with other optional parameters. By default, the tool uses cdhit with an identity threshold of 0.8, 128 CD-HIT cores, a train ratio of 0.8 (adjusted by 5% internally), and a query coverage of 60 for DIAMOND alignment.
| Argument | Description | Default |
|---|---|---|
--fasta_file |
Input FASTA file containing sequences | Required |
--output_dir |
Directory to store output files | Required |
--method |
Clustering method (cdhit or mmseq) |
Required |
--identity_threshold |
Identity threshold for clustering | 0.8 |
--cdhit_cores |
Number of cores for CD-HIT (only if cdhit method is used) |
128 |
--train_ratio |
Train set ratio for splitting clusters (adjusted by 5%) | 0.8 |
--query_cover |
Query coverage for DIAMOND alignment | 60 |
python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhitpython fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method mmseq --identity_threshold 0.7python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhit --cdhit_cores 64python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhit --train_ratio 0.85 --query_cover 70Train.fasta: Contains sequences assigned to the training set.
Test.fasta: Contains sequences assigned to the test set.
summary.txt: A summary file with configuration details, initial and final sequence counts per label, removed sequences, missing labels, and execution time.