Skip to content

Commit

Permalink
Improve fasta reader.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Sep 6, 2017
1 parent 4ca9035 commit b4bf5f6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/proteomics/TheoSeq/DbTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class DbTool {
public DbTool(String db_name) {
String id = "";
String annotate;
String seq = "";
StringBuilder seq = new StringBuilder(99999);

boolean new_pro = true;

Expand All @@ -32,7 +32,7 @@ public DbTool(String db_name) {
// This line is a header
if (!new_pro) {
// This isn't the first protein
pro_seq_map.put(id, seq);
pro_seq_map.put(id, seq.toString());
}
id = head_matcher.group(1).trim();
annotate = head_matcher.group(2).trim();
Expand All @@ -41,15 +41,16 @@ public DbTool(String db_name) {
} else if (!line.isEmpty()) {
// This line is a body
if (new_pro) {
seq = line;
seq = new StringBuilder(99999);
seq.append(line);
new_pro = false;
} else {
seq += line;
seq.append(line);
}
}
}
// Last protein
pro_seq_map.put(id, seq);
pro_seq_map.put(id, seq.toString());
} catch (IOException | PatternSyntaxException ex) {
logger.error(ex.getMessage());
ex.printStackTrace();
Expand Down

0 comments on commit b4bf5f6

Please sign in to comment.