Example #1
0
        public CensusStringResult ReadFromFile(string fileName)
        {
            var result = new CensusStringResult();

            result.Headers  = CensusUtils.ReadHeaders(fileName);
            result.Proteins = ReadProteins(fileName);

            return(result);
        }
        public List <CensusPeptideItem> ReadPeptides(string filename)
        {
            var peptideMap = new Dictionary <string, CensusPeptideItem>();

            List <string> headers = CensusUtils.ReadHeaders(filename);

            InitFormat(headers);

            using (var sr = new StreamReader(filename))
            {
                string lastLine;
                while ((lastLine = sr.ReadLine()) != null)
                {
                    lastLine = lastLine.Trim();

                    if (lastLine.StartsWith("S") || lastLine.StartsWith("&S"))
                    {
                        CensusPeptideItem pepItem = this.peptideFormat.ParseString(lastLine);
                        if (pepItem.Ratio != 0.0)
                        {
                            string longFilename = pepItem.Filename.LongFileName;
                            if (peptideMap.ContainsKey(longFilename))
                            {
                                continue;
                            }
                            else
                            {
                                peptideMap[longFilename] = pepItem;
                            }
                        }
                    }
                }
            }

            return(new List <CensusPeptideItem>(peptideMap.Values));
        }