Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tibvdm committed Apr 15, 2024
1 parent b991df7 commit eeb9529
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions fa-compression/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@ pub fn main() {
let line = line.unwrap();
let splitted_line = line.split("\t").collect::<Vec<&str>>();

let ec = splitted_line[7];
let ec: String = splitted_line[7].split(';').map(|s| format!("EC:{}", s)).collect::<Vec<String>>().join(";");
let go = splitted_line[8];
let interpro = splitted_line[9];
let interpro = splitted_line[9].split(';').map(|s| format!("IPR:{}", s)).collect::<Vec<String>>().join(";");

let mut string = String::new();
if !ec.is_empty() {
string.push_str(ec);
string.push_str(&ec);
string.push(';');
}
if !go.is_empty() {
string.push_str(go);
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();
Expand Down

0 comments on commit eeb9529

Please sign in to comment.