/// <summary> /// Reads peptide Fasta-Sequence(s) and generates HELMNotation /// </summary> /// <param name="peptide"></param> /// <returns></returns> public string GenerateHELMFromFastaPeptide(string peptide) { peptide = Lex.AdjustEndOfLineCharacters(peptide, "\n"); Task <string> task = WSC.GenerateHELMInputPostPEPTIDEAsync(peptide); return(GetStringResult(task, "HELMNotation")); // ">PEPTIDE1\nALC\n" ===> {"HELMNotation":"PEPTIDE1{A.L.C}$$$$" } }
/// <summary> /// Reads rna Fasta-Sequence(s) and generates HELMNotation /// </summary> /// <param name="rna"></param> /// <returns></returns> public string GenerateHELMFromFastaRNA(string rna) { rna = Lex.AdjustEndOfLineCharacters(rna, "\n"); Task <string> task = WSC.GenerateHELMInputPostRNAAsync(rna); return(GetStringResult(task, "HELMNotation")); // ===> RNA1{R(U)P.R(T)P.R(G)P.R(C)P.R(A)}$$$$ }
int ShowInstance( string message, string caption, string button1, string button2, string button3, string button4, MessageBoxIcon icon, int width = -1, int height = -1) { IWin32Window owner = SessionManager.ActiveForm; DialogResult dr; try { // Use DevExpress message box if (Message == null) { XtraMessageBox.SmartTextWrap = true; XtraMessageBoxArgs mba = new XtraMessageBoxArgs(); mba.Owner = Owner; mba.Text = message; mba.Caption = caption; mba.Buttons = new DialogResult[] { DialogResult.OK }; mba.AllowHtmlText = DevExpress.Utils.DefaultBoolean.False; dr = XtraMessageBox.Show(mba); return((int)dr); } if (width > 0) // size specified { Width = width; Height = height; } Text = caption; Message.Text = message; int definedCount = 0; definedCount += SetupButton(Button1, button1); definedCount += SetupButton(Button2, button2); definedCount += SetupButton(Button3, button3); definedCount += SetupButton(Button4, button4); int shift = (Button2.Left - Button1.Left) * (4 - definedCount); Button1.Left += shift; Button2.Left += shift; Button3.Left += shift; Button4.Left += shift; if (message.Contains("</") || message.Contains("/>") || Lex.Contains(message, "<br>")) { // display HTML prompt Message.Visible = false; HtmlMessage.Visible = true; string htmlFile = TempFile.GetTempFileName("html"); StreamWriter sw = new StreamWriter(htmlFile); int backColor = ((BackColor.R * 256 + BackColor.G) * 256) + BackColor.B; string hexColor = String.Format("#{0:X}", backColor); if (!Lex.Contains(message, "<body")) // set basic style for page { sw.Write("<body " + " topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' hspace='0' vspace='0' " + " style=\"font-size:8.5pt;font-family:'Tahoma';background-color:" + hexColor + "\">"); } else // just try to set matching background color { message = Lex.Replace(message, "background-color: #FFFFFF", "background-color: " + hexColor); } message = message.Replace("\n", "<br>"); message = message.Replace("\r", ""); sw.Write(message); if (!Lex.Contains(message, "<body")) { sw.Write("</body>"); } sw.Close(); HtmlMessage.Navigate(htmlFile); } else // display simple label prompt { HtmlMessage.Visible = false; Message.Visible = true; Message.BackColor = Message.Parent.BackColor; if (Lex.Contains(message, "<br>")) // replace "<br>" with newlines { message = message.Replace("<br>", "\n"); } message = Lex.AdjustEndOfLineCharacters(message, "\n"); // convert any new line chars to standard char Message.Lines = message.Split('\n'); if (Message.Lines.Length <= 4) { Message.BorderStyle = BorderStyles.NoBorder; Message.Properties.ScrollBars = ScrollBars.None; } else { Message.BorderStyle = BorderStyles.Default; Message.Properties.ScrollBars = ScrollBars.Vertical; } //Message.Text = prompt; } SetIconImageIndex(IconImage, icon); // set the proper icon owner = SessionManager.ActiveForm; //owner = null; // debug (switching to another app and then back to the main form does not bring up this modal dialog) dr = ShowDialog(owner); return((int)dr); } catch (Exception ex) { string errorMsg = "Show: " + message + "\r\n" + new StackTrace(true); ClientLog.Message(errorMsg); DebugLog.Message(errorMsg); return((int)DialogResult.OK); } }