Skip to content

Commit

Permalink
Add functionality to support carrying over specific additional cvPara…
Browse files Browse the repository at this point in the history
…ms from mzML to mzid.

Adding upon request from Matt Chambers to support some IMS-specific CV params.
  • Loading branch information
FarmGeek4Life committed Jul 9, 2018
1 parent 049de36 commit c17cdc2
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/main/java/edu/ucsd/msjava/msutil/CvParamInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package edu.ucsd.msjava.msutil;

/**
* Stored information for a cvParam, for "copying" cvParams from mzML( and potentially other formats) to mzIdentML
* @author Bryson Gibbons
*/
public class CvParamInfo {
private String accession;
private String name;
private String value;
private String unitAccession;
private String unitName;
private Boolean hasUnit;

public CvParamInfo(String accession, String name, String value) {
this.accession = accession;
this.name = name;
this.value = value;
}

public CvParamInfo(String accession, String name, String value, String unitAccession, String unitName) {
this.accession = accession;
this.name = name;
this.value = value;
this.hasUnit = true;
this.unitAccession = unitAccession;
this.unitName = unitName;
}

public String getAccession() {
return this.accession;
}

public String getName() {
return this.name;
}

public String getValue() {
return this.value;
}

public Boolean getHasUnit() {
return this.hasUnit;
}

public String getUnitAccession() {
return this.unitAccession;
}

public String getUnitName() {
return this.unitName;
}
}
22 changes: 22 additions & 0 deletions src/main/java/edu/ucsd/msjava/msutil/Spectrum.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class Spectrum extends ArrayList<Peak> implements Comparable<Spectrum> {
// private Float fractionIonCurrent = null;
// private Integer numMS1Features = null;

private ArrayList<CvParamInfo> addlCvParams;

private Float isolationWindowTargetMz = null;

/***** CONSTRUCTORS *****/
Expand Down Expand Up @@ -268,6 +270,14 @@ public int getMSLevel() {
return this.msLevel;
}

/**
* Gets additional cvParams to output as cvParams under the mzIdentML SpectrumIdentificationResult
* @return cvParam necessary info
*/
public ArrayList<CvParamInfo> getAddlCvParams() {
return this.addlCvParams;
}

/***** SETTERS *****/

/**
Expand Down Expand Up @@ -495,6 +505,18 @@ public void setChargeIfSinglyCharged() {
if (ticBelowPrecursor / tic > 0.9f)
precursor.setCharge(1);
}

/**
* Add an additional cvParam to output as a cvParam under the mzIdentML SpectrumIdentificationResult
* @param cvParam
*/
public void addAddlCvParam(CvParamInfo cvParam) {
if (addlCvParams == null){
addlCvParams = new ArrayList<CvParamInfo>();
}

addlCvParams.add(cvParam);
}

/****** FUNCTIONS *****/
@Override
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/edu/ucsd/msjava/mzid/MZIdentMLGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ public synchronized void addSpectrumIdentificationResults(List<MSGFPlusMatch> re
sir.getCvParam().add(cvParam);
}

if (spec.getAddlCvParams() != null) {
for (CvParamInfo cvParamInfo : spec.getAddlCvParams()) {
CvParam cvParam = Constants.makeCvParam(cvParamInfo.getAccession(), cvParamInfo.getName());
cvParam.setValue(cvParamInfo.getValue());
if (cvParamInfo.getHasUnit()) {
cvParam.setUnitCv(Constants.unitCV);
cvParam.setUnitAccession(cvParamInfo.getUnitAccession());
cvParam.setUnitName(cvParamInfo.getUnitName());
}
sir.getCvParam().add(cvParam);
}
}

int rank = 0;
int resultCount = 0;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/edu/ucsd/msjava/mzml/SpectrumConverter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.ucsd.msjava.mzml;

import edu.ucsd.msjava.msutil.ActivationMethod;
import edu.ucsd.msjava.msutil.CvParamInfo;
import edu.ucsd.msjava.msutil.Peak;
import uk.ac.ebi.jmzml.model.mzml.*;

Expand Down Expand Up @@ -58,6 +59,20 @@ public static edu.ucsd.msjava.msutil.Spectrum getSpectrumFromJMzMLSpec(uk.ac.ebi
scanStartTimeIsSeconds = true;
}
}
// is_a: MS:1002892 ! ion mobility attribute cvParams
else if (cvParam.getAccession().equals("MS:1001581") // FAIMS compensation voltage
|| cvParam.getAccession().equals("MS:1002476") // ion mobility drift time
|| cvParam.getAccession().equals("MS:1002815")) { // inverse reduced ion mobility
CvParamInfo cvParamInfo;
if (cvParam.getUnitAccession() != null && !cvParam.getUnitAccession().isEmpty()) {
cvParamInfo = new CvParamInfo(cvParam.getAccession(), cvParam.getName(), cvParam.getValue(), cvParam.getUnitAccession(), cvParam.getUnitName());
}
else {
cvParamInfo = new CvParamInfo(cvParam.getAccession(), cvParam.getName(), cvParam.getValue());
}

spec.addAddlCvParam(cvParamInfo);
}
}
for (UserParam param : scanList.getScan().get(0).getUserParam()) {
if (param.getName().equals("[Thermo Trailer Extra]Monoisotopic M/Z:")) {
Expand Down

0 comments on commit c17cdc2

Please sign in to comment.