Search in sources :

Example 1 with ProteinSection

use of net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ProteinSection 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 ProteinSection

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

the class ProteomeUtils method peptideToString.

/**
 * Common utility method to be used as Peptide.toString() method
 *
 * @param Peptide Peptide to be converted to String
 * @return String representation of the peptide
 */
public static String peptideToString(Peptide peptide) {
    StringBuffer buf = new StringBuffer();
    Format mzFormat = MZmineCore.getConfiguration().getMZFormat();
    Protein protein = peptide.getProtein();
    ProteinSection section;
    section = protein.getSection(peptide);
    buf.append(protein.getSysname() + ":" + section.getName() + "; " + protein.getHits() + " hits");
    buf.append("\n" + peptide.getSequence());
    buf.append("\nPeptideMz ");
    buf.append(mzFormat.format(peptide.getMass()));
    buf.append(" ;CalculatedMz ");
    buf.append(mzFormat.format(peptide.getMassExpected()));
    buf.append(" ;Score ");
    buf.append(peptide.getIonScore());
    buf.append(" \nCharge ");
    buf.append(peptide.getPrecursorCharge());
    buf.append(" ;FragmentScan ");
    buf.append(peptide.getScan().getScanNumber());
    return buf.toString();
}
Also used : Format(java.text.Format) ProteinSection(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ProteinSection) Protein(net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Protein)

Aggregations

Protein (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.Protein)2 ProteinSection (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ProteinSection)2 Format (java.text.Format)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 DataPoint (net.sf.mzmine.datamodel.DataPoint)1 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)1 ModificationPeptide (net.sf.mzmine.modules.peaklistmethods.identification.mascot.data.ModificationPeptide)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