public Set<RawProtein<SuperFamilyHmmer3RawMatch>> parse(InputStream is) throws IOException {
  Map<String,RawProtein<SuperFamilyHmmer3RawMatch>> data=new HashMap<String,RawProtein<SuperFamilyHmmer3RawMatch>>();
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new InputStreamReader(is));
    String line;
    while ((line=reader.readLine()) != null) {
      Set<SuperFamilyHmmer3RawMatch> rawMatches=parseLine(line);
      SuperFamilyHmmer3RawMatch rawMatch;
      for (      SuperFamilyHmmer3RawMatch rawMatche : rawMatches) {
        rawMatch=rawMatche;
        String sequenceId=rawMatch.getSequenceIdentifier();
        if (data.containsKey(sequenceId)) {
          RawProtein<SuperFamilyHmmer3RawMatch> rawProtein=data.get(sequenceId);
          rawProtein.addMatch(rawMatch);
        }
 else {
          RawProtein<SuperFamilyHmmer3RawMatch> rawProtein=new RawProtein<SuperFamilyHmmer3RawMatch>(sequenceId);
          rawProtein.addMatch(rawMatch);
          data.put(sequenceId,rawProtein);
        }
      }
    }
  }
  finally {
    if (reader != null) {
      reader.close();
    }
  }
  return new HashSet<RawProtein<SuperFamilyHmmer3RawMatch>>(data.values());
}

public Set < RawProtein < SuperFamilyHmmer3RawMatch > > parse ( InputStream is ) throws IOException { Map < String , RawProtein < SuperFamilyHmmer3RawMatch > > data = new HashMap < String , RawProtein < SuperFamilyHmmer3RawMatch > > ( ) ; BufferedReader reader = null ; try { reader = new BufferedReader ( new InputStreamReader ( is ) ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { Set < SuperFamilyHmmer3RawMatch > rawMatches = parseLine ( line ) ; SuperFamilyHmmer3RawMatch rawMatch ; for ( SuperFamilyHmmer3RawMatch rawMatche : rawMatches ) { rawMatch = rawMatche ; String sequenceId = rawMatch . getSequenceIdentifier ( ) ; if ( data . containsKey ( sequenceId ) ) { RawProtein < SuperFamilyHmmer3RawMatch > rawProtein = data . get ( sequenceId ) ; rawProtein . addMatch ( rawMatch ) ; } else { RawProtein < SuperFamilyHmmer3RawMatch > rawProtein = new RawProtein < SuperFamilyHmmer3RawMatch > ( sequenceId ) ; rawProtein . addMatch ( rawMatch ) ; data . put ( sequenceId , rawProtein ) ; } } } } finally { if ( reader != null ) { reader . close ( ) ; } } return new HashSet < RawProtein < SuperFamilyHmmer3RawMatch > > ( data . values ( ) ) ; }
parse the temporary file . if a line cannot be parsed ( not the expected format ) the line is ignored ( but is logged ) .
