Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

jmzTab Columns

noedelta edited this page Aug 5, 2015 · 1 revision

Generate Column Header

In jmzTab API, we use MZTabColumnFactory to generate column header line. Currently, there are four types of MZTabColumn. Stable columns defined in the factory directly, which have stable logical position in the table section. Besides, we also provide ms_run optional columns, abundance optional columns, and user defined optional columns generate methods.

Generate Protein Column Header

MsRun msRun1 = new MsRun(1);
MsRun msRun2 = new MsRun(2);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

// create stable columns.
MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Protein_Header);
factory.addDefaultStableColumns();

// add optional columns which have stable order.
factory.addGoTermsOptionalColumn();
factory.addReliabilityOptionalColumn();
factory.addURIOptionalColumn();

// add ms_run optional columns
factory.addOptionalColumn(ProteinColumn.NUM_PSMS, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_UNIQUE, msRun1);

factory.addOptionalColumn(ProteinColumn.NUM_PSMS, msRun2);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun2);

factory.addBestSearchEngineScoreOptionalColumn(ProteinColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addBestSearchEngineScoreOptionalColumn(ProteinColumn.BEST_SEARCH_ENGINE_SCORE, 2);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 1, msRun1);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 2, msRun1);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 1, msRun2);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 2, msRun2);

// add abundance columns which locate the end of table.
factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);

// add user defined optional columns
factory.addOptionalColumn(msRun1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Generate Peptide Column Header

MsRun msRun1 = new MsRun(1);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

// create stable columns.
MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Peptide_Header);
factory.addDefaultStableColumns();

// add optional columns which have stable order.
factory.addReliabilityOptionalColumn();
factory.addURIOptionalColumn();

factory.addBestSearchEngineScoreOptionalColumn(PeptideColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addSearchEngineScoreOptionalColumn(PeptideColumn.SEARCH_ENGINE_SCORE, 1, msRun1);

// add abundance columns which locate the end of table.
factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);

// add user defined optional columns
factory.addOptionalColumn(msRun1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Generate PSM Column Header

Assay assay1 = new Assay(1);

// create stable columns.
MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.PSM_Header);
factory.addDefaultStableColumns();

// add optional columns which have stable order.
factory.addReliabilityOptionalColumn();
factory.addURIOptionalColumn();

factory.addSearchEngineScoreOptionalColumn(PSMColumn.SEARCH_ENGINE_SCORE, 1, null);

// add user defined optional columns
factory.addOptionalColumn(assay1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Generate Small Molecule Column Header

MsRun msRun1 = new MsRun(1);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

// create stable columns.
MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Small_Molecule);
factory.addDefaultStableColumns();

// add optional columns which have stable order.
factory.addReliabilityOptionalColumn();
factory.addURIOptionalColumn();

// add optional columns which have stable order.
factory.addBestSearchEngineScoreOptionalColumn(SmallMoleculeColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addSearchEngineScoreOptionalColumn(SmallMoleculeColumn.SEARCH_ENGINE_SCORE, 1, msRun1);

// add abundance columns which locate the end of table.
factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);

// add user defined optional columns
factory.addOptionalColumn(msRun1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Find Column by Header Name

There are two ways to get MZTabColumn.

MZTabColumn column = factory.findColumnByHeader("retention_time");
MZTabColumn column = factory.findColumnByHeader(ProteinColumn.ACCESSION.getHeader());
MZTabColumn column = factory.findColumnByPosition("1");
MZTabColumn column = factory.findColumnByPosition(ProteinColumn.ACCESSION.getOrder());

Fill Data

Fill Protein Data

// Create Protein Columns
MsRun msRun1 = new MsRun(1);
MsRun msRun2 = new MsRun(2);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Protein_Header);
factory.addDefaultStableColumns();
factory.addBestSearchEngineScoreOptionalColumn(ProteinColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 1, msRun1);
factory.addBestSearchEngineScoreOptionalColumn(ProteinColumn.BEST_SEARCH_ENGINE_SCORE, 2);
factory.addSearchEngineScoreOptionalColumn(ProteinColumn.SEARCH_ENGINE_SCORE, 2, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PSMS, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_UNIQUE, msRun1);
factory.addOptionalColumn(ProteinColumn.NUM_PSMS, msRun2);
factory.addOptionalColumn(ProteinColumn.NUM_PEPTIDES_DISTINCT, msRun2);

factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);

factory.addOptionalColumn(assay1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

//Fill data
Protein protein = new Protein(factory);

// set stable columns data.
protein.setAccession("P12345");
protein.setDescription("Aspartate aminotransferase, mitochondrial");
protein.setTaxid("10116");
protein.setSpecies("Rattus norvegicus (Rat)");
protein.setDatabase("UniProtKB");
protein.setDatabaseVersion("2011_11");
protein.setSearchEngine("[MS,MS:1001207,Mascot,]");
protein.addSearchEngineParam("[MS,MS:1001208,Sequest,]");
protein.setBestSearchEngineScore(1, "47");
protein.setBestSearchEngineScore(2, "88");
protein.setReliability(Reliability.High);
protein.setAmbiguityMembers("P12347,P12348");
protein.setModifications("3|4|8-MOD:00412, 3|4|8-MOD:00412");
protein.setURI("http://www.ebi.ac.uk/pride/url/to/P12345");
protein.setGOTerms("GO:0006457|GO:0005759|GO:0005886|GO:0004069");
protein.setProteinConverage("0.4");
System.out.println(protein);

// set optional columns which have stable order.
protein.setSearchEngineScore(1, msRun1, "50");
protein.setSearchEngineScore(2, msRun1, "60");
protein.setNumPSMs(msRun1, 4);
protein.setNumPSMs(msRun2, 2);
protein.setNumPeptidesDistinct(msRun1, 3);
protein.setNumPeptidesUnique(msRun1, 2);
System.out.println(protein);

// set abundance columns
protein.setAbundanceColumnValue(assay1, "0.4");
protein.setAbundanceColumnValue(assay2, "0.2");

protein.setAbundanceColumnValue(studyVariable1, "0.4");
protein.setAbundanceStdevColumnValue(studyVariable1, "0.3");
protein.setAbundanceStdErrorColumnValue(studyVariable1, "0.2");
System.out.println(protein);

// set user defined optional columns
protein.setOptionColumnValue(assay1, "my_value", "My value about assay[1]");
protein.setOptionColumnValue(param, "TOM value");

Fill Peptide Data

MsRun msRun1 = new MsRun(1);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Peptide_Header);
factory.addDefaultStableColumns();
factory.addBestSearchEngineScoreOptionalColumn(PeptideColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addSearchEngineScoreOptionalColumn(PeptideColumn.SEARCH_ENGINE_SCORE, 1, msRun1);
factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);
factory.addOptionalColumn(msRun1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Metadata metadata = new Metadata();
metadata.addMsRun(msRun1);
metadata.addMsRunLocation(1, new URL("file://C:\\path\\to\\my\\file"));

//Fill data
Peptide peptide = new Peptide(factory, metadata);

peptide.setSequence("KVPQVSTPTLVEVSR");
peptide.setAccession("P02768");
peptide.setUnique("0");
peptide.setDatabase("UniProtKB");
peptide.setDatabaseVersion("2011_11");
peptide.setSearchEngine("[MS,MS:1001207,Mascot,]|[MS,MS:1001208,Sequest,]");
peptide.setBestSearchEngineScore(1, 20d);
peptide.setSearchEngineScore(1, msRun1, 12d);
peptide.setReliability("3");
peptide.setModifications("3[MS,MS:1001876, modification probability, 0.8]|4[MS,MS:1001876, modification probability, 0.2]-MOD:00412,8[MS,MS:1001876, modification probability, 0.3]-MOD:00412");
peptide.setRetentionTime("10.2");
peptide.setRetentionTimeWindow("1123.2");
peptide.addRetentionTimeWindow(1145.3);
peptide.setCharge("2");
peptide.setMassToCharge("1234.4");
peptide.setURI("http://www.ebi.ac.uk/pride/link/to/peptide");
peptide.setSpectraRef("ms_run[1]:index=7|ms_run[1]:index=9");

Fill PSM Data

Assay assay1 = new Assay(1);

MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.PSM_Header);
factory.addDefaultStableColumns();
factory.addSearchEngineScoreOptionalColumn(PSMColumn.SEARCH_ENGINE_SCORE, 1, null);
factory.addOptionalColumn(assay1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Metadata metadata = new Metadata();
metadata.addMsRunLocation(1, new URL("file://C:\\path\\to\\my\\file"));

//Fill data
PSM psm = new PSM(factory, metadata);

psm.setSequence("KVPQVSTPTLVEVSR");
psm.setPSM_ID("1");
psm.setAccession("P02768");
psm.setUnique(MZBoolean.False);
psm.setDatabase("UniProtKB");
psm.setDatabaseVersion("2011_11");
psm.setSearchEngine("[MS,MS:1001207,Mascot,]|[MS,MS:1001208,Sequest,]");
psm.setSearchEngineScore(1, "2");
psm.setReliability("3");
psm.setModifications("CHEMMOD:+159.93");
psm.setRetentionTime("10.2");
psm.setCharge("2");
psm.setExpMassToCharge("1234.4");
psm.setCalcMassToCharge("123.4");
psm.setURI("http://www.ebi.ac.uk/pride/link/to/peptide");
psm.setSpectraRef("ms_run[1]:index=7|ms_run[1]:index=9");
psm.setPre("K");
psm.setPost("D");
psm.setStart("45");
psm.setEnd("57");

Fill Small Molecule Data

MsRun msRun1 = new MsRun(1);
Assay assay1 = new Assay(1);
Assay assay2 = new Assay(2);
StudyVariable studyVariable1 = new StudyVariable(1);

MZTabColumnFactory factory = MZTabColumnFactory.getInstance(Section.Small_Molecule);
factory.addDefaultStableColumns();
factory.addBestSearchEngineScoreOptionalColumn(SmallMoleculeColumn.BEST_SEARCH_ENGINE_SCORE, 1);
factory.addSearchEngineScoreOptionalColumn(SmallMoleculeColumn.SEARCH_ENGINE_SCORE, 1, msRun1);
factory.addAbundanceOptionalColumn(assay1);
factory.addAbundanceOptionalColumn(studyVariable1);
factory.addAbundanceOptionalColumn(assay2);
factory.addOptionalColumn(msRun1, "my_value", String.class);
CVParam param = new CVParam("MS", "MS:1002217", "decoy peptide", null);
factory.addOptionalColumn(param, String.class);

Metadata metadata = new Metadata();
metadata.addMsRun(msRun1);
metadata.addMsRunLocation(1, new URL("file://C:\\path\\to\\my\\file"));

//Fill data
SmallMolecule sm = new SmallMolecule(factory, metadata);
sm.setIdentifier("CID:00027395");
sm.setChemicalFormula("C17H20N4O2");
sm.setSmiles("C1=CC=C(C=C1)CCNC(=O)CCNNC(=O)C2=CC=NC=C2");
sm.setInchiKey("QXBMEGUKVLFJAM-UHFFFAOYSA-N");
sm.setDescription("N-(2-phenylethyl)-3-[2-(pyridine-4-carbonyl)hydrazinyl]propanamide");
sm.setExpMassToCharge("1234.4");
sm.setCalcMassToCharge("1234.5");
sm.setCharge("2");
sm.setRetentionTime("10.2|11.5");
sm.setTaxid("10116");
sm.setSpecies("Rattus norvegicus (Rat)");
sm.setDatabase("UniProtKB");
sm.setDatabaseVersion("2011_11");
sm.setReliability("2");
sm.setURI("http://www.ebi.ac.uk/pride/link/to/identification");
sm.setSpectraRef("ms_run[1]:index=7|ms_run[1]:index=9");
sm.setSearchEngine("[MS, MS:1001477, SpectraST,]");
sm.setBestSearchEngineScore(1, "0.7");
sm.setSearchEngineScore(1, msRun1, 12d);
sm.setModifications("CHEMMOD:+Na-H");
  • Introduction
  • [Create Metadata](jmzTab Metadata)
  • [Create Header and Fill Data](jmzTab Columns)
  • [Utilities](jmzTab Utilities)
  • [Warn/Error Messages](jmzTab Messages)
  • JavaDoc
  • [Release Notes](jmzTab Release Notes)
Clone this wiki locally