Example #1
0
        public void EqualityAndHash()
        {
            var clinGenItem = new ClinGenItem("CGEN101", "chr1", 100, 1000, VariantType.copy_number_gain, 100, 0, ClinicalInterpretation.likely_pathogenic, true, new HashSet <string> {
                "phenotype1"
            }, new HashSet <string> {
                "phenoId1"
            });

            var clingenHash = new HashSet <ClinGenItem> {
                clinGenItem
            };

            Assert.Equal(1, clingenHash.Count);
            Assert.True(clingenHash.Contains(clinGenItem));
        }
Example #2
0
        public IEnumerable <ClinGenItem> GetItems()
        {
            using (var reader = _reader)
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (IsClinGenHeader(line))
                    {
                        continue;
                    }

                    var    cols      = line.OptimizedSplit('\t');
                    string id        = cols[0];
                    string ucscChrom = cols[1];
                    if (!_refNameDict.ContainsKey(ucscChrom))
                    {
                        continue;
                    }

                    var  chrom              = _refNameDict[ucscChrom];
                    int  start              = int.Parse(cols[2]);
                    int  end                = int.Parse(cols[3]);
                    int  observedGains      = int.Parse(cols[4]);
                    int  observedLosses     = int.Parse(cols[5]);
                    var  variantType        = GetVariantType(cols[6]);
                    var  clinInterpretation = GetClinInterpretation(cols[7]);
                    bool validated          = cols[8].Equals("True");
                    var  phenotypes         = cols[9] == "" ? null : new HashSet <string>(cols[9].OptimizedSplit(','));
                    var  phenotypeIds       = cols[10] == "" ? null : new HashSet <string>(cols[10].OptimizedSplit(','));

                    var currentItem = new ClinGenItem(id, chrom, start, end, variantType, observedGains, observedLosses,
                                                      clinInterpretation, validated, phenotypes, phenotypeIds);
                    yield return(currentItem);
                }
            }
        }