/// <summary>
 /// Author: Andy Tang
 /// </summary>
 protected void Page_LoadComplete(object sender, EventArgs e)
 {
     try
     {
         ScriptManager.RegisterStartupScript(Page, GetType(), "D_3DViewer_Info", "javascript:loadDrugLigandInfo('" + drug.Drug_PDB_ID + "');", true);
     }
     catch (Exception)
     {
         Page.Master.FindControl("BodyContentPlaceHolder").Visible = false;
         ExceptionUtilities.DisplayAlert(this, QUERY_PAGE);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Author: Ryan Liang
        /// </summary>
        protected void Download_Summary_Click(object sender, EventArgs e)
        {
            try
            {
                Response.ClearContent();
                Response.Clear();
                Response.ContentType = "application/x-unknown";
                Response.AddHeader("Content-Disposition", "attachment; " +
                                   "filename=DrugProNET_PDB ID " + Session["PDB_File_ID"] + "_Bond Distance " +
                                   Session["interaction_distance"] + " Å_Side Chain Interactions.xlsx");

                List <string> header = new List <string>()
                {
                    "Protein Amino Acid Residue",
                    "Number of Interactions with Drug Atoms",
                    "Average Distance of All Interactions(Å)",
                    "# Interactions : Distance Ratio",
                };

                List <InteractionSummaryRow> interactionSummaryRows = (List <InteractionSummaryRow>)Session["interactionSummaryRows"];

                List <List <string> > data = new List <List <string> >();

                foreach (InteractionSummaryRow interactionSummaryRow in interactionSummaryRows)
                {
                    List <string> dataRow = new List <string>
                    {
                        interactionSummaryRow.proteinAAResidue,
                        interactionSummaryRow.numberOfInteractionsWithDrugAtom.ToString(),
                        interactionSummaryRow.averageDistanceOfAllInteractions.ToString(),
                        interactionSummaryRow.interactionToDistanceRatio.ToString(),
                    };

                    data.Add(dataRow);
                }

                Response.BinaryWrite(ExcelWriter.CreateAsStream(header, data).ToArray());

                Response.Flush();
                Response.SuppressContent = true;
                System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            catch (Exception)
            {
                ExceptionUtilities.DisplayAlert(this, DEFAULT_REDIRECT_PAGE);
            }
        }
        /// <summary>
        /// Author: Andy Tang
        /// </summary>
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            string query = Request.QueryString["query_string"];

            Protein_Information protein = EF_Data.GetProteinsInfoQuery(query).FirstOrDefault();

            if (protein != null)
            {
                LoadData(protein);
            }
            else
            {
                Page.Master.FindControl("BodyContentPlaceHolder").Visible = false;
                ExceptionUtilities.DisplayAlert(this, QUERY_PAGE);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Author: Garth Nelson
        /// </summary>
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            SNV_ID_Key = Request.QueryString["query_string"];

            try
            {
                string stringAfterPDot   = SNV_ID_Key.Substring(SNV_ID_Key.IndexOf("p.") + 2);
                string specifiedAAType   = new string(stringAfterPDot.TakeWhile(c => char.IsLetter(c)).ToArray());
                string specifiedAANumber = new string(stringAfterPDot.Substring(specifiedAAType.Length).TakeWhile(c => char.IsNumber(c)).ToArray());
                string specifiedAA       = specifiedAAType + "-" + specifiedAANumber;

                mutations       = EF_Data.GetMutationsBySNVIDKey(SNV_ID_Key);
                proteinMutation = EF_Data.GetMutationBySNVIDKey(SNV_ID_Key);
                protein         = EF_Data.GetProteinByUniprotID(proteinMutation.UniProt_ID);

                foreach (SNV_Mutation mutation in mutations)
                {
                    Drug_Information drug = EF_Data.GetDrugByDrugPDBID(mutation.Drug_PDB_ID);

                    drugs.Add(drug);

                    PDB_Interaction interaction = EF_Data.GetPDB_Interaction(mutation.UniProt_ID, mutation.Drug_PDB_ID, specifiedAA);

                    interactions.Add(interaction);
                }

                Session["drugs"]        = drugs;
                Session["interactions"] = interactions;
                Session["mutations"]    = mutations;
                Session["SNV_ID_Key"]   = SNV_ID_Key;

                LoadSNVID(SNV_ID_Key);
                LoadTargetGeneID(protein, mutations[0]);

                CreateIDofPDILinkedSNVTable(drugs, interactions, mutations);
            }
            catch (Exception)
            {
                Page.Master.FindControl("BodyContentPlaceHolder").Visible = false;
                ExceptionUtilities.DisplayAlert(this, QUERY_PAGE);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Author: Garth Nelson
        /// </summary>
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            try
            {
                string protein_specification = Request.QueryString["query_string"];
                string drug_specification    = Request.QueryString["drug_specification"];
                string SNV_Key = Request.QueryString["snv_id_key"];

                Session["SNV_Key"] = SNV_Key;

                Protein_Information protein = EF_Data.GetProtein(protein_specification);
                Drug_Information    drug    = EF_Data.GetDrugUsingDropDownName(drug_specification);
                PDB_Information     PDB     = EF_Data.GetPDBInfo(protein, drug);

                string[] SNV_KEYsplit = SNV_Key.Split('-');

                // Retrieve second and third elements
                string amino_acid_specification = SNV_KEYsplit[1] + "-" + SNV_KEYsplit[2];

                PDB_Interaction interaction = EF_Data.GetPDB_Interaction(protein.Uniprot_ID, drug.Drug_PDB_ID, amino_acid_specification);
                mutation = EF_Data.GetMutationBySNVKey(SNV_Key);

                Session["mutation"] = mutation;

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

                CreateSNVIdentificationTable(mutation);
            }
            catch (Exception)
            {
                Page.Master.FindControl("BodyContentPlaceHolder").Visible = false;
                ExceptionUtilities.DisplayAlert(this, QUERY_PAGE);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Author: Ryan Liang
        /// </summary>
        protected void Download_List_Click(object sender, EventArgs e)
        {
            try
            {
                Dictionary <PDB_Distance, string> DistanceAndUniprotResidueNumbers = (Dictionary <PDB_Distance, string>)Session["DistanceAndUniprotResidueNumbers"];
                interaction_distance    = (double)Session["interaction_distance"];
                protein_chain           = (bool)Session["protein_chain"];
                protein_atoms           = (bool)Session["protein_atoms"];
                protein_residues        = (bool)Session["protein_residues"];
                protein_residue_numbers = (bool)Session["protein_residue_numbers"];
                drug_atoms = (bool)Session["drug_atoms"];

                Response.ClearContent();
                Response.Clear();
                Response.ContentType = "application/x-unknown";
                Response.AddHeader("Content-Disposition", "attachment; " +
                                   "filename=DrugProNET_PDB ID " + Session["PDB_File_ID"] + "_Bond Distance " +
                                   Session["interaction_distance"] + " Å_Atom Interactions.xlsx");

                List <string> header = new List <string>()
                {
                    "Distance (Å)",
                };

                if (protein_chain)
                {
                    header.Add("Protein Chain");
                }

                if (protein_residue_numbers)
                {
                    header.Add("Protein Residue #");
                }

                if (protein_residues)
                {
                    header.Add("Amino Acid Residue Type");
                }

                if (protein_atoms)
                {
                    header.Add("Amino Acid Residue Atom");
                }

                if (drug_atoms)
                {
                    header.Add("Drug Atom");
                }

                List <List <string> > data = new List <List <string> >();

                foreach (KeyValuePair <PDB_Distance, string> kvp in DistanceAndUniprotResidueNumbers)
                {
                    List <string> dataRow = new List <string>
                    {
                        kvp.Key.Distance.ToString()
                    };

                    if (protein_chain)
                    {
                        dataRow.Add(kvp.Key.Protein_Chain);
                    }

                    if (protein_residue_numbers)
                    {
                        dataRow.Add(kvp.Value);
                    }

                    if (protein_residues)
                    {
                        dataRow.Add(kvp.Key.Protein_Residue);
                    }

                    if (protein_atoms)
                    {
                        dataRow.Add(kvp.Key.Protein_Atom);
                    }

                    if (drug_atoms)
                    {
                        dataRow.Add(kvp.Key.Compound_Atom);
                    }

                    data.Add(dataRow);
                }

                Response.BinaryWrite(ExcelWriter.CreateAsStream(header, data).ToArray());

                Response.Flush();
                Response.SuppressContent = true;
                System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
            }
            catch (Exception)
            {
                ExceptionUtilities.DisplayAlert(this, DEFAULT_REDIRECT_PAGE);
            }
        }
Esempio n. 7
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);
                }
            }
        }