public override bool Equals(object anObject)
 {
     if (this == anObject)
     {
         return(true);
     }
     if (anObject is MsmsPeakAnnotation)
     {
         MsmsPeakAnnotation other = (MsmsPeakAnnotation)anObject;
         if (other.type != type)
         {
             return(false);
         }
         if (other.index != index)
         {
             return(false);
         }
         if (other.charge != charge)
         {
             return(false);
         }
         if (other.neutralLoss != neutralLoss)
         {
             return(false);
         }
         return(true);
     }
     return(false);
 }
示例#2
0
        public MsmsHit(BinaryReader reader)
        {
            rawFileIndex = reader.ReadInt32();
            scanNumber   = reader.ReadInt32();
            silacIndex   = reader.ReadInt32();
            byte x = reader.ReadByte();

            switch (x)
            {
            case 0:
                type = MascotQueryType.Silac;
                break;

            case 1:
                type = MascotQueryType.Isotope;
                break;

            case 2:
                type = MascotQueryType.Peak;
                break;
            }
            pep                    = reader.ReadDouble();
            score                  = reader.ReadDouble();
            altScore               = reader.ReadDouble();
            deltaScoreAll          = reader.ReadDouble();
            deltaScoreDifferentPep = reader.ReadDouble();
            labelModifications     = PeptideModificationState.Read(reader);
            trueModifications      = PeptideModificationState.Read(reader);
            elutionTime            = reader.ReadDouble();
            id               = reader.ReadInt32();
            mz               = reader.ReadDouble();
            monoisotopicMz   = reader.ReadDouble();
            evidenceId       = reader.ReadInt32();
            ptmScore         = reader.ReadDouble();
            deltaPtmScore    = reader.ReadDouble();
            ptmScoreCounts   = reader.ReadInt32();
            ptmScoreFinished = reader.ReadBoolean();
            massErrorPpm     = reader.ReadDouble();
            changed          = reader.ReadBoolean();
            int len = reader.ReadInt32();

            description = new MsmsPeakAnnotation[len];
            intensities = new float[len];
            massDiffs   = new float[len];
            for (int i = 0; i < len; i++)
            {
                description[i] = new MsmsPeakAnnotation(reader);
                intensities[i] = reader.ReadSingle();
                massDiffs[i]   = reader.ReadSingle();
            }
            charge           = reader.ReadInt32();
            modProbabilities = new Dictionary <ushort, double[]>();
            len = reader.ReadInt32();
            ushort[] keys = new ushort[len];
            for (int i = 0; i < keys.Length; i++)
            {
                keys[i] = reader.ReadUInt16();
            }
            foreach (ushort key in keys)
            {
                len = reader.ReadInt32();
                double[] value = new double[len];
                for (int i = 0; i < value.Length; i++)
                {
                    value[i] = reader.ReadDouble();
                }
                modProbabilities.Add(key, value);
            }
            modScoreDiffs = new Dictionary <ushort, double[]>();
            len           = reader.ReadInt32();
            keys          = new ushort[len];
            for (int i = 0; i < keys.Length; i++)
            {
                keys[i] = reader.ReadUInt16();
            }
            foreach (ushort key in keys)
            {
                len = reader.ReadInt32();
                double[] value = new double[len];
                for (int i = 0; i < value.Length; i++)
                {
                    value[i] = reader.ReadDouble();
                }
                modScoreDiffs.Add(key, value);
            }
        }
示例#3
0
        public static int CountMatches(double[] massesArray, MsmsPeakAnnotation[] descriptionsArray, double[] specMasses, float[] specIntensities,
                                       double tol, string tolUnit, out MsmsPeakAnnotation[] description,
                                       out float[] intensities, out float[] massDiffs, out int n)
        {
            if (specMasses == null)
            {
                n           = 0;
                description = new MsmsPeakAnnotation[0];
                intensities = new float[0];
                massDiffs   = new float[0];
                return(0);
            }
            int npeaks = specMasses.Length;

            if (npeaks == 0)
            {
                n           = 0;
                description = new MsmsPeakAnnotation[0];
                intensities = new float[0];
                massDiffs   = new float[0];
                return(0);
            }
            int k = 0;

            n = 0;
            List <MsmsPeakAnnotation> desc = null;
            List <float> intens            = null;
            List <float> dm = null;

            if (descriptionsArray != null)
            {
                desc   = new List <MsmsPeakAnnotation>();
                intens = new List <float>();
                dm     = new List <float>();
            }
            for (int i = 0; i < massesArray.Length; i++)
            {
                double m = massesArray[i];
                n++;
                int ind = ArrayUtil.ClosestIndex(specMasses, m);
                if (ind != -1 && Match(m, specMasses[ind], tol, tolUnit))
                {
                    k++;
                    if (descriptionsArray != null)
                    {
                        desc.Add(descriptionsArray[i]);
                        intens.Add(specIntensities[ind]);
                        dm.Add((float)(m - specMasses[ind]));
                    }
                }
            }
            description = null;
            intensities = null;
            massDiffs   = null;
            if (descriptionsArray != null)
            {
                description = desc.ToArray();
                intensities = intens.ToArray();
                massDiffs   = dm.ToArray();
            }
            return(k);
        }