private void UpdateGeneSymbol(SpliceAiItem item) { if (_geneTree == null || _geneSynonyms == null) { return; } var chromosome = item.Chromosome; var position = item.Position; if (_currentPositionGeneSymbols.Count > 1) { return; //for multiple genes for a position, we cannot update the symbol } var nirvanaGenes = _geneTree.GetAllOverlappingValues(chromosome.Index, position, position); if (nirvanaGenes == null) { item.Hgnc = null; return; } var uniqueOverlapping = new HashSet <string>(nirvanaGenes); if (uniqueOverlapping.Contains(item.Hgnc)) { return; } //gene not found in cache if (uniqueOverlapping.Count == 1) { item.Hgnc = uniqueOverlapping.First(); //update gene symbol } else { if (!_geneSynonyms.TryGetValue(item.Hgnc, out var symbolsList)) { return; } var commonSymbols = symbolsList.Intersect(uniqueOverlapping).ToArray(); if (commonSymbols.Length == 1) { item.Hgnc = commonSymbols[0]; } else { _unresolvedSymbols.Add(item.Hgnc); } } }
public void GetAllOverlappingValues(ushort refIndex, int begin, int end, string[] expectedValues) { var observedValues = _intervalForest.GetAllOverlappingValues(refIndex, begin, end); Assert.Equal(expectedValues, observedValues); }