public string GetDisease(String symptoms_name)
        {
            List <disease> listDisease = new List <disease>();

            string CS = ConfigurationManager.ConnectionStrings["EhealthConnectionString"].ConnectionString;

            using (SqlConnection con = new SqlConnection(CS))
            {
                SqlCommand cmd = new SqlCommand("sendDisease", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter parameter = new SqlParameter();
                parameter.ParameterName = "@symptoms";
                parameter.Value         = symptoms_name;
                cmd.Parameters.Add(parameter);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    disease dis = new disease();
                    dis.Disease = rdr["DiseaseName"].ToString();
                    listDisease.Add(dis);
                }
                String serializedList = JsonConvert.SerializeObject(listDisease);
                return(serializedList);
            }
        }
Beispiel #2
0
        private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            //if ((Application.Current as App).BindSearchEnd!=null&&(Application.Current as App).BindSearchEnd.Count != 0)
            //{
            //    (Application.Current as App).BindSearchEnd.ToList().ForEach(a =>
            //    {
            //        se.Add(a);
            //    });
            //    loading.Visibility = Visibility.Collapsed;
            //    return;
            //}
            if (loaded)
            {
                return;
            }
            if (!string.IsNullOrEmpty(key))
            {
                //相关疾病post
                string                diseaseUrl = "http://drugs.dxy.cn/api/v2/search";
                HttpRequestMessage    request    = new HttpRequestMessage(HttpMethod.Post, new Uri(diseaseUrl));
                FormUrlEncodedContent postData   = new FormUrlEncodedContent(
                    new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("category", "3"),
                    new KeyValuePair <string, string>("u", ""),
                    new KeyValuePair <string, string>("keywords", key),
                    new KeyValuePair <string, string>("mc", "0000000005e6b1d8ffffffff9c1fe4e0"),
                    new KeyValuePair <string, string>("page", "1"),
                    new KeyValuePair <string, string>("hardName", "ASUS_X002"),
                    new KeyValuePair <string, string>("ac", "d5424fa6-adff-4b0a-8917-4264daf4a348"),
                    new KeyValuePair <string, string>("bv", "2014"),
                    new KeyValuePair <string, string>("vc", "3.5"),
                    new KeyValuePair <string, string>("vs", "4.4.4"),
                    new KeyValuePair <string, string>("type", "1")
                }
                    );
                request.Content = postData;
                HttpResponseMessage response = await c.SendAsync(request);

                string responseString = await response.Content.ReadAsStringAsync();

                dis = JsonConvert.DeserializeObject <disease>(responseString);
                se.Add(new searchEnd {
                    Name = "相关疾病", Color = "Grey", Kind = "disease"
                });
                if (dis.Data != null)
                {
                    if (dis.Data.Count < 2)
                    {
                        se.Add(new searchEnd {
                            Id = dis.Data[0].Id, Name = dis.Data[0].ShowName, Color = "White", Kind = "disease"
                        });
                    }
                    else
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            se.Add(new searchEnd {
                                Id = dis.Data[i].Id, Name = dis.Data[i].ShowName, Color = "White", Kind = "disease"
                            });
                        }
                    }
                }

                //相关问答
                string disease = "http://dxy.com/app/i/faq/qa/related?items_per_page=1000&q=" + key;

                HttpResponseMessage msg = await c.GetAsync(disease);

                var content = await msg.Content.ReadAsStringAsync();

                if (!content.Contains("error"))
                {
                    string tmp = content.Substring(8, content.Length - 9);
                    qa = JsonConvert.DeserializeObject <qa>(tmp);
                    se.Add(new searchEnd {
                        Name = "相关疾病问答", Color = "Grey", Kind = "qa"
                    });
                    if (qa.Items != null)
                    {
                        if (qa.Items.Count < 2)
                        {
                            se.Add(new searchEnd {
                                Id = qa.Items[0].Id, Name = qa.Items[0].Title, Color = "White", Kind = "qa", ArticleId = qa.Items[0].Article_id, DiseaseName = qa.Items[0].Disease_name
                            });
                        }
                        else
                        {
                            for (int i = 0; i < 2; i++)
                            {
                                se.Add(new searchEnd {
                                    Id = qa.Items[i].Id, Name = qa.Items[i].Title, Color = "White", Kind = "qa", ArticleId = qa.Items[i].Article_id, DiseaseName = qa.Items[i].Disease_name
                                });
                            }
                        }
                    }
                }



                //相关科普文章
                string article = "http://dxy.com/app/i/columns/article/related?q=" + key;
                HttpResponseMessage articleMsg = await c.GetAsync(article);

                var articleCon = await articleMsg.Content.ReadAsStringAsync();

                string articleTmp = articleCon.Substring(8, articleCon.Length - 9);
                art = JsonConvert.DeserializeObject <article>(articleTmp);
                se.Add(new searchEnd {
                    Name = "相关科普文章", Color = "Grey", Kind = "article"
                });
                if (art.Items != null)
                {
                    if (art.Items.Count < 2)
                    {
                        se.Add(new searchEnd {
                            Id = art.Items[0].Id, Name = art.Items[0].Article_title, Color = "White", Kind = "article"
                        });
                    }
                    else
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            se.Add(new searchEnd {
                                Id = art.Items[i].Id, Name = art.Items[i].Article_title, Color = "White", Kind = "article"
                            });
                        }
                    }
                }



                //相关药品
                request  = new HttpRequestMessage(HttpMethod.Post, new Uri(diseaseUrl));
                postData = new FormUrlEncodedContent(
                    new List <KeyValuePair <string, string> >
                {
                    new KeyValuePair <string, string>("category", "1"),
                    new KeyValuePair <string, string>("u", ""),
                    new KeyValuePair <string, string>("keywords", key),
                    new KeyValuePair <string, string>("mc", "0000000005e6b1d8ffffffff9c1fe4e0"),
                    new KeyValuePair <string, string>("page", "1"),
                    new KeyValuePair <string, string>("hardName", "ASUS_X002"),
                    new KeyValuePair <string, string>("ac", "d5424fa6-adff-4b0a-8917-4264daf4a348"),
                    new KeyValuePair <string, string>("bv", "2014"),
                    new KeyValuePair <string, string>("vc", "3.5"),
                    new KeyValuePair <string, string>("vs", "4.4.4"),
                    new KeyValuePair <string, string>("type", "1")
                }
                    );
                request.Content = postData;
                response        = await c.SendAsync(request);

                responseString = await response.Content.ReadAsStringAsync();

                med = JsonConvert.DeserializeObject <medicine>(responseString);
                se.Add(new searchEnd {
                    Name = "相关药品", Color = "Grey", Kind = "medicine"
                });
                if (med.Data != null)
                {
                    if (med.Data.Count < 2)
                    {
                        se.Add(new searchEnd {
                            Id = med.Data[0].Id, Name = med.Data[0].ShowName, Color = "White", Kind = "medicine"
                        });
                    }
                    else
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            se.Add(new searchEnd {
                                Id = med.Data[i].Id, Name = med.Data[i].ShowName, Color = "White", Kind = "medicine"
                            });
                        }
                    }
                }

                (Application.Current as App).BindQa = new ObservableCollection <qaSec>();
                if (qa != null && qa.Items != null)
                {
                    qa.Items.ForEach(z =>
                    {
                        (Application.Current as App).BindQa.Add(z);
                    });
                }


                (Application.Current as App).BindArticle = new ObservableCollection <articleSec>();
                if (art != null && art.Items != null)
                {
                    art.Items.ForEach(z =>
                    {
                        (Application.Current as App).BindArticle.Add(z);
                    });
                }

                (Application.Current as App).BindDisease = new ObservableCollection <diseaseSec>();
                if (dis != null && dis.Data != null)
                {
                    dis.Data.ForEach(z =>
                    {
                        (Application.Current as App).BindDisease.Add(z);
                    });
                }

                (Application.Current as App).BindMedicine = new ObservableCollection <medicineSec>();
                if (med != null && med.Data != null)
                {
                    med.Data.ForEach(z =>
                    {
                        (Application.Current as App).BindMedicine.Add(z);
                    });
                }


                //(Application.Current as App).BindSearchEnd = new ObservableCollection<searchEnd>();
                //se.ToList().ForEach(z =>
                //{
                //    (Application.Current as App).BindSearchEnd.Add(z);
                //});
                loading.Visibility = Visibility.Collapsed;
            }
        }
Beispiel #3
0
        public HMDB_metabolite_single_file(XElement metaboliteElement)
        {
            Cts_cas   = new List <string>();
            Cts_kegg  = new List <string>();
            Cts_chebi = new List <string>();

            string tmp_string = "";

            foreach (XElement item in metaboliteElement.Elements())
            {
                switch (item.Name.LocalName)
                {
                case "accession":
                    tmp_string     = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Hmdb_accession = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "secondary_accessions":
                    Hmdb_secondary_accessions = new List <string>();
                    foreach (XElement secondary_accession in item.Elements().Where(x => x.Name.LocalName == "accession"))
                    {
                        if (string.IsNullOrEmpty(secondary_accession.Value) || string.IsNullOrWhiteSpace(secondary_accession.Value) || secondary_accession.Value == "\n")
                        {
                            continue;
                        }
                        else
                        {
                            Hmdb_secondary_accessions.Add(secondary_accession.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim());
                        }
                    }
                    break;

                case "name":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Name       = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "description":
                    tmp_string  = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Description = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "synonyms":
                    Synonym_names = new List <string>();
                    foreach (XElement synonym_content in item.Elements().Where(x => x.Name.LocalName == "synonym"))
                    {
                        if (string.IsNullOrEmpty(synonym_content.Value) || string.IsNullOrWhiteSpace(synonym_content.Value) || synonym_content.Value == "\n")
                        {
                            continue;
                        }
                        else
                        {
                            Synonym_names.Add(synonym_content.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim());
                        }
                    }
                    break;

                case "chemical_formula":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Formula    = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "average_molecular_weight":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Average_molecular_weight = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? -1 : Convert.ToDouble(tmp_string);
                    break;

                case "monisotopic_moleculate_weight":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Monisotopic_molecular_weight = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? -1 : Convert.ToDouble(tmp_string);
                    break;

                case "iupac_name":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Iupac_name = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "traditional_iupac":
                    tmp_string        = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Traditional_iupac = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "cas_registry_number":
                    tmp_string          = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Cas_registry_number = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "smiles":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Smiles     = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "inchi":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Inchi      = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "inchikey":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Inchikey   = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "taxonomy":
                    My_taxonomy = new taxonomy()
                    {
                        Description = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "description").Value) ||
                                       string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "description").Value) ||
                                       item.Elements().First(x => x.Name.LocalName == "description").Value == "\n") ?
                                      "" : item.Elements().First(x => x.Name.LocalName == "description").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Direct_parent = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "direct_parent").Value) ||
                                         string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "direct_parent").Value) ||
                                         item.Elements().First(x => x.Name.LocalName == "direct_parent").Value == "\n") ?
                                        "" : item.Elements().First(x => x.Name.LocalName == "direct_parent").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Kingdom = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "kingdom").Value) ||
                                   string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "kingdom").Value) ||
                                   item.Elements().First(x => x.Name.LocalName == "kingdom").Value == "\n") ?
                                  "" : item.Elements().First(x => x.Name.LocalName == "kingdom").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Super_class = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "super_class").Value) ||
                                       string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "super_class").Value) ||
                                       item.Elements().First(x => x.Name.LocalName == "super_class").Value == "\n") ?
                                      "" : item.Elements().First(x => x.Name.LocalName == "super_class").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Tclass = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "class").Value) ||
                                  string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "class").Value) ||
                                  item.Elements().First(x => x.Name.LocalName == "class").Value == "\n") ?
                                 "" : item.Elements().First(x => x.Name.LocalName == "class").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Molecular_framework = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "direct_parent").Value) ||
                                               string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "direct_parent").Value) ||
                                               item.Elements().First(x => x.Name.LocalName == "direct_parent").Value == "\n") ?
                                              "" : item.Elements().First(x => x.Name.LocalName == "direct_parent").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Alternative_parents = item.Elements().First(x => x.Name.LocalName == "alternative_parents").Elements().Where(x => x.Name.LocalName == "alternative_parent").
                                              Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList(),
                        Substituents = item.Elements().First(x => x.Name.LocalName == "substituents").Elements().Where(x => x.Name.LocalName == "substituent").
                                       Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList()
                    };
                    break;

                case "ontology":
                    My_onotology = new ontology()
                    {
                        Status = (string.IsNullOrEmpty(item.Elements().First(x => x.Name.LocalName == "status").Value) ||
                                  string.IsNullOrWhiteSpace(item.Elements().First(x => x.Name.LocalName == "status").Value) ||
                                  item.Elements().First(x => x.Name.LocalName == "status").Value == "\n") ?
                                 "" : item.Elements().First(x => x.Name.LocalName == "status").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                        Origins = item.Elements().First(x => x.Name.LocalName == "origins").Elements().Where(x => x.Name.LocalName == "origin").
                                  Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList(),
                        Biofunctions = item.Elements().First(x => x.Name.LocalName == "biofunctions").Elements().Where(x => x.Name.LocalName == "biofunction").
                                       Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList(),
                        Applications = item.Elements().First(x => x.Name.LocalName == "applications").Elements().Where(x => x.Name.LocalName == "application").
                                       Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList(),
                        Cellular_locations = item.Elements().First(x => x.Name.LocalName == "cellular_locations").Elements().Where(x => x.Name.LocalName == "cellular_location").
                                             Select(x => x.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()).ToList()
                    };
                    break;

                case "state":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    State      = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "biofluid_locations":
                    Biofluid_locations = new List <string>();
                    foreach (XElement biofluid in item.Elements().Where(x => x.Name.LocalName == "biofluid"))
                    {
                        if (string.IsNullOrEmpty(biofluid.Value) || string.IsNullOrWhiteSpace(biofluid.Value) || biofluid.Value == "\n")
                        {
                            continue;
                        }
                        else
                        {
                            Biofluid_locations.Add(biofluid.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim());
                        }
                    }
                    break;

                case "tissue_locations":
                    Tissue_locations = new List <string>();
                    foreach (XElement tissue in item.Elements().Where(x => x.Name.LocalName == "tissue"))
                    {
                        if (string.IsNullOrEmpty(tissue.Value) || string.IsNullOrWhiteSpace(tissue.Value) || tissue.Value == "\n")
                        {
                            continue;
                        }
                        else
                        {
                            Tissue_locations.Add(tissue.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim());
                        }
                    }
                    break;

                case "pathways":
                    List_of_pathways = new List <pathway>();
                    string  kegg_map_id = "", smpdb_id = "";
                    pathway ptwy;
                    foreach (XElement cpathway in item.Elements().Where(x => x.Name.LocalName == "pathway"))
                    {
                        kegg_map_id = (string.IsNullOrEmpty(cpathway.Elements().First(x => x.Name.LocalName == "kegg_map_id").Value) ||
                                       string.IsNullOrWhiteSpace(cpathway.Elements().First(x => x.Name.LocalName == "kegg_map_id").Value) ||
                                       cpathway.Elements().First(x => x.Name.LocalName == "kegg_map_id").Value == "\n") ?
                                      "" : cpathway.Elements().First(x => x.Name.LocalName == "kegg_map_id").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                        smpdb_id = (string.IsNullOrEmpty(cpathway.Elements().First(x => x.Name.LocalName == "smpdb_id").Value) ||
                                    string.IsNullOrWhiteSpace(cpathway.Elements().First(x => x.Name.LocalName == "smpdb_id").Value) ||
                                    cpathway.Elements().First(x => x.Name.LocalName == "smpdb_id").Value == "\n") ?
                                   "" : cpathway.Elements().First(x => x.Name.LocalName == "smpdb_id").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();

                        ptwy = new pathway()
                        {
                            Kegg_map_id  = kegg_map_id,
                            Smpdb_map_id = smpdb_id
                        };
                        ptwy.get_details();
                        List_of_pathways.Add(ptwy);
                    }
                    foreach (SMPDB_pathway smpdb_ptwy in SMPDB_pathways.list_of_smpdb_pathways.Where(x => x.Hmdb_id == Hmdb_accession))
                    {
                        if (!List_of_pathways.Any(x => x.Smpdb_map_id == smpdb_ptwy.Id))
                        {
                            ptwy = new pathway()
                            {
                                Kegg_map_id  = "",
                                Smpdb_map_id = smpdb_ptwy.Id
                            };
                            ptwy.get_details();
                            List_of_pathways.Add(ptwy);
                        }
                    }
                    break;

                case "drugbank_id":
                    tmp_string  = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Drugbank_id = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "drugbank_metabolite_id":
                    tmp_string             = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Drugbank_metabolite_id = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "chemspider_id":
                    tmp_string    = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Chemspider_id = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "kegg_id":
                    Dict_kegg_details = new Dictionary <string, KEGG_entry_details>();
                    tmp_string        = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Kegg_id           = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    addKeggDetails((string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string);
                    break;

                case "metlin_id":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Metlin_id  = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "pubchem_compound_id":
                    tmp_string          = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Pubchem_compound_id = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "chebi_id":
                    tmp_string = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Chebi_id   = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "synthesis_reference":
                    tmp_string          = item.Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim();
                    Synthesis_reference = (string.IsNullOrEmpty(tmp_string) || string.IsNullOrWhiteSpace(tmp_string) || tmp_string == "\n") ? "" : tmp_string;
                    break;

                case "protein_associations":
                    List_of_proteins = new List <protein>();
                    foreach (XElement protein in item.Elements().Where(x => x.Name.LocalName == "protein"))
                    {
                        List_of_proteins.Add(new protein()
                        {
                            Protein_accession = (string.IsNullOrEmpty(protein.Elements().First(x => x.Name.LocalName == "protein_accession").Value) ||
                                                 string.IsNullOrWhiteSpace(protein.Elements().First(x => x.Name.LocalName == "protein_accession").Value) ||
                                                 protein.Elements().First(x => x.Name.LocalName == "protein_accession").Value == "\n") ?
                                                "" : protein.Elements().First(x => x.Name.LocalName == "protein_accession").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            Name = (string.IsNullOrEmpty(protein.Elements().First(x => x.Name.LocalName == "name").Value) ||
                                    string.IsNullOrWhiteSpace(protein.Elements().First(x => x.Name.LocalName == "name").Value) ||
                                    protein.Elements().First(x => x.Name.LocalName == "name").Value == "\n") ?
                                   "" : protein.Elements().First(x => x.Name.LocalName == "name").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            Uniprot_id = (string.IsNullOrEmpty(protein.Elements().First(x => x.Name.LocalName == "uniprot_id").Value) ||
                                          string.IsNullOrWhiteSpace(protein.Elements().First(x => x.Name.LocalName == "uniprot_id").Value) ||
                                          protein.Elements().First(x => x.Name.LocalName == "uniprot_id").Value == "\n") ?
                                         "" : protein.Elements().First(x => x.Name.LocalName == "uniprot_id").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            Gene_name = (string.IsNullOrEmpty(protein.Elements().First(x => x.Name.LocalName == "gene_name").Value) ||
                                         string.IsNullOrWhiteSpace(protein.Elements().First(x => x.Name.LocalName == "gene_name").Value) ||
                                         protein.Elements().First(x => x.Name.LocalName == "gene_name").Value == "\n") ?
                                        "" : protein.Elements().First(x => x.Name.LocalName == "gene_name").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            Protein_type = (string.IsNullOrEmpty(protein.Elements().First(x => x.Name.LocalName == "protein_type").Value) ||
                                            string.IsNullOrWhiteSpace(protein.Elements().First(x => x.Name.LocalName == "protein_type").Value) ||
                                            protein.Elements().First(x => x.Name.LocalName == "protein_type").Value == "\n") ?
                                           "" : protein.Elements().First(x => x.Name.LocalName == "protein_type").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim()
                        });
                    }
                    break;

                case "diseases":
                    List_of_diseases = new List <disease>();
                    disease ds;
                    foreach (XElement cdisease in item.Elements().Where(x => x.Name.LocalName == "disease"))
                    {
                        ds = new disease()
                        {
                            Name = (string.IsNullOrEmpty(cdisease.Elements().First(x => x.Name.LocalName == "name").Value) ||
                                    string.IsNullOrWhiteSpace(cdisease.Elements().First(x => x.Name.LocalName == "name").Value) ||
                                    cdisease.Elements().First(x => x.Name.LocalName == "name").Value == "\n") ?
                                   "" : cdisease.Elements().First(x => x.Name.LocalName == "name").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            Omim_id = (string.IsNullOrEmpty(cdisease.Elements().First(x => x.Name.LocalName == "omim_id").Value) ||
                                       string.IsNullOrWhiteSpace(cdisease.Elements().First(x => x.Name.LocalName == "omim_id").Value) ||
                                       cdisease.Elements().First(x => x.Name.LocalName == "omim_id").Value == "\n") ?
                                      "" : cdisease.Elements().First(x => x.Name.LocalName == "omim_id").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim(),
                            List_of_pubmed_ids = new List <string>()
                        };
                        foreach (XElement references in cdisease.Elements().Where(x => x.Name.LocalName == "references"))
                        {
                            foreach (XElement reference in references.Elements().Where(x => x.Name.LocalName == "reference"))
                            {
                                if (reference.Elements().Any(x => x.Name.LocalName == "pubmed_id") &&
                                    !string.IsNullOrEmpty(reference.Elements().First(x => x.Name.LocalName == "pubmed_id").Value) &&
                                    !string.IsNullOrWhiteSpace(reference.Elements().First(x => x.Name.LocalName == "pubmed_id").Value) &&
                                    reference.Elements().First(x => x.Name.LocalName == "pubmed_id").Value != "\n")
                                {
                                    ds.List_of_pubmed_ids.Add(reference.Elements().First(x => x.Name.LocalName == "pubmed_id").Value.Replace("\r", "").Replace("\n", "").Replace("\t", "").Trim());
                                }
                            }
                        }
                        List_of_diseases.Add(ds);
                    }
                    break;

                default:
                    break;
                }
            }
        }