Exemple #1
0
 private static IList<PeakData> ImportFile(TextReader peakViewReader)
 {
     var peakDatas = new List<PeakData>();
     var msFileNames = new List<string>();
     var fileReader = new DsvFileReader(peakViewReader, TextUtil.SEPARATOR_TSV);
     Debug.Assert(Equals(fileReader.GetFieldIndex(PROTEIN), 0));
     Debug.Assert(Equals(fileReader.GetFieldIndex(PEPTIDE), 1));
     Debug.Assert(Equals(fileReader.GetFieldIndex(LABEL), 2));
     Debug.Assert(Equals(fileReader.GetFieldIndex(PRECURSOR), 3));
     Debug.Assert(Equals(fileReader.GetFieldIndex(CHARGE), 4));
     Debug.Assert(Equals(fileReader.GetFieldIndex(RT), 5));
     Debug.Assert(Equals(fileReader.GetFieldIndex(DECOY), 6));
     for (int i = 7; i < fileReader.NumberOfFields; ++i)
     {
         msFileNames.Add(fileReader.FieldNames[i]);
     }
     while (fileReader.ReadLine() != null)
     {
         string modifiedSequence = fileReader.GetFieldByName(PEPTIDE);
         string decoyString = fileReader.GetFieldByName(DECOY);
         bool decoy;
         var hasDecoyValue = bool.TryParse(decoyString, out decoy);
         Debug.Assert(hasDecoyValue);
         foreach (var msFileName in msFileNames)
         {
             string dataFieldString = fileReader.GetFieldByName(msFileName);
             double dataField;
             var hasDataFieldValue = double.TryParse(dataFieldString, out dataField);
             Debug.Assert(hasDataFieldValue);
             var peakData = new PeakData(dataField, modifiedSequence, msFileName, decoy);
             peakDatas.Add(peakData);
         }
     }
     return peakDatas;
 }
Exemple #2
0
        private static IList <PeakData> ImportFile(TextReader peakViewReader)
        {
            var peakDatas   = new List <PeakData>();
            var msFileNames = new List <string>();
            var fileReader  = new DsvFileReader(peakViewReader, TextUtil.SEPARATOR_TSV);

            Debug.Assert(Equals(fileReader.GetFieldIndex(PROTEIN), 0));
            Debug.Assert(Equals(fileReader.GetFieldIndex(PEPTIDE), 1));
            Debug.Assert(Equals(fileReader.GetFieldIndex(LABEL), 2));
            Debug.Assert(Equals(fileReader.GetFieldIndex(PRECURSOR), 3));
            Debug.Assert(Equals(fileReader.GetFieldIndex(CHARGE), 4));
            Debug.Assert(Equals(fileReader.GetFieldIndex(RT), 5));
            Debug.Assert(Equals(fileReader.GetFieldIndex(DECOY), 6));
            for (int i = 7; i < fileReader.NumberOfFields; ++i)
            {
                msFileNames.Add(fileReader.FieldNames[i]);
            }
            while (fileReader.ReadLine() != null)
            {
                string modifiedSequence = fileReader.GetFieldByName(PEPTIDE);
                string decoyString      = fileReader.GetFieldByName(DECOY);
                bool   decoy;
                var    hasDecoyValue = bool.TryParse(decoyString, out decoy);
                Debug.Assert(hasDecoyValue);
                foreach (var msFileName in msFileNames)
                {
                    string dataFieldString = fileReader.GetFieldByName(msFileName);
                    double dataField;
                    var    hasDataFieldValue = double.TryParse(dataFieldString, out dataField);
                    Debug.Assert(hasDataFieldValue);
                    var peakData = new PeakData(dataField, modifiedSequence, msFileName, decoy);
                    peakDatas.Add(peakData);
                }
            }
            return(peakDatas);
        }