Skip to content

Commit 1067c01

Browse files
authored
Merge pull request #67 from rusteomics/glycan-rendering
Glycan rendering
2 parents 3fd0abc + 3cfbe5b commit 1067c01

31 files changed

Lines changed: 3822 additions & 379 deletions

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
cargo build -p rustyms --no-default-features --features rand
2929
cargo build -p rustyms --no-default-features --features rayon
3030
cargo build -p rustyms --no-default-features --features mzdata
31+
cargo build -p rustyms --no-default-features --features glycan-render
32+
cargo build -p rustyms --no-default-features --features glycan-render-bitmap
3133
3234
fmt:
3335
runs-on: ubuntu-latest

.github/workflows/scripts/update-all-databases.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ function make-ontologies {
4141
curl https://raw.githubusercontent.com/HUPO-PSI/mzIdentML/master/cv/XLMOD.obo \
4242
> ${db_data}/XLMOD.obo
4343
curl -L http://purl.obolibrary.org/obo/gno.obo \
44-
| sed '/(property_value: GNO:00000(022|023|041|042|101|102) .*$\n)|(def: .*$\n)/d' \
45-
| gzip -c \
46-
> ${db_data}/GNOme.obo.gz
44+
> ${db_data}/GNOme.obo
4745
curl -L https://glycosmos.org/download/glycosmos_glycans_list.csv \
48-
| gzip -c > ${db_data}/glycosmos_glycans_list.csv.gz
46+
> ${db_data}/glycosmos_glycans_list.csv
4947

5048

5149
echo "Serializing the other databases..."

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Cargo.lock
77
errors.dat
88
*.dat.Z
99
*.dat
10+
*.html
1011
GNOme.obo
1112
glycosmos_glycans_list.csv
1213
.venv/

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ codegen-units = 1
2727

2828
[workspace.dependencies]
2929
afl = "0.15"
30+
base64 = "0.22"
3031
bincode = "1.3"
3132
clap = { version = "4.5", features = ["derive", "cargo"] }
3233
directories = "6.0"
3334
flate2 = "1.0"
3435
iai-callgrind = "0.14"
3536
itertools = "0.14"
36-
mzdata = "0.44"
37+
mzdata = {version="0.48", default-features = false, features = ["miniz_oxide"]}
3738
ndarray = "0.16"
3839
ordered-float = { version = "4.6", features = ["serde"] }
40+
png = "0.17"
3941
probability = "0.20"
4042
pyo3 = "0.23"
4143
rand = "0.9"
@@ -45,8 +47,10 @@ roxmltree = "0.20"
4547
serde = { version = "1.0", features = ["derive", "rc"] }
4648
serde_json = "1.0"
4749
similar = "2.7"
50+
swash = "0.2"
4851
thin-vec = { version = "0.2", features = ["serde"] }
49-
uom = { version = "0.36", features = ["use_serde", "usize", "isize"] }
52+
uom = { version = "0.36", default-features = false, features = ["use_serde", "usize", "isize", "f64"] }
53+
zeno = {version = "0.3.2" }
5054

5155
[workspace.lints.rust]
5256
unexpected_cfgs = { level = "allow", check-cfg = [

examples/de-novo-align/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license.workspace = true
77
publish = false
88

99
[dependencies]
10-
rustyms = { path = "../../rustyms" }
10+
rustyms = { path = "../../rustyms", default-features=false, features = ["align", "identification"] }
1111
clap = { workspace = true }
1212
itertools = { workspace = true }
1313
rayon = { workspace = true }

rustyms-generate-databases/src/gnome.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl std::str::FromStr for GnoSubsumption {
117117
}
118118

119119
fn parse_gnome() -> HashMap<String, GNOmeModification> {
120-
let obo = OboOntology::from_file("rustyms-generate-databases/data/GNOme.obo.gz")
120+
let obo = OboOntology::from_file("rustyms-generate-databases/data/GNOme.obo")
121121
.expect("Not a valid obo file");
122122
let mut mods = HashMap::new();
123123

@@ -221,7 +221,7 @@ fn parse_gnome_structures() -> HashMap<String, GlycosmosList> {
221221
let mut glycans = HashMap::new();
222222
let mut errors = 0;
223223
for line in parse_csv(
224-
"rustyms-generate-databases/data/glycosmos_glycans_list.csv.gz",
224+
"rustyms-generate-databases/data/glycosmos_glycans_list.csv",
225225
b',',
226226
None,
227227
)

rustyms/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ repository = "https://github.com/snijderlab/rustyms"
1313
readme = "README.md"
1414
include = [
1515
"src/**/*",
16-
"databases/**/*.gz",
1716
"README.md",
1817
"build.rs",
1918
"benches/**/*",
@@ -32,12 +31,17 @@ rayon = { workspace = true, optional = true }
3231
regex = { workspace = true }
3332
serde = { workspace = true }
3433
similar = { workspace = true }
34+
swash = {workspace = true, optional = true}
3535
thin-vec = { workspace = true }
3636
uom = { workspace = true }
37+
zeno = { workspace = true, optional = true }
3738

3839
[dev-dependencies]
40+
base64 = { workspace = true }
3941
iai-callgrind = { workspace = true }
42+
png = { workspace = true }
4043
serde_json = { workspace = true }
44+
directories = {workspace = true}
4145

4246
[features]
4347
default = [
@@ -48,11 +52,15 @@ default = [
4852
"isotopes",
4953
"rand",
5054
"mzdata",
55+
"glycan-render",
56+
"glycan-render-bitmap",
5157
]
5258
imgt = []
5359
align = []
5460
identification = []
5561
isotopes = ["probability", "ndarray"]
62+
glycan-render = []
63+
glycan-render-bitmap = ["zeno", "swash", "glycan-render"]
5664

5765
[[bench]]
5866
name = "iai"

rustyms/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,5 @@ It has multiple features which allow you to slim it down if needed (all are enab
8080
* `rand` - allows the generation of random peptides.
8181
* `rayon` - enables parallel iterators using rayon, mostly for `imgt` but also in consecutive align.
8282
* `mzdata` - enables integration with [mzdata](https://github.com/mobiusklein/mzdata) which has more advanced raw file support.
83+
* `glycan-render` - enables the rendering to SVGs for glycans and glycan fragments
84+
* `glycan-render-bitmap` - enables the rendering to bitmaps for glycans, by enabling the optional dependencies zeno and swash

rustyms/data/glycan.mgf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ BEGIN IONS
22
PEPMASS=660.2457879192369
33
CHARGE=1+
44
TITLE=MS/MS scan at 1.535 min with Intensity: 604.0
5-
SEQUENCE=N[GlycanStructure:Hex(Hex,HexNAc)]
5+
SEQUENCE=N[G:G01141WK]
66

77
189.48956 5050.0
88
283.62076 5050.0

rustyms/images/glycan_root.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)