Giter Site home page Giter Site logo

aa-regex's Introduction

aa-regex

Lifecycle: experimental FOSSA Status

Rust Rust Documentation Crates.io version Crates.io license

Utility macros to build regular expression matching protein sequences.

Warning: Work in progress, very experimental library, this is my very first crate.

Motivation

We can use regular expressions to match motifs on peptidic sequences, but writing them is a bit tedious. Some can become very complicated to read and understand. This crate tries to provide macros to help writing regular expressions at compile time. It uses procedural macros to generate strings that can be concatenated and used as regular expressions using the reduced alphabet of 20 amino acids. Any residue can now be limited to any valid amino acid instead of . (which would macth any valid unicode character) or manually writing the 20 amino acids and brackets. Does it make the regular expression search faster? I don't know.

Setup

Add this to your Cargo.toml:

[dependencies]
aa-regex = "0.3"

Usage

Any

use aa_regex::any;

let any = any!(); // => let any = "[ARNDCEQGHILKMFPSTWYV]";
assert_eq!(any, "[ARNDCEQGHILKMFPSTWYV]");

Any of

use aa_regex::any_of;

let any_aromatics = any_of!(W, F, Y); // => let any_aromatics = "[WFY]";
assert_eq!(any_aromatics, "[WFY]");

Except

use aa_regex::except;

let no_proline = except!(P); // => let no_proline = "[ARNDCEQGHILKMFSTWYV]";
assert_eq!(no_proline, "[ARNDCEQGHILKMFSTWYV]");

Aliases

TODO

  • any_aromatics!()
  • except_aromatics!()
  • except_proline!()
  • any_charged!()
  • ...

Concatenation

You can use the std::concat! macro to assemble the regular expression.

let motif = concat!(any_of!(R, H, K), except!(P)); // => let motif = "[RHK][ARNDCEQGHILKMFSTWYV]";
assert_eq!(motif, "[RHK][ARNDCEQGHILKMFSTWYV]")

Ideas & bugs

Please create a new issue on the project repository.

License

Aa-regex is distributed under the terms of the Apache License (Version 2.0). See LICENSE for details.

FOSSA Status

aa-regex's People

Contributors

fossabot avatar jeanmanguy avatar

Stargazers

 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.