Code Monkey home page Code Monkey logo

msa_neff's Introduction

Neff Calculation Script

This script calculates the effective number of sequences (Neff) from a multiple sequence alignment (MSA) file using the following equation:

$$ Neff = \sum_{i=1}^{N} {1 \over weight_{i}} $$

where $N$ is the number of sequences in the MSA. For each sequence $i$, $weight_{i}$ is the sum of $weight_{ij}$ over all sequences in the MSA, while $weight_{ij}$ is the sequence identity between any homologous sequence $i$ and $j$ in the MSA. The minimum sequence identity between $i$ and $j$ is set to 80% by default but can be defined by the user (see below).

Requirements

  • Python 3
  • numpy

Arguments

  • --msa_file: Path to an MSA file. Supported formats are .a3m, .fasta, .sto, and .hhr.
  • --af_dir: Path to an AlphaFold2 output directory. This will automatically find the MSA files and calculate the total number of sequences/Neff.
  • --cf_dir: Path to a ColabFold output directory. This will automatically find the MSA file and calculate the total number of sequences/Neff.
  • --seq_id: Optional: Sequence identity threshold for calculating Neff. The default is 0.8 in line with the 80% value used in the AlphaFold2 paper (Jumper et al. 2021). However, be aware that other thresholds are also used: e.g. 0.62 (Wu et al. 2020).
  • --input_seq: Optional: The input sequence used to calculate the MSA (fasta format). This is used to calculate the Neff/length.

Usage

python get_neff.py --msa_file <path_to_msa_file> [--seq_id <sequence_identity_threshold> --input_seq <path_to_input_sequence>]
python get_neff.py --af_dir <path_to_af_dir> [--seq_id <sequence_identity_threshold> --input_seq <path_to_input_sequence>]
python get_neff.py --cf_dir <path_to_cf_dir> [--seq_id <sequence_identity_threshold> --input_seq <path_to_input_sequence>]

Note: Can be a little slow on large MSAs (>10000 sequences)

Output

Results are printed to the terminal in the format:

Neff = <neff value>
Neff/len = <neff/len value>
Total sequences = <total_sequences>

The results are also stored in an output file called neff.csv.

Acknowledgments

This script uses lightly modified code from AlphaFold and ColabDesign.

msa_neff's People

Contributors

hlasimpk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.