Ejemplo n.º 1
0
        /// <summary>
        /// calculates the hash code for this object
        /// </summary>
        // ReSharper disable once FunctionComplexityOverflow
        private int CalculateHashCode()
        {
            var hashCode = Start.GetHashCode();

            if (Chromosome != null)
            {
                hashCode ^= Chromosome.GetHashCode();
            }
            if (ID != null)
            {
                hashCode ^= ID.GetHashCode();
            }
            if (AlleleOrigins != null)
            {
                hashCode ^= AlleleOrigins.GetHashCode();
            }
            if (AltAllele != null)
            {
                hashCode ^= AltAllele.GetHashCode();
            }
            if (MedGenIDs != null)
            {
                hashCode ^= MedGenIDs.GetHashCode();
            }
            if (OmimIDs != null)
            {
                hashCode ^= OmimIDs.GetHashCode();
            }
            if (OrphanetIDs != null)
            {
                hashCode ^= OrphanetIDs.GetHashCode();
            }
            if (Phenotypes != null)
            {
                hashCode ^= Phenotypes.GetHashCode();
            }
            if (ReferenceAllele != null)
            {
                hashCode ^= ReferenceAllele.GetHashCode();
            }
            if (Significance != null)
            {
                hashCode ^= Significance.GetHashCode();
            }
            return(hashCode);
        }
Ejemplo n.º 2
0
        private List <string[]> GetValues()
        {
            var values = new List <string[]>
            {
                //the exact order of adding values has to be preserved. the order is dictated by the json schema
                new[] { Id },
                new[] { VariationId },
                new[] { ClinVarCommon.ReviewStatusStrings[ReviewStatus] },
                AlleleOrigins?.ToArray(),
                new[] { ClinVarCommon.NormalizeAllele(RefAllele) },
                new[] { ClinVarCommon.NormalizeAllele(AltAllele) },
                Phenotypes?.ToArray(),
                MedGenIds?.ToArray(),
                OmimIds?.ToArray(),
                OrphanetIds?.ToArray(),
                Significances,
                new[] { new DateTime(LastUpdatedDate).ToString("yyyy-MM-dd") },
                PubmedIds?.OrderBy(x => x).Select(x => x.ToString()).ToArray()
            };

            return(values);
        }
Ejemplo n.º 3
0
        public Boolean cargarArchivo()
        {
            logger.EscribirLog("Cargamos los Fenotipos de PharmaGKB", Logger.Tipo.Informativo, false);
            logger.EscribirLog("Chequeamos si existe el Archivo " + filePath, Logger.Tipo.Informativo, false);
            if (!File.Exists(filePath))
            {
                logger.EscribirLog("No existe el Archivo " + filePath, Logger.Tipo.Informativo, false);
                return(false);
            }
            foreach (string Phenotypes in File.ReadAllLines(filePath))
            {
                string[] varsa = Phenotypes.Split('\t');

                if (varsa[0] != "PharmGKB Accession Id")
                {
                    Phenotype phenotype = new Phenotype();
                    phenotype.PharmGKBAccessionId = varsa[0];
                    phenotype.Name = varsa[1];
                    string[] AlternateNames = varsa[2].Split(',');
                    foreach (String s in AlternateNames)
                    {
                        if (s.Contains("\""))
                        {
                            phenotype.AlternateNames.Add(s.Split('"')[1]);
                        }
                        else
                        {
                            phenotype.AlternateNames.Add(s);
                        }
                    }
                    string[] CrossReferences = varsa[3].Split(',');
                    foreach (String s in CrossReferences)
                    {
                        if (s.Contains("\""))
                        {
                            phenotype.CrossReferences.Add(s.Split('"')[1]);
                        }
                        else
                        {
                            phenotype.CrossReferences.Add(s);
                        }
                    }
                    string[] ExtenralVocabulary = varsa[4].Split(',');
                    foreach (String s in ExtenralVocabulary)
                    {
                        if (s.Contains("\""))
                        {
                            phenotype.ExtenralVocabulary.Add(s.Split('"')[1]);
                        }
                        else
                        {
                            phenotype.ExtenralVocabulary.Add(s);
                        }
                    }

                    LPhenotypes.Add(phenotype);
                }
            }
            logger.EscribirLog("Cargamos " + LPhenotypes.Count + " Fenotipos", Logger.Tipo.Informativo, true);
            return(true);
        }