GithubHelp home page GithubHelp logo

mireklzicar / asmac Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puar-playground/asmac

0.0 0.0 0.0 15.19 MB

A machine learning model for pairwise comparison of ribosomal RNA sequences.

License: Other

C++ 1.57% Python 6.52% Jupyter Notebook 90.10% Cython 1.81%

asmac's Introduction

AsMac

This is the multiprocessing implementation of AsMac, a machine learning framework designed for pairwise comparison of ribosomal RNA sequences. The following instruction is for Linux/MacOS.

1. Installation

If a python environment for Python 3.7 or later version has not been set up yet, please follow these steps to create a virtual environment.
Install and create a virtual environment for python3

sudo pip3 install virtualenv
python3 -m venv venv3

Activate the python virtual environment. Then, install packages.

source ./venv3/bin/activate
pip install -r requirements.txt

Build the cython executable by:

python setup_softnw.py build_ext --inplace

2. Distance estimation

Use -h or --help flags to get help text for the program.

python AsMac.py -h

Choose a model with the -m or --model flags, and run the script:

python AsMac.py -i path/to/input.fasta -o path/to/output.csv -m 16S-full

for example:

python AsMac.py -i ./data/testing_seq.fa -o ./out.csv -m 16S-full

AsMac takes input sequences written in fasta format and outputs a pairwise distance matrix in a CSV table. For example:

seq_1 seq_2 seq_3
seq_1 0 0.2 0.3
seq_2 0.2 0 0.1
seq_3 0.3 0.1 0

3. Encoding sequence representations

The embedding.py script provided the demo for using AsMac as a pre-trained encoder.

4. Train new model (optional)

Preparing training and testing data

Download C++ library SeqAn or use the attached version to compile the C++ code for NW alignment.

unzip seqan.zip
g++ -I . -std=c++1z -o CppAlign/align CppAlign/main.cpp CppAlign/read_fasta.cpp

Then generate alignment distance results for the input sequences.

./CppAlign/align ./data/training_seq.fa 0

The alignment process is very time-consuming on a personal computer. The demo code uses the finished result: training_dist_prepared.txt

Run the demo code for training

jupyter notebook demo.ipynb

Reference

  1. Jian Chen, Le Yang, Lu Li, Steve Goodison, and Yijun Sun. "Alignment-free Comparison of Metagenomics Sequences via Approximate String Matching." Bioinformatics Advances (2022).
  2. Koide, Satoshi, Keisuke Kawano, and Takuro Kutsuna. "Neural edit operations for biological sequences." Advances in Neural Information Processing Systems 31 (2018).

asmac's People

Contributors

puar-playground avatar mireklzicar 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.