diff --git a/fa-compression/src/algorithm1/decode.rs b/fa-compression/src/algorithm1/decode.rs index 453f107..c24fc4b 100644 --- a/fa-compression/src/algorithm1/decode.rs +++ b/fa-compression/src/algorithm1/decode.rs @@ -82,23 +82,23 @@ mod tests { #[test] fn test_decode_single_ec() { - assert_eq!(decode(&[44, 44, 44, 189, 208]), "EC:1.1.1.-") + assert_eq!(decode(&[44, 44, 44, 190, 224]), "EC:1.1.1.-") } #[test] fn test_decode_single_go() { - assert_eq!(decode(&[209, 17, 163, 138, 208]), "GO:0009279") + assert_eq!(decode(&[225, 17, 163, 138, 224]), "GO:0009279") } #[test] fn test_decode_single_ipr() { - assert_eq!(decode(&[221, 18, 116, 117]), "IPR:IPR016364") + assert_eq!(decode(&[238, 18, 116, 117]), "IPR:IPR016364") } #[test] fn test_decode_no_ec() { assert_eq!( - decode(&[209, 17, 163, 138, 209, 39, 71, 94, 17, 153, 39]), + decode(&[225, 17, 163, 138, 225, 39, 71, 95, 17, 153, 39]), "GO:0009279;IPR:IPR016364;IPR:IPR008816" ) } @@ -106,7 +106,7 @@ mod tests { #[test] fn test_decode_no_go() { assert_eq!( - decode(&[44, 44, 44, 190, 44, 60, 44, 141, 209, 39, 71, 80]), + decode(&[44, 44, 44, 191, 44, 60, 44, 142, 225, 39, 71, 80]), "EC:1.1.1.-;EC:1.2.1.7;IPR:IPR016364" ) } @@ -114,7 +114,7 @@ mod tests { #[test] fn test_decode_no_ipr() { assert_eq!( - decode(&[44, 44, 44, 189, 17, 26, 56, 174, 17, 26, 56, 173]), + decode(&[44, 44, 44, 190, 17, 26, 56, 175, 17, 26, 56, 174]), "EC:1.1.1.-;GO:0009279;GO:0009279" ) } @@ -123,7 +123,7 @@ mod tests { fn test_decode_all() { assert_eq!( decode(&[ - 44, 44, 44, 189, 17, 26, 56, 173, 18, 116, 117, 225, 67, 116, 110, 17, 153, 39 + 44, 44, 44, 190, 17, 26, 56, 174, 18, 116, 117, 241, 67, 116, 111, 17, 153, 39 ]), "EC:1.1.1.-;GO:0009279;IPR:IPR016364;IPR:IPR032635;IPR:IPR008816" ) diff --git a/fa-compression/src/algorithm1/encode.rs b/fa-compression/src/algorithm1/encode.rs index 8cce9cd..e33351d 100644 --- a/fa-compression/src/algorithm1/encode.rs +++ b/fa-compression/src/algorithm1/encode.rs @@ -94,24 +94,24 @@ mod tests { #[test] fn test_encode_single_ec() { - assert_eq!(encode("EC:1.1.1.-"), vec![44, 44, 44, 189, 208]) + assert_eq!(encode("EC:1.1.1.-"), vec![44, 44, 44, 190, 224]) } #[test] fn test_encode_single_go() { - assert_eq!(encode("GO:0009279"), vec![209, 17, 163, 138, 208]) + assert_eq!(encode("GO:0009279"), vec![225, 17, 163, 138, 224]) } #[test] fn test_encode_single_ipr() { - assert_eq!(encode("IPR:IPR016364"), vec![221, 18, 116, 117]) + assert_eq!(encode("IPR:IPR016364"), vec![238, 18, 116, 117]) } #[test] fn test_encode_no_ec() { assert_eq!( encode("IPR:IPR016364;GO:0009279;IPR:IPR008816"), - vec![209, 17, 163, 138, 209, 39, 71, 94, 17, 153, 39] + vec![225, 17, 163, 138, 225, 39, 71, 95, 17, 153, 39] ) } @@ -119,7 +119,7 @@ mod tests { fn test_encode_no_go() { assert_eq!( encode("IPR:IPR016364;EC:1.1.1.-;EC:1.2.1.7"), - vec![44, 44, 44, 190, 44, 60, 44, 141, 209, 39, 71, 80] + vec![44, 44, 44, 191, 44, 60, 44, 142, 225, 39, 71, 80] ) } @@ -127,7 +127,7 @@ mod tests { fn test_encode_no_ipr() { assert_eq!( encode("EC:1.1.1.-;GO:0009279;GO:0009279"), - vec![44, 44, 44, 189, 17, 26, 56, 174, 17, 26, 56, 173] + vec![44, 44, 44, 190, 17, 26, 56, 175, 17, 26, 56, 174] ) } @@ -135,7 +135,7 @@ mod tests { fn test_encode_all() { assert_eq!( encode("IPR:IPR016364;EC:1.1.1.-;IPR:IPR032635;GO:0009279;IPR:IPR008816"), - vec![44, 44, 44, 189, 17, 26, 56, 173, 18, 116, 117, 225, 67, 116, 110, 17, 153, 39] + vec![44, 44, 44, 190, 17, 26, 56, 174, 18, 116, 117, 241, 67, 116, 111, 17, 153, 39] ) } } diff --git a/fa-compression/src/algorithm1/mod.rs b/fa-compression/src/algorithm1/mod.rs index 3a1d9b4..5c62e7c 100644 --- a/fa-compression/src/algorithm1/mod.rs +++ b/fa-compression/src/algorithm1/mod.rs @@ -73,6 +73,7 @@ enum CharacterSet { /// Special Enzyme Commission characters Dash, Point, + Preliminary, /// Different annotation type separator Comma, @@ -106,6 +107,7 @@ impl Encode for CharacterSet { b'9' => CharacterSet::Nine, b'-' => CharacterSet::Dash, b'.' => CharacterSet::Point, + b'n' => CharacterSet::Preliminary, b',' => CharacterSet::Comma, b';' => CharacterSet::Semicolon, _ => panic!("Invalid character") @@ -138,8 +140,9 @@ impl Decode for CharacterSet { 10 => '9', 11 => '-', 12 => '.', - 13 => ',', - 14 => ';', + 13 => 'n', + 14 => ',', + 15 => ';', _ => panic!("Invalid character") } } @@ -167,10 +170,10 @@ impl BitOr for CharacterSet { mod tests { use super::*; - static CHARACTERS: [u8; 15] = - [b'$', b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'-', b'.', b',', b';']; + static CHARACTERS: [u8; 16] = + [b'$', b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'-', b'.', b'n', b',', b';']; - static CHARACTER_SETS: [CharacterSet; 15] = [ + static CHARACTER_SETS: [CharacterSet; 16] = [ CharacterSet::Empty, CharacterSet::Zero, CharacterSet::One, @@ -184,6 +187,7 @@ mod tests { CharacterSet::Nine, CharacterSet::Dash, CharacterSet::Point, + CharacterSet::Preliminary, CharacterSet::Comma, CharacterSet::Semicolon ]; @@ -233,13 +237,7 @@ mod tests { #[test] #[should_panic] fn test_decode_invalid() { - CharacterSet::decode(15); - } - - #[test] - #[should_panic] - fn test_decode_pair_invalid() { - CharacterSet::decode_pair(0b11111111); + CharacterSet::decode(16); } #[test]