Skip to content

Commit

Permalink
Updated documentation and organisation
Browse files Browse the repository at this point in the history
  • Loading branch information
douweschulte committed Sep 12, 2024
1 parent 2f5ae13 commit a5a29ff
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 21 deletions.
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,48 @@

# Match those fragments!

A peptide fragmentation matching library for rust. Split into multiple smaller modules to help keep things organised.
A peptide fragmentation matching library for Rust.

## Features

- Read [ProForma](https://github.com/HUPO-PSI/ProForma) sequences (complete specification supported: 'level 2-ProForma + top-down compliant + cross-linking compliant + glycans compliant + mass spectrum compliant')
- Generate theoretical fragments with control over the fragmentation model from any ProForma peptidoform/proteoform
- Generate fragments from satellite ions (w, d, and v)
- Generate glycan fragments
- Generate theoretical fragments for modifications of unknown position
- Generate theoretical fragments for chimeric spectra
- Generate theoretical fragments for cross-links (also disulfides)
- Integrated with [mzdata](https://crates.io/crates/mzdata) for reading raw data file
- Generate theoretical fragments for modifications of unknown position
- Generate peptide backbone (a, b, c, x, y, and z) and satellite ion fragments (w, d, and v)
- Generate glycan fragments (B, Y, and internal fragments)
- Integrated with [mzdata](https://crates.io/crates/mzdata) for reading raw data files
- Match spectra to the generated fragments
- [Align peptides based on mass](https://pubs.acs.org/doi/10.1021/acs.jproteome.4c00188)
- Fast access to the IMGT database of antibody germlines
- Reading of multiple identified peptide file formats (Fasta, MaxQuant, MSFragger, Novor, OPair, Peaks, and Sage)
- Exhaustively fuzz tested for reliability (using [cargo-afl](https://crates.io/crates/cargo-afl))
- Extensive use of [uom](https://docs.rs/uom/latest/uom/) for compile time unit checking
- Python bindings are provided to several core components of the rustyms library. Go to the [Python documentation](https://rustyms.readthedocs.io/) for more information.

## Python bindings
# Folder organisation

Python bindings are provided to several core components of the rustyms library. Go to the
[Python documentation](https://rustyms.readthedocs.io/) for more information.
## rustyms

# Contributing
This is the main library. This contains all source code, databases (Unimod etc) and example data to run the rustyms library.

## examples

Some examples on how to use the rustyms library are provided here, see the readme file in the examples themselves for more details.

## fuzz

Any contribution is welcome (especially adding/fixing documentation as that is very hard to do as main developer).
The harness to fuzz test the library for increased stability, see the readme for more details.

# IMGT generate
## rustyms-py

This Rust library provides python bindings (using pyO3) for rustyms.

## rustyms-imgt-generate

Using the `rustyms-imgt-generate` the definitions for the germlines can be updated. Put the imgt.dat.Z file in the `rustyms-imgt-generate/data` directory and unpack it (this can be downloaded from https://www.imgt.org/download/LIGM-DB/imgt.dat.Z). Then run `cargo run --release -p rustyms-imgt-generate` (from the root folder of this repository).

# Contributing

Using the `rustyms-imgt-generate` the definitions for the germlines can be updated. Put the imgt.dat.Z file in the `data` directory and unpack it (this can be downloaded from https://www.imgt.org/download/LIGM-DB/imgt.dat.Z). Then run `cargo run --release -p rustyms-imgt-generate` (from the root folder of this repository).
Any contribution is welcome (especially adding/fixing documentation as that is very hard to do as main developer).
6 changes: 0 additions & 6 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,3 @@ path = "fuzz_targets/peaks.rs"
test = false
doc = false
bench = false

# in root dir
# cargo afl build --release -p rustyms-fuzz
# cargo afl fuzz -i fuzz/in_pro_forma -o out_pro_forma target/release/pro_forma
# open out_pro_forma/default/crashes/* | save crashes.txt -f
# cat out_pro_forma/default/crashes/* >> crashes.txt
17 changes: 17 additions & 0 deletions fuzz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Fuzzing

Uses [cargo-afl](https://crates.io/crates/cargo-afl) for [fuzz testing](https://en.wikipedia.org/wiki/Fuzzing). Note that this only works on Linux.

From root directory
```
cargo-afl afl system-config
cargo afl build --release -p rustyms-fuzz
cargo afl fuzz -i fuzz/in_pro_forma -o out_pro_forma target/release/pro_forma
```
Several fuzz targets are defined: `pro_forma`, `sloppy_pro_forma`, and `peaks`. The two peptide targets share the `in_pro_forma` directory with input examples. The peaks target has `in_peaks` as directory of input examples.

After running the fuzzer the following commands can be used to easily save all crashes into a single file.
```
open out_pro_forma/default/crashes/* | save crashes.txt -f (nushell)
cat out_pro_forma/default/crashes/* >> crashes.txt (bash)
```
4 changes: 2 additions & 2 deletions rustyms-imgt-generate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use rustyms::*;
use structs::{Location, SequenceRegion};

fn main() {
let file = File::open("data/imgt.dat")
.expect("Please provide the 'imgt.dat' file in the 'data' directory in the root.");
let file = File::open("rustyms-imgt-generate/data/imgt.dat")
.expect("Please provide the 'imgt.dat' file in the 'rustyms-imgt-generate/data' directory in the root.");
let mut output = BufWriter::new(File::create("rustyms/src/imgt/germlines/mod.rs").unwrap());
let mut docs = BufWriter::new(File::create("rustyms/src/imgt/germlines/germlines.md").unwrap());
let mut error = BufWriter::new(File::create("errors.dat").unwrap());
Expand Down
1 change: 0 additions & 1 deletion rustyms/src/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
};

use itertools::Itertools;
use ordered_float::OrderedFloat;
use serde::{Deserialize, Serialize};

use crate::{
Expand Down

0 comments on commit a5a29ff

Please sign in to comment.