diff --git a/LipidCreator/CreatorGUI.Designer.cs b/LipidCreator/CreatorGUI.Designer.cs index 78cf71f..ea8ad53 100644 --- a/LipidCreator/CreatorGUI.Designer.cs +++ b/LipidCreator/CreatorGUI.Designer.cs @@ -736,8 +736,6 @@ partial class CreatorGUI public TextBox slDB2Textbox; [NonSerialized] public TextBox stDBTextbox; - [NonSerialized] - public TextBox stHydroxylTextbox; [NonSerialized] public GroupBox plTypeGroup; @@ -784,10 +782,6 @@ partial class CreatorGUI Label stDBLabel; [NonSerialized] Label slLCBHydroxyLabel; - [NonSerialized] - Label slFAHydroxyLabel; - [NonSerialized] - Label stFAHydroxyLabel; [NonSerialized] @@ -864,8 +858,6 @@ partial class CreatorGUI [NonSerialized] public ComboBox slLCBHydroxyCombobox; - [NonSerialized] - public ComboBox slFAHydroxyCombobox; [NonSerialized] ToolTip toolTip; @@ -895,6 +887,10 @@ partial class CreatorGUI public DataGridView plFA3FuncGroups; [NonSerialized] public DataGridView plFA4FuncGroups; + [NonSerialized] + public DataGridView slFAFuncGroups; + [NonSerialized] + public DataGridView stFAFuncGroups; @@ -1363,7 +1359,6 @@ private void InitializeComponent() slDB2Label = new Label(); slHGLabel = new Label(); slLCBHydroxyLabel = new Label(); - slFAHydroxyLabel = new Label(); easterText = new Label(); stFACombobox = new ComboBox(); stFACombobox.Items.Add("Fatty acyl chain"); @@ -1372,8 +1367,6 @@ private void InitializeComponent() stFATextbox = new TextBox(); stDBLabel = new Label(); stDBTextbox = new TextBox(); - stHydroxylTextbox = new TextBox(); - stFAHydroxyLabel = new Label(); homeText = new Label(); homeText3 = new Label(); @@ -1433,6 +1426,8 @@ private void InitializeComponent() plFA2FuncGroups = new DataGridView(); plFA3FuncGroups = new DataGridView(); plFA4FuncGroups = new DataGridView(); + slFAFuncGroups = new DataGridView(); + stFAFuncGroups = new DataGridView(); glStep1 = new GroupBox(); plStep1 = new GroupBox(); @@ -1480,20 +1475,7 @@ private void InitializeComponent() slLCBHydroxyCombobox.Items.Add("2"); slLCBHydroxyCombobox.Items.Add("3"); - slFAHydroxyCombobox = new ComboBox(); - slFAHydroxyCombobox.Items.Add("0"); - slFAHydroxyCombobox.Items.Add("1"); - slFAHydroxyCombobox.Items.Add("2"); - slFAHydroxyCombobox.Items.Add("3"); - - - toolTip = new ToolTip(); - - - - - string formattingFA = "Comma seperated single entries or intervals. Example formatting: 2, 3, 5-6, 13-20"; string formattingDB = "Comma seperated single entries or intervals. Example formatting: 2, 3-4, 6"; string formattingHydroxyl = "Comma seperated single entries or intervals. Example formatting: 0-2, 4"; @@ -2151,8 +2133,7 @@ private void InitializeComponent() slStep1.Controls.Add(slHGLabel); slStep1.Controls.Add(slHgListbox); slStep1.Controls.Add(slLCBHydroxyCombobox); - slStep1.Controls.Add(slFAHydroxyCombobox); - slStep1.Controls.Add(slFAHydroxyLabel); + slStep1.Controls.Add(slFAFuncGroups); slStep1.Controls.Add(slLCBHydroxyLabel); slStep1.Controls.Add(slPositiveAdduct); slStep1.Controls.Add(slNegativeAdduct); @@ -2208,19 +2189,14 @@ private void InitializeComponent() slDB1Label.Location = new Point(slDB1Textbox.Left, slDB1Textbox.Top - sep); slDB1Label.Width = dbLength; slDB1Label.Text = dbText; - slFAHydroxyCombobox.Location = new Point(slDB1Textbox.Left + slDB1Textbox.Width + sep, slDB1Textbox.Top); - slFAHydroxyCombobox.SelectedItem = "2"; - slFAHydroxyCombobox.Width = dbLength; - slFAHydroxyCombobox.DropDownStyle = ComboBoxStyle.DropDownList; - slFAHydroxyCombobox.SelectedIndexChanged += new EventHandler(slFAHydroxyComboboxValueChanged); - slFAHydroxyLabel.Location = new Point(slFAHydroxyCombobox.Left, slFAHydroxyCombobox.Top - sep); - slFAHydroxyLabel.Text = hydroxylText; + setupFGDataGridView(slFAFuncGroups, slDB1Textbox.Left + sep + dbLength, slFACombobox.Top, 3); + toolTip.SetToolTip(slFAFuncGroups, formattingHydroxyl); slLCBCombobox.BringToFront(); slLCBTextbox.BringToFront(); slLCBHydroxyCombobox.BringToFront(); - slFAHydroxyCombobox.BringToFront(); + slFAFuncGroups.BringToFront(); slLCBTextbox.Location = new Point(294, 158); slLCBTextbox.Width = faLength; slLCBTextbox.Text = "14, 16-18, 22"; @@ -2321,8 +2297,7 @@ private void InitializeComponent() stStep1.Controls.Add(stDBTextbox); stStep1.Controls.Add(stTypeGroup); stStep1.Controls.Add(stDBLabel); - stStep1.Controls.Add(stHydroxylTextbox); - stStep1.Controls.Add(stFAHydroxyLabel); + stStep1.Controls.Add(stFAFuncGroups); stStep1.Controls.Add(stPictureBox); stStep1.Controls.Add(stHgListbox); @@ -2390,7 +2365,7 @@ private void InitializeComponent() stFACombobox.BringToFront(); stFATextbox.BringToFront(); - stFATextbox.Location = new Point(574, 270); + stFATextbox.Location = new Point(574, 240); stFATextbox.Width = faLength; stFATextbox.Text = "2, 5, 17-19"; stFATextbox.TextChanged += delegate(object s, EventArgs e){ updateCarbon(s, new FattyAcidEventArgs( ((Sterol)currentLipid).fag, FattyAcidType.Ester )); }; @@ -2408,19 +2383,14 @@ private void InitializeComponent() stDBLabel.Location = new Point(stDBTextbox.Left, stDBTextbox.Top - sep); stDBLabel.Width = dbLength; stDBLabel.Text = dbText; - stHydroxylTextbox.Width = dbLength; - stHydroxylTextbox.Location = new Point(stDBTextbox.Left + stDBTextbox.Width + sep, stDBTextbox.Top); - stHydroxylTextbox.TextChanged += delegate(object s, EventArgs e){ updateHydroxyl(s, new FattyAcidEventArgs( ((Sterol)currentLipid).fag, FattyAcidType.Ester )); }; - toolTip.SetToolTip(stHydroxylTextbox, formattingHydroxyl); - stFAHydroxyLabel.Location = new Point(stHydroxylTextbox.Left, stHydroxylTextbox.Top - sep); - stFAHydroxyLabel.Text = hydroxylText; + setupFGDataGridView(stFAFuncGroups, stDBTextbox.Left + sep + dbLength, stFACombobox.Top, 4); + toolTip.SetToolTip(stFAFuncGroups, formattingHydroxyl); stFACombobox.Visible = false; stFATextbox.Visible = false; stDBTextbox.Visible = false; stDBLabel.Visible = false; - stHydroxylTextbox.Visible = false; - stFAHydroxyLabel.Visible = false; + stFAFuncGroups.Visible = false; @@ -2433,7 +2403,7 @@ private void InitializeComponent() stHgListbox.SelectedValueChanged += new System.EventHandler(stHGListboxSelectedValueChanged); stHgListbox.MouseMove += new System.Windows.Forms.MouseEventHandler(stHGListboxMouseHover); stHgListbox.KeyDown += ListboxSelectAll; - stPictureBox.Location = new Point(110, 40); + stPictureBox.Location = new Point(110, 12); if (!lipidCreatorInitError && stHgListbox.Items.Count > 0) { stPictureBox.Image = Image.FromFile(lipidCreator.headgroups[stHgListbox.Items[0].ToString()].pathToBackboneImage); diff --git a/LipidCreator/CreatorGUI.cs b/LipidCreator/CreatorGUI.cs index c4a4312..0c8f5f3 100644 --- a/LipidCreator/CreatorGUI.cs +++ b/LipidCreator/CreatorGUI.cs @@ -736,7 +736,7 @@ public void gmh_TheMouseMoved() if (hoveredViews.Count > 0) { expandedView = hoveredViews[0]; - expandedView.Height = 100; + expandedView.Height = 80; expandedView.BringToFront(); expandedView.Update(); } @@ -1431,8 +1431,7 @@ public void changeTabElements(int index) slLCBTextbox.Text = currentSphingolipid.lcb.lengthInfo; slDB2Textbox.Text = currentSphingolipid.lcb.dbInfo; slLCBCombobox.SelectedIndex = currentSphingolipid.lcb.chainType; - slLCBHydroxyCombobox.SelectedIndex = currentSphingolipid.lcb.hydroxylCounts.First() - 2; - if (!currentSphingolipid.isLyso) slFAHydroxyCombobox.SelectedIndex = currentSphingolipid.fag.hydroxylCounts.First(); + slFAFuncGroups.DataSource = currentSphingolipid.fag.functionalGroups; slFATextbox.Text = currentSphingolipid.fag.lengthInfo; slDB1Textbox.Text = currentSphingolipid.fag.dbInfo; @@ -1451,6 +1450,7 @@ public void changeTabElements(int index) updateRanges(currentSphingolipid.lcb, slDB2Textbox, 3); updateRanges(currentSphingolipid.fag, slFATextbox, slFACombobox.SelectedIndex); updateRanges(currentSphingolipid.fag, slDB1Textbox, 3); + updateFunctionalGroupGridView(currentSphingolipid.fag, slFAFuncGroups); slPictureBox.SendToBack(); break; @@ -1479,11 +1479,11 @@ public void changeTabElements(int index) stFATextbox.Text = currentSTLipid.fag.lengthInfo; stDBTextbox.Text = currentSTLipid.fag.dbInfo; - stHydroxylTextbox.Text = currentSTLipid.fag.hydroxylInfo; + stFAFuncGroups.DataSource = currentSTLipid.fag.functionalGroups; stFACombobox.SelectedIndex = currentSTLipid.fag.chainType; updateRanges(currentSTLipid.fag, stFATextbox, stFACombobox.SelectedIndex); updateRanges(currentSTLipid.fag, stDBTextbox, 3); - updateRanges(currentSTLipid.fag, stHydroxylTextbox, 4); + updateFunctionalGroupGridView(currentSTLipid.fag, stFAFuncGroups); break; @@ -2605,9 +2605,8 @@ void slChangeLyso(bool lyso) slFACombobox.Visible = false; slFATextbox.Visible = false; slDB1Textbox.Visible = false; - slFAHydroxyCombobox.Visible = false; + slFAFuncGroups.Visible = false; slDB1Label.Visible = false; - slFAHydroxyLabel.Visible = false; } else { @@ -2619,9 +2618,8 @@ void slChangeLyso(bool lyso) slFACombobox.Visible = true; slFATextbox.Visible = true; slDB1Textbox.Visible = true; - slFAHydroxyCombobox.Visible = true; + slFAFuncGroups.Visible = true; slDB1Label.Visible = true; - slFAHydroxyLabel.Visible = true; } slHgList.Sort(); @@ -2696,8 +2694,7 @@ public void chContainsEsterCheckedChanged(Object sender, EventArgs e) stFATextbox.Visible = ((Sterol)currentLipid).containsEster; stDBTextbox.Visible = ((Sterol)currentLipid).containsEster; stDBLabel.Visible = ((Sterol)currentLipid).containsEster; - stHydroxylTextbox.Visible = ((Sterol)currentLipid).containsEster; - stFAHydroxyLabel.Visible = ((Sterol)currentLipid).containsEster; + stFAFuncGroups.Visible = ((Sterol)currentLipid).containsEster; } @@ -3188,9 +3185,10 @@ public LipidCategory checkPropertiesValid() else if (currentLipid is Sphingolipid) { bool hasOneHG = false; + Sphingolipid currentSphingolipid = (Sphingolipid)currentLipid; foreach (string headgroup in currentLipid.headGroupNames) { - if ( !(lipidCreator.headgroups[headgroup].attributes.Contains("lyso") ^ ((Sphingolipid)currentLipid).isLyso) ) + if ( !(lipidCreator.headgroups[headgroup].attributes.Contains("lyso") ^ currentSphingolipid.isLyso) ) { hasOneHG = true; break; @@ -3222,16 +3220,22 @@ public LipidCategory checkPropertiesValid() MessageBox.Show("LCB double bond content not valid!", "Not registrable"); return LipidCategory.NoLipid; } + if (currentSphingolipid.fag.functionalGroupCounts == null) + { + MessageBox.Show("A functional group content in fatty acid is not valid!", "Not registrable"); + return LipidCategory.NoLipid; + } return LipidCategory.Sphingolipid; } else if (currentLipid is Sterol) { + Sterol currentSTLipid = (Sterol)currentLipid; bool hasOneHG = false; foreach (string headgroup in currentLipid.headGroupNames) { - if ( !(lipidCreator.headgroups[headgroup].attributes.Contains("ester") ^ ((Sterol)currentLipid).containsEster) ) + if ( !(lipidCreator.headgroups[headgroup].attributes.Contains("ester") ^ currentSTLipid.containsEster) ) { hasOneHG = true; break; @@ -3252,9 +3256,9 @@ public LipidCategory checkPropertiesValid() MessageBox.Show("FA double bond content not valid!", "Not registrable"); return LipidCategory.NoLipid; } - if (stIsEster.Checked && stHydroxylTextbox.BackColor == alertColor) + if (stIsEster.Checked && currentSTLipid.fag.functionalGroupCounts == null) { - MessageBox.Show("Hydroxyl content not valid!", "Not registrable"); + MessageBox.Show("A functional group content in fatty acid is not valid!", "Not registrable"); return LipidCategory.NoLipid; } return LipidCategory.Sterollipid; @@ -3525,7 +3529,7 @@ public DataRow createLipidsGridviewRow(Lipid currentRegisteredLipid) headGroupNames.AddRange(currentSphingolipid.headGroupNames); row["Building Block 1"] = "HG: " + String.Join(", ", currentSphingolipid.headGroupNames); row["Building Block 2"] = FARepresentation(currentSphingolipid.lcb) + currentSphingolipid.lcb.lengthInfo + "; DB: " + currentSphingolipid.lcb.dbInfo + "; OH: " + currentSphingolipid.lcb.hydroxylCounts.First(); - if (!currentSphingolipid.isLyso) row["Building Block 3"] = FARepresentation(currentSphingolipid.fag) + currentSphingolipid.fag.lengthInfo + "; DB: " + currentSphingolipid.fag.dbInfo + "; OH: " + currentSphingolipid.fag.hydroxylCounts.First(); + if (!currentSphingolipid.isLyso) row["Building Block 3"] = FARepresentation(currentSphingolipid.fag) + currentSphingolipid.fag.lengthInfo + "; DB: " + currentSphingolipid.fag.dbInfo + currentSphingolipid.fag.functionalGroupsInfo(); } else if (currentRegisteredLipid is Sterol) @@ -3535,7 +3539,7 @@ public DataRow createLipidsGridviewRow(Lipid currentRegisteredLipid) headGroupNames.AddRange(currentSTLipid.headGroupNames); row["Building Block 1"] = "HG: " + String.Join(", ", currentSTLipid.headGroupNames); - if (currentSTLipid.containsEster) row["Building Block 2"] = FARepresentation(currentSTLipid.fag) + currentSTLipid.fag.lengthInfo + "; DB: " + currentSTLipid.fag.dbInfo + "; OH: " + currentSTLipid.fag.hydroxylInfo; + if (currentSTLipid.containsEster) row["Building Block 2"] = FARepresentation(currentSTLipid.fag) + currentSTLipid.fag.lengthInfo + "; DB: " + currentSTLipid.fag.dbInfo + currentSTLipid.fag.functionalGroupsInfo(); } else if (currentRegisteredLipid is Mediator) diff --git a/LipidCreator/Sterol.cs b/LipidCreator/Sterol.cs index 9d209bf..82f2214 100644 --- a/LipidCreator/Sterol.cs +++ b/LipidCreator/Sterol.cs @@ -165,9 +165,7 @@ public override void computePrecursorData(IDictionary headgro { foreach (string headgroup in headGroupNames) { - string key = "/" + Lipid.FAPrefix[fa.fattyAcidType]; - key += Convert.ToString(fa.length) + ":" + Convert.ToString(fa.db); - if (fa.hydroxyl > 0) key += ";" + Convert.ToString(fa.hydroxyl); + string key = "/" + Lipid.FAPrefix[fa.fattyAcidType] + fa.ToString(); // goslin csgoslin.LipidSpecies lipidSpecies = convertLipid(headgroup, new List{fa});