/**
   * Method used to load the spectra chartData structure with the required chartData
   *
   * @param accessionNumber the experiment accession number
   * @throws SpectralDataPerExperimentException throws a SpectralDataPerExperimentException
   */
  private void initialize(String accessionNumber) throws SpectralDataPerExperimentException {
    spectra = new HashMap<String, SpectrumData>();
    // this.accessionNumber = accessionNumber;

    printMessage("Start");
    long start = System.currentTimeMillis();

    printMessage("Loading identified spectrum ", false);
    Map<String, Boolean> spectrumReferences = dbac.precursorSpectrumIdentified(accessionNumber);
    int cont = 0;
    int total = 0;
    for (String key : spectrumReferences.keySet()) {
      setSpectrumReferences(key, spectrumReferences.get(key));
      if (spectrumReferences.get(key)) cont++;
      total++;
    }
    printMessage("(found: " + cont + " identified of " + total + ")", false);
    long step1 = System.currentTimeMillis();
    printMessage("............ OK [" + (step1 - start) + " ms]");

    printMessage("Loading precursor mass chartData ", false);
    List<PrecursorData> precursorMass = dbac.precursorMassData(accessionNumber);
    for (PrecursorData pm : precursorMass) {
      setSpectrumPrecursorMass(pm);
    }
    // The precursor charge has been loaded from the database
    if (precursorMass.size() > 0) state.setPrecursorMassesLoaded(true);
    long step2 = System.currentTimeMillis();
    printMessage("............ OK [" + (step2 - step1) + " ms]");

    printMessage("Loading precursor charge chartData ", false);
    List<PrecursorData> precursorCharge = dbac.precursorChargeData(accessionNumber);
    for (PrecursorData pc : precursorCharge) {
      setSpectrumPrecursorCharge(pc);
    }
    // The precursor charge has been loaded from the database
    if (precursorCharge.size() > 0) state.setPrecursorChargesLoaded(true);
    long step3 = System.currentTimeMillis();
    printMessage("............ OK [" + (step3 - step2) + " ms]");

    // ToDo: What to do when precursorMass size is not the same than precursorCharge size

    printMessage("Loading MZ and Intensity values ", false);
    PeakListBasicInfo mzListBasicInfo = dbac.peakListMzInfo(accessionNumber);
    PeakListBasicInfo intensityListBasicInfo = dbac.peakListIntensityInfo(accessionNumber);
    if (mzListBasicInfo != null && intensityListBasicInfo != null) {
      PeakListManager mzData = new PeakListManager(dbac, mzListBasicInfo);
      PeakListManager intensityData = new PeakListManager(dbac, intensityListBasicInfo);
      Iterator<PeakList> mzIterator = mzData.iterator();
      Iterator<PeakList> intensityIterator = intensityData.iterator();
      while (mzIterator.hasNext() && intensityIterator.hasNext()) {
        PeakList mz = mzIterator.next();
        PeakList intensity = intensityIterator.next();
        processSpectrumMzData(mz, intensity);
        processSpectrumIntensityData(intensity);
      }
    }
    long step4 = System.currentTimeMillis();
    printMessage("............ OK [" + (step4 - step4) + " ms]");

    printMessage("Loading proteins identifications by peptides  ", false);
    setProteinsPeptides(dbac.getProteinsIdentification(accessionNumber));

    long step5 = System.currentTimeMillis();
    printMessage("............ OK [" + (step5 - step4) + " ms]");

    printMessage("Spectra Loaded [" + (step5 - start) / 1000 + " seconds]");

    dataControl();
  }
 public int getExperimentID() {
   if (experimentID == -1) experimentID = dbac.getExperimentID(accessionNumber);
   return experimentID;
 }