Esempio n. 1
0
        private static UgaGene[] UpdateGeneSymbols(this UgaGene[] genes, Dictionary <int, string> hgncIdToSymbol, Dictionary <string, string> entrezGeneIdToSymbol,
                                                   Dictionary <string, string> ensemblIdToSymbol, Dictionary <string, string> refseqGeneIdToSymbol)
        {
            var updater = new GeneSymbolUpdater(hgncIdToSymbol, entrezGeneIdToSymbol, ensemblIdToSymbol, refseqGeneIdToSymbol);

            updater.Update(genes);
            return(genes);
        }
Esempio n. 2
0
        /// <summary>
        /// constructor
        /// </summary>
        public GeneCombiner(string inputGenesPath, string inputGenes2Path, List <string> geneInfoPaths, string hgncPath,
                            string refSeqGff3Path)
        {
            _geneInfoSource = ParseGeneInfoFiles(geneInfoPaths);

            var entrezGeneIdToEnsemblId = new Dictionary <string, UniqueString>();
            var ensemblIdToEntrezGeneId = new Dictionary <string, UniqueString>();

            _hgncSource = ParseHgncFile(hgncPath, entrezGeneIdToEnsemblId, ensemblIdToEntrezGeneId);

            Console.WriteLine();
            Console.WriteLine("- linking Ensembl and Entrez gene IDs: ");

            var linkedEnsemblIds = LinkIds(entrezGeneIdToEnsemblId, ensemblIdToEntrezGeneId);

            Console.WriteLine();
            Console.WriteLine("- loading RefSeq GFF3: ");

            _refSeqGff3GeneInfo = GetRefSeqGff3GeneInfo(refSeqGff3Path);

            Console.WriteLine();
            Console.WriteLine("- loading genes: ");

            string descriptionA = Path.GetFileName(inputGenesPath);
            string descriptionB = Path.GetFileName(inputGenes2Path);

            var genesA = LoadGenes(inputGenesPath, descriptionA);
            var genesB = LoadGenes(inputGenes2Path, descriptionB);

            Console.WriteLine();
            Console.WriteLine("- update gene symbols: ");

            var updaterA = new GeneSymbolUpdater(genesA, descriptionA, _geneInfoSource, _hgncSource);

            updaterA.Update();

            var updaterB = new GeneSymbolUpdater(genesB, descriptionB, _geneInfoSource, _hgncSource);

            updaterB.Update();

            Console.WriteLine();
            Console.WriteLine("- flattening genes: ");

            var flattenerA = new GeneFlattener(genesA, descriptionA);
            var flatGenesA = flattenerA.Flatten();

            var flattenerB = new GeneFlattener(genesB, descriptionB);
            var flatGenesB = flattenerB.Flatten();

            Console.WriteLine();
            Console.WriteLine("- merging Ensembl and RefSeq:");

            var merger = new GeneMerger(flatGenesA, flatGenesB, linkedEnsemblIds);

            _mergedGenes = merger.Merge();

            Console.WriteLine();
            Console.WriteLine("- update HGNC ids:");

            UpdateHgncIds(_mergedGenes);
        }