Ejemplo n.º 1
0
        public static void ParseMsm(string msmName, string[] silacMsmNames, string isoMsmName, string peakMsmName,
                                    string polyMsmName, IPeakList peakList, out int silacCount, out int isoCount,
                                    out int peakCount,
                                    out int polyCount, SilacType silacType, double isotopeCorrelationThreshold)
        {
            HashSet <int> scanNumbers = new HashSet <int>();
            StreamReader  reader      = new StreamReader(msmName);

            StreamWriter[] silacWriters = new StreamWriter[silacMsmNames.GetLength(0)];
            for (int i = 0; i < silacWriters.GetLength(0); i++)
            {
                silacWriters[i] = new StreamWriter(silacMsmNames[i]);
            }
            StreamWriter  isoWriter  = new StreamWriter(isoMsmName);
            StreamWriter  peakWriter = new StreamWriter(peakMsmName);
            StreamWriter  polyWriter = new StreamWriter(polyMsmName);
            string        line;
            List <string> buffer = new List <string>();
            string        title  = null;
            string        mass   = null;

            silacCount = 0;
            isoCount   = 0;
            peakCount  = 0;
            polyCount  = 0;
            while ((line = reader.ReadLine()) != null)
            {
                if (line.IndexOf("BEGIN IONS") != -1)
                {
                    buffer = new List <string>();
                }
                else if (line.IndexOf("PEPMASS") != -1)
                {
                    mass = line;
                }
                else if (line.IndexOf("CHARGE") != -1)
                {
                }
                else if (line.IndexOf("TITLE") != -1)
                {
                    title = line;
                }
                else if (line.IndexOf("END IONS") != -1)
                {
                    ProcessMsm(buffer.ToArray(), title, mass, scanNumbers, silacWriters, isoWriter, peakWriter, polyWriter,
                               peakList, isotopeCorrelationThreshold, silacType,
                               ref silacCount, ref isoCount, ref peakCount, ref polyCount);
                }
                else
                {
                    if (line.Length > 0)
                    {
                        buffer.Add(line);
                    }
                }
            }
            reader.Close();
            for (int i = 0; i < silacWriters.GetLength(0); i++)
            {
                silacWriters[i].Close();
            }
            isoWriter.Close();
            peakWriter.Close();
            polyWriter.Close();
        }