/** * Constructor. * * @param exportFeatures the features to export in this section * @param indexes indicates whether the line index should be written * @param header indicates whether the table header should be written * @param writer the writer which will write to the file */ public PsPeptideSection( ArrayList<ExportFeature> exportFeatures, boolean indexes, boolean header, ExportWriter writer) { ArrayList<ExportFeature> psmFeatures = new ArrayList<ExportFeature>(); for (ExportFeature exportFeature : exportFeatures) { if (exportFeature instanceof PsPeptideFeature) { peptideFeatures.add((PsPeptideFeature) exportFeature); } else if (exportFeature instanceof PsPsmFeature || exportFeature instanceof PsIdentificationAlgorithmMatchesFeature || exportFeature instanceof PsFragmentFeature) { psmFeatures.add(exportFeature); } else { throw new IllegalArgumentException( "Export feature of type " + exportFeature.getClass() + " not recognized."); } } Collections.sort(peptideFeatures); if (!psmFeatures.isEmpty()) { psmSection = new PsPsmSection(psmFeatures, indexes, header, writer); } this.indexes = indexes; this.header = header; this.writer = writer; }