use of com.compomics.util.experiment.biology.aminoacids.AminoAcid in project peptide-shaker by compomics.
the class PeptideShakerGUI method getCurrentMassDeltas.
/**
* Get the current delta masses for use when annotating the spectra.
*
* @return the current delta masses
*/
public HashMap<Double, String> getCurrentMassDeltas() {
HashMap<Double, String> knownMassDeltas = new HashMap<>();
// add the monoisotopic amino acids masses
knownMassDeltas.put(AminoAcid.A.getMonoisotopicMass(), "A");
knownMassDeltas.put(AminoAcid.R.getMonoisotopicMass(), "R");
knownMassDeltas.put(AminoAcid.N.getMonoisotopicMass(), "N");
knownMassDeltas.put(AminoAcid.D.getMonoisotopicMass(), "D");
knownMassDeltas.put(AminoAcid.C.getMonoisotopicMass(), "C");
knownMassDeltas.put(AminoAcid.Q.getMonoisotopicMass(), "Q");
knownMassDeltas.put(AminoAcid.E.getMonoisotopicMass(), "E");
knownMassDeltas.put(AminoAcid.G.getMonoisotopicMass(), "G");
knownMassDeltas.put(AminoAcid.H.getMonoisotopicMass(), "H");
knownMassDeltas.put(AminoAcid.I.getMonoisotopicMass(), "I/L");
knownMassDeltas.put(AminoAcid.K.getMonoisotopicMass(), "K");
knownMassDeltas.put(AminoAcid.M.getMonoisotopicMass(), "M");
knownMassDeltas.put(AminoAcid.F.getMonoisotopicMass(), "F");
knownMassDeltas.put(AminoAcid.P.getMonoisotopicMass(), "P");
knownMassDeltas.put(AminoAcid.S.getMonoisotopicMass(), "S");
knownMassDeltas.put(AminoAcid.T.getMonoisotopicMass(), "T");
knownMassDeltas.put(AminoAcid.W.getMonoisotopicMass(), "W");
knownMassDeltas.put(AminoAcid.Y.getMonoisotopicMass(), "Y");
knownMassDeltas.put(AminoAcid.V.getMonoisotopicMass(), "V");
knownMassDeltas.put(AminoAcid.U.getMonoisotopicMass(), "U");
knownMassDeltas.put(AminoAcid.O.getMonoisotopicMass(), "O");
// add default neutral losses
// knownMassDeltas.put(NeutralLoss.H2O.mass, "H2O");
// knownMassDeltas.put(NeutralLoss.NH3.mass, "NH3");
// knownMassDeltas.put(NeutralLoss.CH4OS.mass, "CH4OS");
// knownMassDeltas.put(NeutralLoss.H3PO4.mass, "H3PO4");
// knownMassDeltas.put(NeutralLoss.HPO3.mass, "HPO3");
// knownMassDeltas.put(4d, "18O"); // @TODO: should this be added to neutral losses??
// knownMassDeltas.put(44d, "PEG"); // @TODO: should this be added to neutral losses??
// add the modifications
SearchParameters searchParameters = getIdentificationParameters().getSearchParameters();
ModificationParameters modificationProfile = searchParameters.getModificationParameters();
ArrayList<String> modificationList = modificationProfile.getAllModifications();
Collections.sort(modificationList);
// iterate the modifications list and add the non-terminal modifications
for (String modName : modificationList) {
Modification modification = modificationFactory.getModification(modName);
if (modification.getModificationType() == ModificationType.modaa) {
for (char aa : modification.getPattern().getAminoAcidsAtTarget()) {
AminoAcid aminoAcid = AminoAcid.getAminoAcid(aa);
double massKey = aminoAcid.getMonoisotopicMass() + modification.getMass();
String annotationValue = String.join("", Character.toString(aa), "<", modification.getShortName(), ">");
knownMassDeltas.put(massKey, annotationValue);
}
}
}
return knownMassDeltas;
}
use of com.compomics.util.experiment.biology.aminoacids.AminoAcid in project peptide-shaker by compomics.
the class PepXmlExport method getModLine.
/**
* Gets the line for a modification.
*
* @param modification the modification
* @param variable a boolean indicating whether the modification is variable
*
* @return the line for a modification
*/
private String getModLine(Modification modification, boolean variable) {
StringBuilder modificationLine = new StringBuilder();
ModificationType modificationType = modification.getModificationType();
if (modificationType == ModificationType.modaa || modificationType == ModificationType.modnaa_peptide || modificationType == ModificationType.modnaa_protein || modificationType == ModificationType.modcaa_peptide || modificationType == ModificationType.modcaa_protein) {
modificationLine.append("<aminoacid_modification ");
AminoAcidPattern aminoAcidPattern = modification.getPattern();
modificationLine.append("aminoacid=\"").append(aminoAcidPattern.toString()).append("\" ");
modificationLine.append("massdiff=\"").append(modification.getMass()).append("\" ");
if (aminoAcidPattern.getAminoAcidsAtTarget().size() == 1) {
Character aa = aminoAcidPattern.getAminoAcidsAtTarget().get(0);
AminoAcid aminoAcid = AminoAcid.getAminoAcid(aa);
if (!aminoAcid.iscombination()) {
Double mass = aminoAcid.getMonoisotopicMass() + modification.getMass();
modificationLine.append("mass=\"").append(mass).append("\" ");
}
}
if (modificationType.isCTerm()) {
modificationLine.append("peptide_terminus=\"c\" ");
}
if (modificationType.isNTerm()) {
modificationLine.append("peptide_terminus=\"n\" ");
}
} else {
modificationLine.append("<terminal_modification ");
if (modificationType.isCTerm()) {
modificationLine.append("terminus=\"c\" ");
}
if (modificationType.isNTerm()) {
modificationLine.append("terminus=\"n\" ");
}
modificationLine.append("massdiff=\"").append(modification.getMass()).append("\" ");
if (modificationType == ModificationType.modc_protein) {
modificationLine.append("protein_terminus=\"c\" ");
}
if (modificationType == ModificationType.modn_protein) {
modificationLine.append("protein_terminus=\"n\" ");
}
if (modificationType.isNTerm()) {
double mass = Atom.H.getMonoisotopicMass() + modification.getMass();
modificationLine.append("mass=\"").append(mass).append("\" ");
}
if (modificationType.isCTerm()) {
double mass = Atom.H.getMonoisotopicMass() + Atom.O.getMonoisotopicMass() + modification.getMass();
modificationLine.append("mass=\"").append(mass).append("\" ");
}
}
if (variable) {
modificationLine.append("variable=\"Y\" ");
} else {
modificationLine.append("variable=\"N\" ");
}
modificationLine.append("symbol=\"").append(modification.getName()).append("\" ");
CvTerm cvTerm = modification.getUnimodCvTerm();
if (cvTerm != null) {
modificationLine.append("description=\"").append(cvTerm.getAccession()).append("\"");
} else {
// try PSI-MOD instead
cvTerm = modification.getPsiModCvTerm();
if (cvTerm != null) {
modificationLine.append("description=\"").append(cvTerm.getAccession()).append("\"");
}
}
modificationLine.append("/>");
return modificationLine.toString();
}
Aggregations