public NeoPsm(int scan, double expMass, InitialID nInfo, InitialID cInfo) { this.scanNumber = scan; this.expMass = expMass; this.nInfo = nInfo; this.cInfo = cInfo; this.candidates = new List <FusionCandidate>(); }
public static List <NeoPsm> ImportNeoPsms(string nFileName, string cFileName) { string[] nInput = File.ReadAllLines(nFileName); string[] cInput = File.ReadAllLines(cFileName); List <NeoPsm> psms = new List <NeoPsm>(); ParseHeader(nInput[0]); List <InitialID> nAssignment = new List <InitialID>(); List <InitialID> cAssignment = new List <InitialID>(); for (int i = 1; i < nInput.Count(); i++) { string[] line = nInput[i].Split('\t').ToArray(); InitialID id = new InitialID(Convert.ToInt32(line[scanNumberIndex]), Convert.ToDouble(line[scanPrecursorMassIndex]), line[accessionIndex], line[fullIndex], line[matchedIonsIndex], line[scoreIndex]); nAssignment.Add(id); } for (int i = 1; i < cInput.Count(); i++) { string[] line = cInput[i].Split('\t').ToArray(); InitialID id = new InitialID(Convert.ToInt32(line[scanNumberIndex]), Convert.ToDouble(line[scanPrecursorMassIndex]), line[accessionIndex], line[fullIndex], line[matchedIonsIndex], line[scoreIndex]); cAssignment.Add(id); } //sort by scan number List <InitialID> nAssignmentSorted = nAssignment.OrderBy(o => o.scanNumber).ToList(); List <InitialID> cAssignmentSorted = cAssignment.OrderBy(o => o.scanNumber).ToList(); //remove scans not found in both files double maxCount = nAssignmentSorted.Count(); for (int i = 0; i < maxCount; i++) { if (i < cAssignmentSorted.Count()) { if (nAssignmentSorted[i].scanNumber.Equals(cAssignmentSorted[i].scanNumber)) { NeoPsm psm = new NeoPsm(nAssignmentSorted[i].scanNumber, nAssignmentSorted[i].expMass, nAssignmentSorted[i], cAssignmentSorted[i]); psms.Add(psm); continue; } else if (nAssignmentSorted[i].scanNumber < cAssignmentSorted[i].scanNumber) //no information was found for the b scan using y ions, so remove it { nAssignmentSorted.Remove(nAssignmentSorted[i]); maxCount--; i--; } else //no information was found for the y scan using b ions, so remove it { cAssignmentSorted.Remove(cAssignmentSorted[i]); i--; } } } return(psms); }