private void ReadPanelFile(string pathToDatabase) { using ( StreamReader reader = new StreamReader(pathToDatabase)) //new StreamReader(new EncryptedFileStream(pathToDatabase, passPhrase, FileAccess.Read))) { while (!reader.EndOfStream) { string line = reader.ReadLine(); if (line == null) { break; } line = line.Trim(); //check its not a header line or comment. if (IsItAComment(line)) { continue; } string[] data = line.Split('\t'); //check its not an empty line if (data.Length > 5) { RefPanelEntry entry = new RefPanelEntry(); entry.LoadEntry(data); AddEntryToTable(entry); } } } }
//examples of Therascreen detections: //12ASP detected //12CYS //13ASP //WT //12VAL detected //INVALID public RuleApplier(string mutationDataBase) { if (!File.Exists(mutationDataBase)) { Console.WriteLine($"{mutationDataBase} does not exist"); System.Environment.Exit(1); } using (StreamReader mutationDatabaseReader = new StreamReader(mutationDataBase)) { while (!mutationDatabaseReader.EndOfStream) { string line = mutationDatabaseReader.ReadLine(); if (line == null) { break; } line = line.Trim(); //check its not a header line or comment. if (IsItAComment(line)) { continue; } string[] data = line.Split('\t'); //check its not an empty line if (data.Length > 5) { RefPanelEntry entry = new RefPanelEntry(); entry.LoadEntry(data); AddEntryToDictionaries(entry); DetectableMutationEntries.Add(entry); } } //generate the mutation information foreach (var mutationEntry in DetectableMutationEntries) { string currentMutationSource; string currentMutationConfirmed; string mutationID = mutationEntry.Chr + "_" + mutationEntry.FwdStandFirstPositionOfMutation + "_" + mutationEntry.FwdStrandRefAllele + "_" + mutationEntry.FwdStrandAltAllele; //check the possible source if (mutationEntry.Gene.Equals("KRAS") && mutationEntry.Exon.Equals("2")) { currentMutationSource = mutationEntry.Gene.Substring(0, 1).ToUpper() + mutationEntry.Exon + "_" + mutationEntry.Codon; string theraAminoAcidChange = "KRAS_" + mutationEntry.AminoAcidPosition + mutationEntry.AminoAcidAlt.ToUpper(); if (AminoAcidToBaseChangeForTherascreenDictionary[theraAminoAcidChange].Count == 1) { currentMutationConfirmed = "confirmed"; } else if (AminoAcidToBaseChangeForTherascreenDictionary[theraAminoAcidChange].Count > 1) { currentMutationConfirmed = "plausible"; } else { Console.WriteLine($"unrecogonized: {theraAminoAcidChange}"); throw new Exception("unregonized mutation in therascreen List, must something wrong"); } } else { currentMutationSource = mutationEntry.Gene.Substring(0, 1).ToUpper() + mutationEntry.Exon + "_" + mutationEntry.Codon; if (AminoAcidToBaseChangeForSangerDictionary[currentMutationSource].Count == 1) { currentMutationConfirmed = "confirmed"; } else if (AminoAcidToBaseChangeForSangerDictionary[currentMutationSource].Count > 1) { currentMutationConfirmed = "plausible"; } else { throw new Exception("unregonized mutation in sanger List, must something wrong"); } } //if (!MutationConfirmedInformationFromAminoAcid.ContainsKey(mutationID)) MutationConfirmedInformationFromAminoAcid.Add(mutationID, new List <string>() { currentMutationSource, currentMutationConfirmed }); } } }