* @throws SQLException thrown if SQLException occurs
* @throws ClassNotFoundException thrown if ClassNotFoundException occurs
*/
public void loadCpsFile(String jarFilePath, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, ClassNotFoundException, SQLException {
CpsFileImporter cpsFileImporter = new CpsFileImporter(cpsFile, jarFilePath, waitingHandler);
// close any open connection to an identification database
if (identification != null) {
identification.close();
}
// Get the experiment data
experiment = cpsFileImporter.getExperiment();
ArrayList<Sample> samples = cpsFileImporter.getSamples();
if (samples == null || samples.isEmpty()) {
throw new IllegalArgumentException("No sample found for the experiment " + experiment.getReference());
}
sample = samples.get(0);
if (samples.size() > 1) { // pretty unlikely to happen for now
String message = samples.size() + " samples found in experiment " + experiment.getReference() + ", sample " + sample.getReference() + " selected by default.";
if (waitingHandler != null) {
waitingHandler.appendReport(message, true, true);
}
}
ArrayList<Integer> replicates = cpsFileImporter.getReplicates(sample);
if (replicates == null || replicates.isEmpty()) {
throw new IllegalArgumentException("No replicate found for the sample " + sample.getReference() + " of experiment " + experiment.getReference());
}
replicateNumber = replicates.get(0);
if (replicates.size() > 1) { // pretty unlikely to happen for now
if (waitingHandler != null) {
waitingHandler.appendReport(replicates.size() + " replicates found in sample " + sample.getReference()
+ " of experiment " + experiment.getReference() + ", replicate " + sample.getReference() + " selected by default.", true, true);
}
}
proteomicAnalysis = experiment.getAnalysisSet(sample).getProteomicAnalysis(replicateNumber);
// Get PeptideShaker settings
PeptideShakerSettings experimentSettings = cpsFileImporter.getExperimentSettings();
idFilter = experimentSettings.getIdFilter();
annotationPreferences = experimentSettings.getAnnotationPreferences();
spectrumCountingPreferences = experimentSettings.getSpectrumCountingPreferences();
ptmScoringPreferences = experimentSettings.getPTMScoringPreferences();
projectDetails = experimentSettings.getProjectDetails();