User 0908c5ccdd
20-09-2007 08:55:35
My Marvin viewer is working really well on my ASP.NET pages. I can retrieve chemistry using the CD_SMILES column and display the structures on the page. This works fine. However I wasn't sure how to go about using the mol file in CD_STRUCTURE to display the results as this is stored in a BLOB type column. I need to start using the mol file as it contains the enhanced stereochemistry that is missing in the SMILES string.
Q1. Are there any examples on how to translate the BLOB field so that it can be sent to the Marvin viewer using the method I'm using below?
Q2. Also, is there a way to avoid having to declare the variable (sSMILES in this case) publicly?
So far a simplified version of my code looks like this:
and the VB.NET code is:
Q1. Are there any examples on how to translate the BLOB field so that it can be sent to the Marvin viewer using the method I'm using below?
Q2. Also, is there a way to avoid having to declare the variable (sSMILES in this case) publicly?
So far a simplified version of my code looks like this:
Code: |
<div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="select cd_smiles from compounds where cd_id = 1"> </asp:SqlDataSource> <script language= "Javascript1.1" src="Marvin/marvin.js"></script> <script language="Javascript1.1"> <!-- mview_begin("Marvin/", 200, 200); mview_param("mol", "<%= convertForJavaScript(sSMILES) %>") mview_param("background", "#F5F5FF"); mview_end(); !--> </script> </div> |
and the VB.NET code is:
Code: |
Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Public sSMILES As String Public Function convertForJavaScript(ByVal t) t = Replace(t, "\", "\\") ' replace \ with \\ t = Replace(t, vbCrLf, "\n") ' replace CrLf with \n t = Replace(t, vbCr, "\n") ' replace single Cr with \n t = Replace(t, vbLf, "\n") ' replace single Lf with \n t = Replace(t, """", "\""") ' replace " with \" t = Replace(t, "'", "\'") ' replace ' with \' convertForJavaScript = t End Function Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim SmilesFound As DataView = _ CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView) sSMILES = SmilesFound(0)("CD_SMILES").ToString() End Sub End Class |