Beispiel #1
0
        public static List <string> GetAutoCompleteData(string prefixText, int count)
        {
            const int     minPrefixLength = 3;
            List <string> valuesList      = new List <string>();

            if (prefixText.Length >= minPrefixLength)
            {
                try
                {
                    List <Drug_Information> drugs = EF_Data.GetDrugsQuery(prefixText);

                    foreach (Drug_Information drug in drugs)
                    {
                        valuesList.Add(drug.Other_Drug_Name_Alias);
                        valuesList.Add(drug.Drug_Common_Name);
                        valuesList.Add(drug.Drug_Chemical_Name);
                        valuesList.Add(drug.Compound_CAS_ID);
                        valuesList.Add(drug.PubChem_CID);
                        valuesList.Add(drug.ChEMBL_ID);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(DataUtilities.FilterDropdownList(valuesList, prefixText));
        }
Beispiel #2
0
        /// <summary>
        /// Author: Andy Tang
        /// </summary>
        protected void Search_Textbox_Changed(object sender, EventArgs e)
        {
            search_drop_down.Items.Clear();
            search_drop_down.Items.Add(DROP_DOWN_PROMPT_MESSAGE);

            List <Protein_Information> proteinList = new List <Protein_Information>();

            const int minPrefixLength = 3;

            if (search_textBox.Text.Length < minPrefixLength)
            {
                return;
            }
            Drug_Information drug = EF_Data.GetDrugsQuery(search_textBox.Text).FirstOrDefault();

            if (drug != null)
            {
                List <PDB_Information> pdbInfoList = EF_Data.GetPDBInfoUsingDrug(drug.Drug_PDB_ID);

                foreach (PDB_Information pdb in pdbInfoList)
                {
                    Protein_Information protein = EF_Data.GetProteinByUniprotID(pdb.UniProt_ID);

                    if (protein != null)
                    {
                        proteinList.Add(protein);
                    }
                }
            }

            if (proteinList.Count > 0)
            {
                List <string> valuesList = new List <string>();

                foreach (Protein_Information protein in proteinList)
                {
                    valuesList.Add(protein.UniProt_ID);
                    valuesList.Add(protein.Protein_Short_Name);
                    valuesList.Add(protein.Protein_Full_Name);
                    valuesList.Add(protein.Protein_Alias);
                    valuesList.Add(protein.NCBI_RefSeq_NP_ID);
                    valuesList.Add(protein.PhosphoNET_Name);
                    valuesList.Add(protein.PDB_Protein_Name);
                }

                valuesList = DataUtilities.FilterDropdownList(valuesList);

                foreach (string value in valuesList)
                {
                    search_drop_down.Items.Add(new ListItem(value, value, true));
                }
            }
            else
            {
                search_drop_down.Items.Clear();
                search_drop_down.Items.Add(DROP_DOWN_NO_MATCHES_MESSAGE);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Author: Andy Tang, Ryan Liang
        /// </summary>
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!IsPostBack)
            {
                string fromPage     = null;
                string query_string = null;

                try
                {
                    query_string = Request.QueryString["query_string"];

                    drug_specification    = Request.QueryString["drug_specification"];
                    protein_specification = Request.QueryString["protein_specification"];

                    if (!string.IsNullOrEmpty(drug_specification))
                    {
                        protein_specification = query_string;
                        fromPage = "protein";
                    }
                    else if (!string.IsNullOrEmpty(protein_specification))
                    {
                        drug_specification = query_string;
                        fromPage           = "drug";
                    }

                    drug    = EF_Data.GetDrugsQuery(drug_specification).FirstOrDefault();
                    protein = EF_Data.GetProteinsInfoQuery(protein_specification).FirstOrDefault();
                    PDB     = EF_Data.GetPDBInfo(protein, drug);
                    Session["PDB_File_ID"] = PDB.PDB_File_ID;

                    interaction_distance    = double.Parse(Request.QueryString["interaction_distance"]);
                    protein_chain           = bool.Parse(Request.QueryString["protein_chain"]);
                    protein_atoms           = bool.Parse(Request.QueryString["protein_atoms"]);
                    protein_residues        = bool.Parse(Request.QueryString["protein_residues"]);
                    protein_residue_numbers = bool.Parse(Request.QueryString["protein_residue_numbers"]);
                    drug_atoms = bool.Parse(Request.QueryString["drug_atoms"]);

                    Session["interaction_distance"] = interaction_distance;
                }
                catch (Exception)
                {
                    throw;
                }

                if (drug == null || protein == null || PDB == null)
                {
                    Page.Master.FindControl("BodyContentPlaceHolder").Visible = false;

                    if (fromPage != null)
                    {
                        ExceptionUtilities.DisplayAlert(this, fromPage.Equals("drug") ? DRUG_QUERY_PAGE : PROTEIN_QUERY_PAGE);
                    }
                    else
                    {
                        ExceptionUtilities.DisplayAlert(this, DEFAULT_REDIRECT_PAGE);
                    }
                }
                else
                {
                    Session["interaction_distance"]    = interaction_distance;
                    Session["protein_chain"]           = protein_chain;
                    Session["protein_atoms"]           = protein_atoms;
                    Session["protein_residues"]        = protein_residues;
                    Session["protein_residue_numbers"] = protein_residue_numbers;
                    Session["drug_atoms"] = drug_atoms;

                    LoadProtein(protein);
                    LoadDrug(drug, PDB);
                    LoadPDB_Info(PDB);

                    GetDrugAtomNumberingImage(drug);

                    CreateInteractionList(PDB, interaction_distance, protein_chain, protein_atoms, protein_residues, protein_residue_numbers, drug_atoms);

                    CreateInteractionSummary();

                    ScriptManager.RegisterStartupScript(Page, GetType(), "D_3DViewer", "javascript:loadDrugLigand('" + drug.Drug_PDB_ID + "');", true);
                    ScriptManager.RegisterStartupScript(Page, GetType(), "PDB_3DViewer", "javascript:loadStage('" + drug.PDB_File_ID + "', '" + drug.Drug_PDB_ID + "');", true);
                }
            }
        }