Skip to content

Commit

Permalink
Fixed some glycan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
douweschulte committed Feb 16, 2024
1 parent a54f669 commit caca2ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Binary file modified rustyms/databases/glycosmos_glycans_list.csv.gz
Binary file not shown.
5 changes: 3 additions & 2 deletions rustyms/src/shared/glycan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ impl MonoSaccharide {
index += 1;
}
}
index += line[index..].ignore(&["?"]); // I guess to indicate partial structures
Ok((sugar, index))
}

Expand Down Expand Up @@ -286,7 +287,7 @@ impl ParseHelper for &str {
let mut index = 0;
let mut amount = 1;
let mut double = false;
if bytes[0].is_ascii_digit() || bytes[0] == b'?' {
if bytes[0].is_ascii_digit() || bytes[0] == b'?' && bytes.len() > 1 {
match bytes[1] {
b',' => {
let num = bytes[1..]
Expand Down Expand Up @@ -1351,7 +1352,7 @@ impl GlycanStructure {
/// # Panics
/// It panics if a brace was not closed that was not close to the end of the input (more then 10 bytes from the end).
fn ignore_linking_information(bytes: &[u8], mut offset: usize, range: &Range<usize>) -> usize {
if bytes[offset] == b'(' {
if offset < bytes.len() && bytes[offset] == b'(' {
if let Some(end) = next_char(bytes, offset + 1, b')') {
offset = end + 1; // just ignore all linking stuff I do not care
} else {
Expand Down

0 comments on commit caca2ba

Please sign in to comment.