Search in sources :

Example 1 with ModificationPeptide

use of net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide in project mzmine2 by mzmine.

the class MascotParserUtils method parsePeptideInfo.

/*
   * String "info" is divided into three sections by ";", which the first one is peptide, second
   * protein and third is peptide terminals.
   * 
   * Peptide section must have 11 elements: missed cleavages, peptide mass, delta mass, number of
   * matched ions, aa sequence, peaks used from ion 1, variable modifications (binary code), ion
   * score, ion series, peaks used from ions2, peaks used from ion 3
   * 
   * Protein section must have 5 elements: accesion name, frame number, start, stop and multiplicity
   * 
   * Peptide terminal section must have 2 elements; left aa, right aa of the sequence
   * 
   * Example=' 1,743.428955,0.000893,5,KGAAQLR,25,000001000,27.19,0002001000000000000 ,0,0;
   * "SPBC839.04":0:23:29:1,"SPBC2F12.07c":0:23:29:1,"SPAC1F7.13c":0:23:29:1; R,T:R,T:R,T '
   */
public static Peptide[] parsePeptideInfo(int queryNumber, String info, double mass, double massExpected, int precursorCharge, PeptideIdentityDataFile pepDataFile, double identityThreshold, boolean isTopScore) {
    String[] tokens = info.split(";");
    String peptideSection = tokens[0];
    String proteinSection = tokens[1];
    String terminalSection = tokens[2];
    // Terminals
    tokens = terminalSection.split(":");
    String[] peptideInfos = new String[tokens.length];
    for (int i = 0; i < tokens.length; i++) {
        peptideInfos[i] = peptideSection + "," + tokens[i];
    }
    // Proteins
    tokens = proteinSection.split(",");
    String[] proteinInfos = new String[tokens.length];
    for (int i = 0; i < tokens.length; i++) {
        proteinInfos[i] = tokens[i];
    }
    if (proteinInfos.length != peptideInfos.length)
        return null;
    Vector<Peptide> peptides = new Vector<Peptide>();
    // Peptide
    for (int pepIndex = 0; pepIndex < peptideInfos.length; pepIndex++) {
        tokens = peptideInfos[pepIndex].split(",");
        int missedCleavages = Integer.parseInt(tokens[0]);
        double precursorMass = Double.parseDouble(tokens[1]);
        double deltaMass = Double.parseDouble(tokens[2]);
        String sequence = tokens[11] + tokens[4] + tokens[12];
        String modSeries = tokens[6];
        double ionScore = Double.parseDouble(tokens[7]);
        if (ionScore >= identityThreshold)
            continue;
        Peptide peptide = new Peptide(queryNumber, sequence, ionScore, mass, massExpected, precursorCharge, precursorMass, deltaMass, missedCleavages, null, "Mascot", isTopScore);
        HashMap<Integer, ModificationPeptide> modifications = new HashMap<Integer, ModificationPeptide>();
        ModificationPeptide[] searchedMods = pepDataFile.getSearchedModifications();
        // site.
        for (int pos = 0; pos < modSeries.length(); pos++) {
            if (modSeries.charAt(pos) == '1') {
                char aa = sequence.charAt(pos);
                for (int index = 0; index < searchedMods.length; index++) {
                    if (searchedMods[index].getSite() == aa) {
                        modifications.put(pos, searchedMods[index]);
                    }
                }
            }
        }
        peptide.setModifications(modifications);
        // Ion serie
        PeptideIonSerie peptideIonSerie = parseIonSeriesSignificance(tokens[8]);
        peptide.setIonSeries(peptideIonSerie);
        // Calculate fragmentation
        PeptideFragmentation fragmentation = new PeptideFragmentation(peptide, pepDataFile);
        peptide.setFragmentation(fragmentation);
        // Protein info
        ProteinSection section;
        tokens = proteinInfos[pepIndex].split(":");
        String sysname = tokens[0].replace("\"", "");
        Protein protein = pepDataFile.getProtein(sysname);
        if (protein == null)
            protein = new Protein(sysname);
        int startRegion = Integer.parseInt(tokens[2]);
        int stopRegion = Integer.parseInt(tokens[3]);
        int multiplicity = Integer.parseInt(tokens[4]);
        section = new ProteinSection(startRegion, stopRegion, multiplicity);
        // Link peptide and protein
        peptide.setProtein(protein);
        protein.addPeptide(peptide, section, isTopScore);
        peptides.add(peptide);
    }
    return peptides.toArray(new Peptide[0]);
}
Also used : HashMap(java.util.HashMap) PeptideIonSerie(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.PeptideIonSerie) ProteinSection(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ProteinSection) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint) Protein(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Protein) Peptide(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Peptide) ModificationPeptide(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide) Vector(java.util.Vector) ModificationPeptide(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide) PeptideFragmentation(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.PeptideFragmentation)

Example 2 with ModificationPeptide

use of net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide in project mzmine2 by mzmine.

the class MascotParserUtils method parseModification.

/**
 * Parse a string with information of possible modifications in a peptide's amino acid sequence
 *
 * @param modString
 * @param section
 * @param fixed
 * @return
 */
public static ModificationPeptide[] parseModification(String modString, HashMap<?, ?> section, boolean fixed) {
    // Example "Deamidation (NQ)"
    Vector<ModificationPeptide> mods = new Vector<ModificationPeptide>();
    double mass = 0.0;
    modString = modString.replace("\n", "");
    String[] tokens = modString.split(" ");
    String name = tokens[0];
    String sites = tokens[1];
    if (sites.endsWith(")")) {
        sites = sites.replace("(", "");
        sites = sites.replace(")", "");
        for (int i = 0; i < sites.length(); i++) {
            mass = Double.parseDouble((String) section.get(name));
            mods.add(new ModificationPeptide(name, mass, sites.charAt(i), fixed));
        }
    }
    return mods.toArray(new ModificationPeptide[0]);
}
Also used : ModificationPeptide(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide) Vector(java.util.Vector) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 3 with ModificationPeptide

use of net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide in project mzmine2 by mzmine.

the class PeptideUtils method calculatePeptideMasses.

/**
 * This method calculates fragment ions b and y.
 */
public static double[] calculatePeptideMasses(HashMap<String, Double> defaultMasses, String sequence, HashMap<Integer, ModificationPeptide> modifications) {
    int length = sequence.length();
    String aminoKey;
    // Calculated the mass of each amino acid including detected
    // modification
    double[] peptideMasses = new double[length];
    for (int i = 0; i < length; i++) {
        // This double will hold the mass of the peptideUnit.
        double aminoMass = 0.0;
        /*
       * Check if there is a N-Terminal modification, if there is one, count the mass of the
       * N-terminal modification to the mass of the first amino acid.
       */
        if (i == 0) {
            if (modifications.containsKey(i))
                aminoMass += modifications.get(i).getMass();
        }
        /*
       * Check if there is a C-Terminal modification, if there is one, count the mass of the
       * C-terminal modification to the mass of the last amino acid.
       */
        if (i == length - 1) {
            if (modifications.containsKey(i + 2))
                aminoMass += modifications.get(i + 2).getMass();
        }
        // For aa i, count its mass to the UnitMass.
        aminoKey = Character.toString(sequence.charAt(i));
        aminoMass = aminoMass + defaultMasses.get(aminoKey);
        /*
       * If there is a modification on aa i, count the mass at the UnitMass. if the modification is
       * fixed , don't add the mass because Mascot already included an equivalent modified amino
       * acid mass.
       */
        if (modifications.containsKey(i + 1)) {
            ModificationPeptide mod = modifications.get(i + 1);
            if (mod.isFixed())
                aminoMass += mod.getMass();
        }
        peptideMasses[i] = aminoMass;
    }
    return peptideMasses;
}
Also used : ModificationPeptide(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide) DataPoint(net.sf.mzmine.datamodel.DataPoint)

Aggregations

DataPoint (net.sf.mzmine.datamodel.DataPoint)3 ModificationPeptide (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide)3 Vector (java.util.Vector)2 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)2 HashMap (java.util.HashMap)1 Peptide (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Peptide)1 PeptideFragmentation (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.PeptideFragmentation)1 PeptideIonSerie (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.PeptideIonSerie)1 Protein (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Protein)1 ProteinSection (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ProteinSection)1