Exemplo n.º 1
0
        private void AddGene(string[] cols, ICollection <EnsemblGene> genes)
        {
            var chromosome = RefSeqGffReader.GetChromosome(cols[ChromosomeIndex], _refNameToChromosome);

            if (chromosome == null)
            {
                return;
            }

            try
            {
                int start    = int.Parse(cols[StartIndex]);
                int end      = int.Parse(cols[EndIndex]);
                var infoCols = cols[InfoIndex].Split(';', StringSplitOptions.RemoveEmptyEntries);
                var info     = GetGffFields(infoCols);

                var gene = new EnsemblGene(chromosome, start, end, info.EnsemblGeneId, info.Name);
                genes.Add(gene);
            }
            catch (Exception)
            {
                Console.WriteLine();
                Console.WriteLine("Offending line: {0}", string.Join('\t', cols));
                for (var i = 0; i < cols.Length; i++)
                {
                    Console.WriteLine("- col {0}: [{1}]", i, cols[i]);
                }
                throw;
            }
        }
Exemplo n.º 2
0
        private static void AddCoordinatesFromMultipleGenes(HgncGene hgncGene, EnsemblGene ensemblGene, IEnumerable <RefSeqGene> refSeqGenes)
        {
            if (ensemblGene == null)
            {
                return;
            }

            AddCoordinatesFromGene(hgncGene, ensemblGene);

            foreach (var refSeqGene in refSeqGenes)
            {
                if (!IntervalUtilities.Overlaps(hgncGene.Start, hgncGene.End, refSeqGene.Start, refSeqGene.End))
                {
                    continue;
                }
                AddCoordinatesFromGene(hgncGene, refSeqGene);
            }
        }