Skip to content
Shafayat115Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Fast-Part

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.

Features

  • 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.

Requirements

  • 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.

Installation Instructions

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

CD-HIT is a clustering tool for protein and nucleotide sequences.

  1. Download CD-HIT:

  2. Install CD-HIT:

    • Extract the downloaded file and navigate to the extracted folder.
    • Run the following commands:
      make
      sudo make install
    • Ensure the cd-hit binary is accessible in your PATH. You can test it with:
      cd-hit --help

MMseqs2

MMseqs2 (Many-against-Many sequence searching) is used for fast and sensitive sequence similarity searches and clustering.

  1. Download MMseqs2:

  2. 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

DIAMOND is a fast sequence aligner for protein and translated DNA searches.

  1. Download DIAMOND:

  2. Install DIAMOND:

    • Extract the downloaded file.
    • Move the diamond executable to a directory in your PATH.
    • Test the installation with:
      diamond --help

Installation

To install fast-part, you can use pip directly from your terminal:

pip install fast-part

Or you can use this repository -

  1. Clone this repository:
    git clone https://github.com/Shafayat115/Fast-Part.git
    cd Fast_Part
  2. Install dependencies:
    pip install biopython
    
    

FASTA File Formatting Requirements

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 .fasta or .fa extension.

  • 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.

Common Errors to Avoid

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.

Usage

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.

Command-Line Arguments

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

Example 1: Using CD-HIT with default settings

python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhit

Example 2: Using MMseqs2 with custom identity threshold

python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method mmseq --identity_threshold 0.7

Example 3: Specifying custom cores for CD-HIT

python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhit --cdhit_cores 64

Example 4: Running with a custom stratification ratio and query cover

python fast_part.py --fasta_file path/to/input.fasta --output_dir path/to/output --method cdhit --train_ratio 0.85 --query_cover 70

Output Files

Train.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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages