public void addBestSearchEngineScoreOptionalColumn(MZTabColumn column, Integer id) { String position = column.getLogicPosition(); if (optionalColumnMapping.containsKey(position)) { throw new IllegalArgumentException( "There exists column " + optionalColumnMapping.get(position) + " in position " + position); } MZTabColumn newColumn = null; switch (section) { case Protein_Header: if (column.getName().equals(ProteinColumn.BEST_SEARCH_ENGINE_SCORE.getName())) { newColumn = MZTabColumn.createOptionalColumn(section, column, id, null); } break; case Peptide_Header: if (column.getName().equals(PeptideColumn.BEST_SEARCH_ENGINE_SCORE.getName())) { newColumn = MZTabColumn.createOptionalColumn(section, column, id, null); } break; case Small_Molecule_Header: if (column.getName().equals(SmallMoleculeColumn.BEST_SEARCH_ENGINE_SCORE.getName())) { newColumn = MZTabColumn.createOptionalColumn(section, column, id, null); } break; } if (newColumn != null) { optionalColumnMapping.put(newColumn.getLogicPosition(), newColumn); columnMapping.put(newColumn.getLogicPosition(), newColumn); } }
/** * Add {@link AbundanceColumn} into {@link AbundanceColumn}, {@link #optionalColumnMapping} and * {@link #columnMapping}. The header like: {Section}_abundance_assay[1] * * @see AbundanceColumn#createOptionalColumn(Section, Assay, int) * @param assay SHOULD NOT empty. */ public String addAbundanceOptionalColumn(Assay assay) { MZTabColumn column = AbundanceColumn.createOptionalColumn( section, assay, new Integer(getColumnOrder(columnMapping.lastKey()))); abundanceColumnMapping.put(column.getLogicPosition(), column); return addOptionColumn(column); }
private String addOptionColumn(MZTabColumn column) { String logicalPosition = column.getLogicPosition(); optionalColumnMapping.put(logicalPosition, column); columnMapping.put(column.getLogicPosition(), column); return logicalPosition; }
/** @return tab split column header string list. */ public SplitList<String> getHeaderList() { SplitList<String> headerList = new SplitList<String>(TAB); for (MZTabColumn mzTabColumn : columnMapping.values()) { headerList.add(mzTabColumn.getHeader()); } return headerList; }
/** * Add {@link ProteinColumn#GO_TERMS} into {@link #optionalColumnMapping} and {@link * #columnMapping}. * * <p>Notice: this function only used in {@link Section#Protein_Header} */ public void addGoTermsOptionalColumn() { if (section != Section.Protein_Header) { throw new IllegalArgumentException( "go_terms optional column only add into the protein section."); } MZTabColumn column = ProteinColumn.GO_TERMS; optionalColumnMapping.put(column.getLogicPosition(), column); columnMapping.put(column.getLogicPosition(), column); }
/** * Query the MZTabColumn in factory, based on column header with case-insensitive. Notice: for * optional columns, header name maybe flexible. For example, num_psms_ms_run[1]. At this time, * user SHOULD BE provide the full header name to query MZTabColumn. If just provide * num_psms_ms_run, return null. */ public MZTabColumn findColumnByHeader(String header) { header = header.trim(); for (MZTabColumn column : columnMapping.values()) { if (header.equalsIgnoreCase(column.getHeader())) { return column; } } return null; }
/** Add URI optional column into {@link #optionalColumnMapping} and {@link #columnMapping}. */ public void addURIOptionalColumn() { MZTabColumn column = null; switch (section) { case Protein_Header: column = ProteinColumn.URI; break; case Peptide_Header: column = PeptideColumn.URI; break; case Small_Molecule_Header: column = SmallMoleculeColumn.URI; break; case PSM_Header: column = PSMColumn.URI; break; } if (column != null) { optionalColumnMapping.put(column.getLogicPosition(), column); columnMapping.put(column.getLogicPosition(), column); } }
/** * Add a optional column which has stable order and name, into {@link #optionalColumnMapping} and * {@link #columnMapping}. * * @see MZTabColumn#createOptionalColumn(Section, MZTabColumn, Integer, IndexedElement) * @exception IllegalArgumentException: If user would like to add duplicate optional columns. * @param column SHOULD NOT set null. * @param msRun SHOULD NOT set null. */ public void addOptionalColumn(MZTabColumn column, MsRun msRun) { String position = column.getLogicPosition(); if (optionalColumnMapping.containsKey(position)) { throw new IllegalArgumentException( "There exists column " + optionalColumnMapping.get(position) + " in position " + position); } MZTabColumn newColumn = null; // switch (section) { // case Protein_Header: // if (column.getName().equals(ProteinColumn.NUM_PSMS.getName()) || // column.getName().equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getName()) // || // column.getName().equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getName())) // { // newColumn = MZTabColumn.createOptionalColumn(section, column, msRun); // } // // if (position.equals(ProteinColumn.SEARCH_ENGINE_SCORE.getOrder()) || // position.equals(ProteinColumn.NUM_PSMS.getOrder()) || // position.equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getOrder()) || // position.equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getOrder())) { // newColumn = MZTabColumn.createOptionalColumn(section, column, msRun); // } // break; // case Peptide_Header: // if (position.equals(PeptideColumn.SEARCH_ENGINE_SCORE.getOrder())) { // newColumn = MZTabColumn.createOptionalColumn(section, column, msRun); // } // break; // case Small_Molecule_Header: // if (position.equals(SmallMoleculeColumn.SEARCH_ENGINE_SCORE.getOrder())) { // newColumn = MZTabColumn.createOptionalColumn(section, column, msRun); // } // break; // } if (section == Section.Protein_Header) { if (column.getName().equals(ProteinColumn.NUM_PSMS.getName()) || column.getName().equals(ProteinColumn.NUM_PEPTIDES_DISTINCT.getName()) || column.getName().equals(ProteinColumn.NUM_PEPTIDES_UNIQUE.getName())) { newColumn = MZTabColumn.createOptionalColumn(section, column, null, msRun); } } if (newColumn != null) { optionalColumnMapping.put(newColumn.getLogicPosition(), newColumn); columnMapping.put(newColumn.getLogicPosition(), newColumn); } }
private static void addStableColumn(MZTabColumnFactory factory, MZTabColumn column) { factory.stableColumnMapping.put(column.getLogicPosition(), column); }