Package org.mcisb.massspectrometry.pride.model

Examples of org.mcisb.massspectrometry.pride.model.Peptide


    boolean isValid = modAccessions.length == 0;
   
    for( final PeptideType peptideType : protein.getPeptide() )
    {
      //TODO: protein.getProtLen() is always null. Therefore no idea whether peptide is C-terminal.
      final Peptide peptide = getPeptide( peptideType, peptideType.getPepEnd().equals( protein.getProtLen() ) );
     
      if( peptideType.getPepMiss().intValue() == 0 && PrideUtils.containsModifier( peptide, modAccessions ) != NumberUtils.UNDEFINED && peptideType.getRank().intValue() <= peptideRankThreshold )
      {
        final Peptide labelFreePeptide = PrideUtils.clone( peptide, modAccessions );
        isValid |= ( labelFreePeptide.getModificationItem().size() == 0 );
      }
     
      gelFreeIdentificationType.getPeptideItem().add( peptide );
    }
   
View Full Code Here


   */
  private Peptide getPeptide( final PeptideType peptideType, final boolean isProteinCTerm ) throws IOException, XMLStreamException
  {
    final String RETENTION_TIME_REGEXP = "(?<=.*" + org.mcisb.massspectrometry.PropertyNames.RETENTION_TIME + "\\=)\\d+(\\.\\d+)?(?=.*)"; //$NON-NLS-1$ //$NON-NLS-2$
   
    final Peptide peptide = new Peptide();
   
    peptide.setEnd( BigInteger.valueOf( peptideType.getPepEnd().longValue() ) );
    peptide.setStart( BigInteger.valueOf( peptideType.getPepStart().longValue() ) );
    peptide.setSequence( peptideType.getPepSeq() );
   
    final int spectrumReference = Integer.parseInt( CollectionUtils.getFirst( RegularExpressionUtils.getMatches( peptideType.getPepScanTitle(), org.mcisb.massspectrometry.PropertyNames.SPECTRUM_ID_REGEXP ) ) );
    peptide.setSpectrumReference( BigInteger.valueOf( spectrumReference ) );

    final ParamType paramType = new ParamType();
    final List<Object> cvParamOrUserParam = paramType.getCvParamOrUserParam();
    cvParamOrUserParam.add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.MASCOT_SCORE_ACCESSION, "Mascot score", peptideType.getPepScore().toString() ) ); //$NON-NLS-1$
    cvParamOrUserParam.add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.RANK_ACCESSION, "Rank", peptideType.getRank().toString() ) ); //$NON-NLS-1$
    cvParamOrUserParam.add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.MASCOT_EXPECT_ACCESSION, "Mascot expect value", peptideType.getPepExpect().toString() ) ); //$NON-NLS-1$
   
    final float retentionTimeInSeconds = Float.parseFloat( CollectionUtils.getFirst( RegularExpressionUtils.getMatches( peptideType.getPepScanTitle(), RETENTION_TIME_REGEXP ) ) );
    cvParamOrUserParam.add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION, "parent ion retention time", Float.toString( retentionTimeInSeconds / TimeUtils.SECONDS_IN_MINUTE ) ) ); //$NON-NLS-1$

    cvParamOrUserParam.add( PrideParamFactory.getUserParam( PrideUtils.MISSED_CLEAVAGES, peptideType.getPepMiss().toString() ) );

    peptide.setAdditional( paramType );
   
    // Add modifications:
    addModifications( peptideType, peptide, isProteinCTerm );
   
    return peptide;
View Full Code Here

   * @param ignoredModAccessions
   * @return Peptide
   */
  public static Peptide clone( final Peptide peptide, final int[] ignoredModAccessions )
  {
    final Peptide clone = new Peptide();
    clone.setSequence( peptide.getSequence() );
    clone.setStart( peptide.getStart() );
    clone.setEnd( peptide.getEnd() );
   
    for( final Modification modification : peptide.getModificationItem() )
    {
      if( !CollectionUtils.contains( ignoredModAccessions, Integer.parseInt( modification.getModAccession() ) ) )
      {
        clone.getModificationItem().add( modification );
      }
    }
   
    return clone;
  }
View Full Code Here

       final Map<String,Peptide> peptidePairIdToLabelledPeptide = addPeptides( gelFreeIdentification, mzData, matchedSpectrumReferences, peptidePairIdToPartnerPeptide, sharedPeptideSequences );
      boolean quantified = false;
     
      for( Map.Entry<String,Peptide> entry : peptidePairIdToLabelledPeptide.entrySet() )
      {
        final Peptide labelledPeptide = entry.getValue();
        final List<Object> cvParamOrUserParam = labelledPeptide.getAdditional().getCvParamOrUserParam();
       
        // Generate XIC:
        final Spectrum labelledXic = xicFactory.getSpectrum( labelledPeptide );
        final float labelledRt = Float.valueOf( PrideUtils.getCvParamValue( labelledPeptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue();
       
        if( xicFactory.addPeakStartAndEnd( labelledXic, labelledRt ) )
        {
          // Add precursor spectrum:
          double startRt = NumberUtils.UNDEFINED;
          double endRt = NumberUtils.UNDEFINED;
         
          for( final String comment : labelledXic.getSpectrumDesc().getComments() )
          {
            if( comment.startsWith( org.mcisb.massspectrometry.pride.converter.qconcat.PropertyNames.PEAK_START ) )
            {
              startRt = Double.parseDouble( comment.substring( org.mcisb.massspectrometry.pride.converter.qconcat.PropertyNames.PEAK_START.length() ) );
            }
            else if( comment.startsWith( org.mcisb.massspectrometry.pride.converter.qconcat.PropertyNames.PEAK_END ) )
            {
              endRt = Double.parseDouble( comment.substring( org.mcisb.massspectrometry.pride.converter.qconcat.PropertyNames.PEAK_END.length() ) );
            }
          }
         
          final Spectrum[] precursorSpectra = precursorSpectrumFactory.getSpectra( labelledPeptide, startRt, endRt );
         
          if( precursorSpectra.length > 0 )
          {
            quantified = true;
           
            for( Spectrum precursorSpectrum : precursorSpectra )
            {
              spectra.add( precursorSpectrum );
              matchedSpectrumReferences.add( Integer.valueOf( precursorSpectrum.getId() ) );
              cvParamOrUserParam.add( PrideParamFactory.getUserParam( PrecursorSpectrumFactory.PRECURSOR_SPECTRUM_ID, Integer.toString( precursorSpectrum.getId() ) ) );
            }
           
            // Add XIC:
            spectra.add( labelledXic );
            matchedSpectrumReferences.add( Integer.valueOf( labelledXic.getId() ) );
            cvParamOrUserParam.add( PrideParamFactory.getUserParam( XicFactory.XIC_ID, Integer.toString( labelledXic.getId() ) ) );
           
            // Add quantitation:
            cvParamOrUserParam.add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.STABLE_ISOTOPE_RATIO_ACCESSION, "Stable isotope ratio", Double.toString( precursorSpectrumFactory.getRatio( labelledPeptide ) ) ) ); //$NON-NLS-1$
            cvParamOrUserParam.add( PrideParamFactory.getUserParam( STABLE_ISOTOPE_RATIO_ACCESSION_ERROR_ID, Double.toString( precursorSpectrumFactory.getRatioStandardError( labelledPeptide ) ) ) );
            cvParamOrUserParam.add( PrideParamFactory.getUserParam( NUM_OBSERVATIONS_ID, Long.toString( precursorSpectrumFactory.getNumberOfObservations( labelledPeptide ) ) ) );
           
            // Add / find unlabelled peptide:
            Peptide unlabelledPeptide = peptidePairIdToPartnerPeptide.get( entry.getKey() );
           
            if( unlabelledPeptide != null )
            {
              for( Spectrum precursorSpectrum : precursorSpectra )
              {
                unlabelledPeptide.getAdditional().getCvParamOrUserParam().add( PrideParamFactory.getUserParam( PrecursorSpectrumFactory.PRECURSOR_SPECTRUM_ID, Integer.toString( precursorSpectrum.getId() ) ) );
              }
            }
            else
            {
              unlabelledPeptide = PrideUtils.clone( labelledPeptide, labelAccessions );
              unlabelledPeptide.setAdditional( new ParamType() );
              unlabelledPeptide.getAdditional().getCvParamOrUserParam().add( PrideParamFactory.getCvParam( PrideUtils.PSI_LABEL, PrideUtils.PARENT_ION_CHARGE_STATE_ACCESSION, "Charge state", Long.toString( PrideUtils.getZ( labelledPeptide, mzData ) ) ) ); //$NON-NLS-1$
              unlabelledPeptide.getAdditional().getCvParamOrUserParam().add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION, "parent ion retention time", Float.toString( labelledRt ) ) ); //$NON-NLS-1$
              gelFreeIdentification.getPeptideItem().add( unlabelledPeptide );
            }
           
            final Spectrum unlabelledXic = xicFactory.getSpectrum( unlabelledPeptide );
            spectra.add( unlabelledXic );
            matchedSpectrumReferences.add( Integer.valueOf( unlabelledXic.getId() ) );
            unlabelledPeptide.getAdditional().getCvParamOrUserParam().add( PrideParamFactory.getUserParam( XicFactory.XIC_ID, Integer.toString( unlabelledXic.getId() ) ) );
            unlabelledPeptide.getAdditional().getCvParamOrUserParam().add( PrideParamFactory.getCvParam( PrideUtils.PRIDE_LABEL, PrideUtils.PEPTIDE_PAIR_ID_ACCESSION, PEPTIDE_PAIR_ID_NAME, entry.getKey() ) );
          }
        }
      }
     
      if( !quantified )
View Full Code Here

   */
  private static void getLabelledPeptide( final GelFreeIdentificationType gelFreeIdentification, final Peptide peptide, final Map<String,Peptide> peptidePairIdToLabelledPeptide, final Map<String,Float> peptidePairIdToScore, final Map<String,Peptide> peptidePairIdToPartnerPeptide )
  {
    final float rank = Integer.parseInt( PrideUtils.getCvParamValue( peptide.getAdditional(), PrideUtils.RANK_ACCESSION ) );
    final boolean valid = ( rank <= PEPTIDE_RANK_THRESHOLD );
    final Peptide partnerPeptide = getPartnerPeptide( peptide, gelFreeIdentification );
   
    // Peptide is labelled, check for uniqueness:
    for( final Peptide labelledPeptide : peptidePairIdToLabelledPeptide.values() )
    {
      if( PrideUtils.equals( peptide, labelledPeptide ) )
      {
        // Labelled Peptide is a duplicate:
        final String peptidePairId = PrideUtils.getCvParamValue( labelledPeptide.getAdditional(), PrideUtils.PEPTIDE_PAIR_ID_ACCESSION );
       
        if( valid )
        {
          final float score = Float.parseFloat( PrideUtils.getCvParamValue( peptide.getAdditional(), PrideUtils.MASCOT_SCORE_ACCESSION ) );
          final Peptide currentLabelledPeptide = peptidePairIdToLabelledPeptide.get( peptidePairId );
          final Peptide currentPartnerPeptide = peptidePairIdToPartnerPeptide.get( peptidePairId );
          boolean accept = false;
         
          if( partnerPeptide == null && currentPartnerPeptide == null )
          {
            // Check score.
            accept = ( score > peptidePairIdToScore.get( peptidePairId ).floatValue() );
          }
          else if( partnerPeptide != null && currentPartnerPeptide == null )
          {
            accept = true;
          }
          else if( partnerPeptide != null && currentPartnerPeptide != null )
          {
            // Check delta rt.
            final float newDeltaRt = Math.abs( Float.valueOf( PrideUtils.getCvParamValue( peptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue() - Float.valueOf( PrideUtils.getCvParamValue( partnerPeptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue() );
            final float currentDeltaRt = Math.abs( Float.valueOf( PrideUtils.getCvParamValue( currentLabelledPeptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue() - Float.valueOf( PrideUtils.getCvParamValue( currentPartnerPeptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue() );
            accept = ( newDeltaRt < currentDeltaRt );
          }
         
          if( accept )
          {
View Full Code Here

   * @param gelFreeIdentification
   * @return Peptide
   */
  private static Peptide getPartnerPeptide( final Peptide labelledPeptide, final GelFreeIdentificationType gelFreeIdentification )
  {
    final Peptide labelledPeptideUnlabelled = PrideUtils.clone( labelledPeptide, labelAccessions );
    final float labelledRt = Float.valueOf( PrideUtils.getCvParamValue( labelledPeptide.getAdditional(), PrideUtils.PARENT_ION_RETENTION_TIME_ACCESSION ) ).floatValue();
    Peptide partnerPeptide = null;
    float rtTolerance = RT_TOLERANCE;
   
    for( final Peptide peptide : gelFreeIdentification.getPeptideItem() )
    {
      if( PrideUtils.equals( peptide, labelledPeptideUnlabelled ) )
View Full Code Here

TOP

Related Classes of org.mcisb.massspectrometry.pride.model.Peptide

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.