public static void writeProteinBestMatchesToFile(String filePath,Map<String,PIRSFHmmer2RawMatch> proteinIdBestMatchMap) throws IOException {
  BufferedWriter writer=null;
  try {
    File file=createTmpFile(filePath);
    if (!file.exists()) {
      throw new IllegalStateException("Could not create file: " + filePath);
    }
    writer=new BufferedWriter(new FileWriter(file));
    for (    String proteinId : proteinIdBestMatchMap.keySet()) {
      PIRSFHmmer2RawMatch bestMatch=proteinIdBestMatchMap.get(proteinId);
      if (bestMatch != null) {
        writer.write(proteinId);
        writer.write('-');
        writer.write(bestMatch.getModelId());
        writer.write(',');
        writer.write(bestMatch.getSignatureLibraryRelease());
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getLocationStart()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getLocationEnd()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getEvalue()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getScore()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getHmmStart()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getHmmEnd()));
        writer.write(',');
        writer.write(bestMatch.getHmmBounds());
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getLocationEvalue()));
        writer.write(',');
        writer.write(String.valueOf(bestMatch.getLocationScore()));
        writer.write('\n');
      }
    }
  }
  finally {
    if (writer != null) {
      writer.close();
    }
  }
}

public static void writeProteinBestMatchesToFile ( String filePath , Map < String , PIRSFHmmer2RawMatch > proteinIdBestMatchMap ) throws IOException { BufferedWriter writer = null ; try { File file = createTmpFile ( filePath ) ; if ( ! file . exists ( ) ) { throw new IllegalStateException ( "Could not create file: " + filePath ) ; } writer = new BufferedWriter ( new FileWriter ( file ) ) ; for ( String proteinId : proteinIdBestMatchMap . keySet ( ) ) { PIRSFHmmer2RawMatch bestMatch = proteinIdBestMatchMap . get ( proteinId ) ; if ( bestMatch != null ) { writer . write ( proteinId ) ; writer . write ( '-' ) ; writer . write ( bestMatch . getModelId ( ) ) ; writer . write ( ',' ) ; writer . write ( bestMatch . getSignatureLibraryRelease ( ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getLocationStart ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getLocationEnd ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getEvalue ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getScore ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getHmmStart ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getHmmEnd ( ) ) ) ; writer . write ( ',' ) ; writer . write ( bestMatch . getHmmBounds ( ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getLocationEvalue ( ) ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( bestMatch . getLocationScore ( ) ) ) ; writer . write ( '\n' ) ; } } } finally { if ( writer != null ) { writer . close ( ) ; } } }
write out raw protein details into a temporary file so the data can be made available for later steps in the job . with pirsf , only the best match ( smallest e - value ) is of interest for each protein .
