use of com.compomics.util.io.export.features.peptideshaker.PsAnnotationFeature in project peptide-shaker by compomics.
the class PsAnnotationSection method writeSection.
/**
* Writes the desired section.
*
* @param annotationPreferences the annotation preferences of the project
* @param waitingHandler the waiting handler
*
* @throws IOException exception thrown whenever an error occurred while
* writing the file.
*/
public void writeSection(AnnotationParameters annotationPreferences, WaitingHandler waitingHandler) throws IOException {
if (waitingHandler != null) {
waitingHandler.setSecondaryProgressCounterIndeterminate(true);
}
if (header) {
if (indexes) {
writer.writeHeaderText("");
writer.addSeparator();
}
writer.writeHeaderText("Parameter");
writer.addSeparator();
writer.writeHeaderText("Value");
writer.newLine();
}
int line = 1;
for (ExportFeature exportFeature : annotationFeatures) {
if (indexes) {
writer.write(Integer.toString(line));
writer.addSeparator();
}
writer.write(exportFeature.getTitle());
writer.addSeparator();
PsAnnotationFeature annotationFeature = (PsAnnotationFeature) exportFeature;
switch(annotationFeature) {
case automatic_annotation:
if (annotationPreferences.isAutomaticAnnotation()) {
writer.write("Yes");
} else {
writer.write("No");
}
break;
case fragment_ion_accuracy:
writer.write(Double.toString(annotationPreferences.getFragmentIonAccuracy()));
break;
case intensity_limit:
writer.write(Double.toString(annotationPreferences.getAnnotationIntensityLimit()));
break;
case neutral_losses:
String neutralLosses = annotationPreferences.getNeutralLosses().stream().map(neutralLoss -> neutralLoss.name).collect(Collectors.joining(", "));
writer.write(neutralLosses);
break;
case neutral_losses_sequence_dependence:
String value = annotationPreferences.areNeutralLossesSequenceAuto() ? "Yes" : "No";
writer.write(value);
break;
case selected_ions:
String ions = annotationPreferences.getFragmentIonTypes().stream().map(fragmentType -> PeptideFragmentIon.getSubTypeAsString(fragmentType)).collect(Collectors.joining(", "));
writer.write(ions);
break;
default:
writer.write("Not implemented");
}
writer.newLine();
line++;
}
}
Aggregations