diff --git a/fa-compression/src/main.rs b/fa-compression/src/main.rs index 24a01eb..6ba22bf 100644 --- a/fa-compression/src/main.rs +++ b/fa-compression/src/main.rs @@ -14,13 +14,13 @@ pub fn main() { let line = line.unwrap(); let splitted_line = line.split("\t").collect::>(); - let ec = splitted_line[7]; + let ec: String = splitted_line[7].split(';').map(|s| format!("EC:{}", s)).collect::>().join(";"); let go = splitted_line[8]; - let interpro = splitted_line[9]; + let interpro = splitted_line[9].split(';').map(|s| format!("IPR:{}", s)).collect::>().join(";"); let mut string = String::new(); if !ec.is_empty() { - string.push_str(ec); + string.push_str(&ec); string.push(';'); } if !go.is_empty() { @@ -28,10 +28,12 @@ pub fn main() { string.push(';'); } if !interpro.is_empty() { - string.push_str(interpro); + string.push_str(&interpro); string.push(';'); } - string.pop(); + if !string.is_empty() { + string.pop(); + } writer.write_all(format!("{}\t{}\t{}\t", splitted_line[1], splitted_line[3], splitted_line[6]).as_bytes()).unwrap(); writer.write_all(encode(&string).as_slice()).unwrap();