public void writeEmptyResults(FastaSequence fasta) throws IOException {
    FileWriter writer = new FileWriter(ouptutFile);

    writer.write(fasta.getIdentifier());
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(fasta.getSequence());
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_LINE);

    writer.flush();

    writer.close();
  }
  private void writeBlastResults(
      Writer writer, BlastResults blastResult, FastaSequence fastaSequence) throws IOException {

    // candidate uniprot
    writer.write(NEW_COLUMN);
    writer.write(blastResult.getAccession());

    // write identity
    writer.write(NEW_COLUMN);
    writer.write(Float.toString(blastResult.getIdentity()));

    // write sequence coverages
    writer.write(NEW_COLUMN);
    writer.write(
        Float.toString(getQueryCoveragePercentFor(blastResult, fastaSequence.getSequence())));
    writer.write(NEW_COLUMN);
    writer.write(Float.toString(getMatchCoveragePercentFor(blastResult)));

    // write start/end
    writer.write(NEW_COLUMN);
    writer.write(Integer.toString(blastResult.getStartQuery()));
    writer.write("-");
    writer.write(Integer.toString(blastResult.getEndQuery()));
    writer.write(NEW_COLUMN);
    writer.write(Integer.toString(blastResult.getStartMatch()));
    writer.write("-");
    writer.write(Integer.toString(blastResult.getEndMatch()));

    // write query sequence
    writer.write(NEW_COLUMN);
    writer.write(fastaSequence.getSequence());
    // write alignment
    writer.write(NEW_COLUMN);
    writer.write(blastResult.getAlignment());
    // write matching sequence
    writer.write(NEW_COLUMN);
    writer.write(blastResult.getSequence());
    writer.write(NEW_LINE);

    writer.flush();
  }
  private void writeEmpytBlastResults(Writer writer, FastaSequence fastaSequence)
      throws IOException {

    // candidate uniprot
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);

    // write identity
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);

    // write sequence coverages
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);

    // write start/end
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);

    // write query sequence
    writer.write(NEW_COLUMN);
    writer.write(fastaSequence.getSequence());
    // write alignment
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    // write matching sequence
    writer.write(NEW_COLUMN);
    writer.write(EMPTY);
    writer.write(NEW_LINE);

    writer.flush();
  }
  public void writeResults(
      FastaSequence fastaSequence,
      IdentificationResults<? extends MappingReport> identificationResults)
      throws IOException {

    if (identificationResults == null) {
      throw new IllegalArgumentException("Identification results are expected");
    }

    if (fastaSequence == null) {
      throw new IllegalArgumentException("A fast sequence is expected");
    }

    BufferedWriter writer = new BufferedWriter(new FileWriter(ouptutFile, true));

    // PICR/swissprot remapping could identify one single uniprot id. We want to give the blast
    // results of swissprot remapping if necessary
    if (identificationResults.hasUniqueUniprotId()) {
      // fast identifier
      writer.write(fastaSequence.getIdentifier());

      // we retrieved the uniprot id from PICR
      writer.write(NEW_COLUMN);
      writer.write(identificationResults.getFinalUniprotId());

      // no other possible uniprot ids from PICR
      writer.write(NEW_COLUMN);
      writer.write(EMPTY);

      // check if last report is not blast remapping to be reviewed
      MappingReport report = identificationResults.getLastAction();
      if (report != null
          && report.getStatusLabel().equals(StatusLabel.TO_BE_REVIEWED)
          && report.getName().equals(ActionName.BLAST_Swissprot_Remapping)) {
        BlastReport<BlastResults> blastReport = (BlastReport<BlastResults>) report;

        // we have one result that can match
        Set<BlastResults> blastResults = blastReport.getBlastMatchingProteins();
        if (blastResults.size() == 1) {

          BlastResults blastResult = blastResults.iterator().next();

          writeBlastResults(writer, blastResult, fastaSequence);
        }
        // we don't write the other results
        else {

          writeEmpytBlastResults(writer, fastaSequence);
        }
      }
      // no swissprot remapping to review
      else {
        writeEmpytBlastResults(writer, fastaSequence);
      }
    } else {

      // PICR sequence to be reviewed ? if yes, no blast to report
      MappingReport report = identificationResults.getLastAction();
      if (report != null
          && report.getStatusLabel().equals(StatusLabel.TO_BE_REVIEWED)
          && (report.getName().equals(ActionName.PICR_sequence_Swissprot)
              || report.getName().equals(ActionName.PICR_sequence_Trembl))) {

        // fasta identifier
        writer.write(fastaSequence.getIdentifier());

        // no unique uniprot id
        writer.write(NEW_COLUMN);
        writer.write(EMPTY);

        // possible uniprot from PICR
        writer.write(NEW_COLUMN);
        writer.write(StringUtils.join(report.getPossibleAccessions(), ", "));

        writeEmpytBlastResults(writer, fastaSequence);
      }
      // for each blast to be reviewed, we need to write a line with blast results
      else if (report != null
          && report.getStatusLabel().equals(StatusLabel.TO_BE_REVIEWED)
          && report instanceof BlastReport) {
        BlastReport<BlastResults> blastReport = (BlastReport<BlastResults>) report;

        if (blastReport.getBlastMatchingProteins().isEmpty()) {
          writeEmptyResults(fastaSequence);
        } else {
          for (BlastResults blastResult : blastReport.getBlastMatchingProteins()) {
            // fasta identifier
            writer.write(fastaSequence.getIdentifier());

            // no unique uniprot id
            writer.write(NEW_COLUMN);
            writer.write(EMPTY);

            // no other possible uniprot ids from PICR
            writer.write(NEW_COLUMN);
            writer.write(EMPTY);

            writeBlastResults(writer, blastResult, fastaSequence);
          }
        }
      }
      // no blast results
      else {
        writeEmptyResults(fastaSequence);
      }
    }

    writer.flush();

    writer.close();
  }