Exemplo n.º 1
0
        /// <summary>
        /// Author: Ryan Liang
        /// </summary>
        protected void Download_Button_Click(object sender, EventArgs e)
        {
            SNV_ID_Key = (string)Session["SNV_ID_Key"];

            Response.ClearContent();
            Response.Clear();
            Response.ContentType = "application/x-unknown";
            Response.AddHeader("Content-Disposition", "attachment; " +
                               "filename=DrugProNET_SNV ID " + SNV_ID_Key + ".xlsx");

            List <string> header = new List <string>()
            {
                "Drug Name", "PDB File No.", "Drug PDB No.",
                "Drug PubChem CID", "Drug ChEMBL ID", "Importance for Drug", "Effect of Mutation"
            };

            drugs        = (List <Drug_Information>)Session["drugs"];
            interactions = (List <PDB_Interaction>)Session["interactions"];
            mutations    = (List <SNV_Mutation>)Session["mutations"];

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

            for (int i = 0; i < mutations.Count; i++)
            {
                List <string> dataRow = new List <string>
                {
                    drugs[i]?.Drug_Common_Name,
                    mutations[i]?.PDB_File_ID,
                    mutations[i]?.Drug_PDB_ID,
                    drugs[i]?.PubChem_CID,
                    drugs[i]?.ChEMBL_ID,
                    interactions[i]?.Interaction_Distance_Ratio,
                    FindPredictedEffiency(mutations[i])
                };

                data.Add(dataRow);
            }

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

            Response.Flush();
            Response.SuppressContent = true;
            System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Author: Ryan Liang
        /// </summary>
        protected void Download_SNV_Identification_Click(object sender, EventArgs e)
        {
            Response.ClearContent();
            Response.Clear();
            Response.ContentType = "application/x-unknown";
            Response.AddHeader("Content-Disposition", "attachment; " +
                               "filename=DrugProNET_SNV " + Session["SNV_Key"] + ".xlsx");

            mutation = (SNV_Mutation)Session["mutation"];

            List <string> header = new List <string>()
            {
                "Variant ID", "SNV", "Predicted Effect on Drug Binding"
            };
            List <List <string> > data = new List <List <string> >()
            {
                new List <string>()
                {
                    mutation.P1W, mutation.SNV_P1W_ID, mutation.Drug_Inter__Pred__P1W
                },
                new List <string>()
                {
                    mutation.P2W, mutation.SNV_P2W_ID, mutation.Drug_Inter__Pred__P2W
                },
                new List <string>()
                {
                    mutation.P3W, mutation.SNV_P3W_ID, mutation.Drug_Inter__Pred__P3W
                },
                new List <string>()
                {
                    mutation.P1M1, mutation.SNV_P1M1_ID, mutation.Drug_Inter__Pred__P1M1
                },
                new List <string>()
                {
                    mutation.P1M2, mutation.SNV_P1M2_ID, mutation.Drug_Inter__Pred__P1M2
                },
                new List <string>()
                {
                    mutation.P1M3, mutation.SNV_P1M3_ID, mutation.Drug_Inter__Pred__P1M3
                },
                new List <string>()
                {
                    mutation.P2M1, mutation.SNV_P2M1_ID, mutation.Drug_Inter__Pred__P2M1
                },
                new List <string>()
                {
                    mutation.P2M2, mutation.SNV_P2M2_ID, mutation.Drug_Inter__Pred__P2M2
                },
                new List <string>()
                {
                    mutation.P2M3, mutation.SNV_P2M3_ID, mutation.Drug_Inter__Pred__P2M3
                },
                new List <string>()
                {
                    mutation.P3M1, mutation.SNV_P3M1_ID, mutation.Drug_Inter__Pred__P3M1
                },
                new List <string>()
                {
                    mutation.P3M2, mutation.SNV_P3M2_ID, mutation.Drug_Inter__Pred__P3M2
                },
                new List <string>()
                {
                    mutation.P3M3, mutation.SNV_P3M3_ID, mutation.Drug_Inter__Pred__P3M3
                },
            };

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

            Response.Flush();
            Response.SuppressContent = true;
            System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Exemplo n.º 3
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);
            }
        }