public CompositeCompoundList(string tableCompType, string tableSumCompName, string tableMolCompName, string tableToDeleteInMolComp, string tableConstPart, string tableConstMod, string radical1, string radical2, string radical3, string radical4, Dictionary <string, BuildingBlockList> allBuildingBlocks) { int limitR1R2; int limitR2R3; int limitR3R4; BuildingBlockList R1 = allBuildingBlocks[radical1]; for (int i = 0; i < R1.Count; i++) { BuildingBlockList R2 = allBuildingBlocks[radical2]; if (radical1 == radical2) { limitR1R2 = i + 1; } else { limitR1R2 = R2.Count; } for (int j = 0; j < limitR1R2; j++) { BuildingBlockList R3 = allBuildingBlocks[radical3]; if (radical2 == radical3) { limitR2R3 = j + 1; } else { limitR2R3 = R3.Count; } for (int g = 0; g < limitR2R3; g++) { BuildingBlockList R4 = allBuildingBlocks[radical4]; if (radical3 == radical4) { limitR3R4 = g + 1; } else { limitR3R4 = R4.Count; } for (int f = 0; f < limitR3R4; f++) { string totalElemComp = R1[i].Composition + "+" + R2[j].Composition + "+" + R3[g].Composition + "+" + R4[f].Composition + "+" + tableConstMod; totalElemComp = totalElemComp.Replace("+0", ""); totalElemComp = totalElemComp.Replace("+", ""); int totalX = R1[i].X + R2[j].X + R3[g].X + R4[f].X; int totalY = R1[i].Y + R2[j].Y + R3[g].Y + R4[f].Y; int totalZ = R1[i].Z + R2[j].Z + R3[g].Z + R4[f].Z; this.Add(new CompositeCompound(tableCompType, tableSumCompName, tableMolCompName, tableToDeleteInMolComp, totalElemComp, R1[i].Name, R2[j].Name, R3[g].Name, R4[f].Name, totalX, totalY, totalZ)); } } } } }
/// <summary> /// Generates expected lipid compounds. /// </summary> /// public IList <LipidCompound> GenerateLipids() { // init timer var timer = Stopwatch.StartNew(); // init container var expectedLipids = new List <LipidCompound>(); //generates FA building blocks #region Make building bloks BuildingBlockList NAN = new BuildingBlockList("", "", "0", "", "", ""); BuildingBlockList FAdb = new BuildingBlockList("FAdb", "FA x:y", "c*x + h*(x-y)*2 + o*2", "12-22", "y=function", ""); BuildingBlockList SPH = new BuildingBlockList("SPH", "d18:1", "c*18 + h*35 + o*1 + n", "18", "1", "2"); BuildingBlockList FA = new BuildingBlockList("", "", "", "", "", ""); FA.RemoveAt(0); foreach (var bb in FattyAcyl.Values) { FA.Add(FAdb.Find(x => x.Name.Contains(bb))); } var allBB = new Dictionary <string, BuildingBlockList> { [""] = NAN, ["FAdb"] = FAdb, ["FA"] = FA, ["SPH"] = SPH }; #endregion #region Generate List of Candidates CompositeCompoundList classPC = new CompositeCompoundList("PC", "PC x:y", "PC r1-r2", "FA ", "", "C8H16O4NP", "FA", "FA", "", "", allBB); CompositeCompoundList classPCO = new CompositeCompoundList("PC O", "PC O-x:y", "PC O-r1-r2", "FA ", "", "C8H18O3NP", "FA", "FA", "", "", allBB); CompositeCompoundList classLPC = new CompositeCompoundList("LPC", "LPC x:y", "LPC r1", "FA ", "", "C8H18O5NP", "FA", "", "", "", allBB); CompositeCompoundList classLPCO = new CompositeCompoundList("LPC O", "LPC O-x:y", "LPC O-r1", "FA ", "", "C8H20O4NP", "FA", "", "", "", allBB); CompositeCompoundList classPE = new CompositeCompoundList("PE", "PE x:y", "PE r1-r2", "FA ", "", "C5H10O4NP", "FA", "FA", "", "", allBB); CompositeCompoundList classPEO = new CompositeCompoundList("PE O", "PE O-x:y", "PE O-r1-r2", "FA ", "", "C5H12O3NP", "FA", "FA", "", "", allBB); CompositeCompoundList classLPE = new CompositeCompoundList("LPE", "LPE x:y", "LPE r1", "FA ", "", "C5H12O5NP", "FA", "", "", "", allBB); CompositeCompoundList classLPEO = new CompositeCompoundList("LPE O", "LPE O-x:y", "LPE O-r1", "FA ", "", "C5H14NO4P", "FA", "", "", "", allBB); CompositeCompoundList classPS = new CompositeCompoundList("PS", "PS x:y", "PS r1-r2", "FA ", "", "C6H10NO6P", "FA", "FA", "", "", allBB); CompositeCompoundList classLPS = new CompositeCompoundList("LPS", "LPS x:y", "LPS r1", "FA ", "", "C6H12NO7P", "FA", "", "", "", allBB); CompositeCompoundList classPI = new CompositeCompoundList("PI", "PI x:y", "PI r1-r2", "FA ", "", "C9H15O9P", "FA", "FA", "", "", allBB); CompositeCompoundList classLPI = new CompositeCompoundList("LPI", "LPI x:y", "LPI r1", "FA ", "", "C9H17O10P", "FA", "", "", "", allBB); CompositeCompoundList classPA = new CompositeCompoundList("PA", "PA x:y", "PA r1-r2", "FA ", "", "C3H5O4P", "FA", "FA", "", "", allBB); CompositeCompoundList classPAO = new CompositeCompoundList("PA O", "PA O-x:y", "PA O-r1-r2", "FA ", "", "C3H7O3P", "FA", "FA", "", "", allBB); CompositeCompoundList classLPA = new CompositeCompoundList("LPA", "LPA x:y", "LPA r1", "FA ", "", "C3H7O5P", "FA", "", "", "", allBB); CompositeCompoundList classLPAO = new CompositeCompoundList("LPA O", "LPA O-x:y", "LPAO r1", "FA ", "", "C3H9O4P", "FA", "", "", "", allBB); CompositeCompoundList classPG = new CompositeCompoundList("PG", "PG x:y", "PG r1-r2", "FA ", "", "C6H11O6", "FA", "FA", "", "", allBB); CompositeCompoundList classLPG = new CompositeCompoundList("LPG", "LPG x:y", "LPG r1", "FA ", "", "C6H13O7P", "FA", "", "", "", allBB); CompositeCompoundList classCL = new CompositeCompoundList("CL", "CL x:y", "CL r1-r2-r3-r4", "FA ", "", "C9H14O9P2", "FA", "FA", "FA", "FA", allBB); CompositeCompoundList classCer = new CompositeCompoundList("Cer", "Cer dx:y", "Cer r1-r2", "SPH", "", "", "SPH", "FA", "", "", allBB); CompositeCompoundList classSM = new CompositeCompoundList("SM", "SM dx:y", "SM r1-r2", "SPH", "", "C5H12N2O3P", "SPH", "FA", "", "", allBB); CompositeCompoundList classHexCer = new CompositeCompoundList("HexCer", "HexCer dx:y", "HexCer r1-r2", "SPH", "", "C6H10O5", "SPH", "FA", "", "", allBB); CompositeCompoundList classTAG = new CompositeCompoundList("TAG", "TAG x:y", "TAG r1-r2-r3", "FA ", "", "C3H2", "FA", "FA", "FA", "", allBB); CompositeCompoundList classDAG = new CompositeCompoundList("DAG", "DAG x:y", "DAG r1-r2", "FA ", "", "C3H4O", "FA", "FA", "", "", allBB); CompositeCompoundList classMAG = new CompositeCompoundList("MAG", "MAG x:y", "MAG r1", "FA ", "", "C3H4O", "FA", "", "", "", allBB); var allClasses = new Dictionary <string, CompositeCompoundList> { ["PC"] = classPC, ["PC O"] = classPCO, ["LPC"] = classLPC, ["LPC O"] = classLPCO, ["PE"] = classPE, ["PE O"] = classPEO, ["LPE"] = classLPE, ["LPE O"] = classLPEO, ["PS"] = classPS, ["LPS"] = classLPS, ["PI"] = classPI, ["LPI"] = classLPI, ["PA"] = classPA, ["PA O"] = classPAO, ["LPA"] = classLPA, ["LPA O"] = classLPAO, ["PG"] = classLPG, ["LPG"] = classLPG, ["CL"] = classCL, ["TAG"] = classTAG, ["DAG"] = classDAG, ["MAG"] = classMAG, ["Cer"] = classCer, ["HexCer"] = classHexCer, ["SM"] = classSM }; foreach (var key in LipidCLass.Values) { CompositeCompoundList tempClass = allClasses[key]; foreach (var lipid in tempClass) { if (!expectedLipids.Exists(x => x.Name == lipid.SumComp)) { LipidCompound temp = new LipidCompound(lipid.Composition, -1); temp.Name = lipid.SumComp; temp.Class = lipid.Type; expectedLipids.Add(temp); } } } #endregion foreach (var species in expectedLipids) { SendAndLogVerboseMessage(MessageLevel.Info, $"Lipid {species.Name} with {species.ElementalCompositionFormula} on the list of candidates."); } timer.Stop(); SendAndLogVerboseMessage(MessageLevel.Info, $"Generating {expectedLipids.Count} expected lipids took {StringHelper.GetDisplayString(timer.Elapsed)}."); return(expectedLipids); }