示例#1
0
文件: Module1.cs 项目: Mimi-Mika/DNA
        public override async Task <Object> Process(String content)
        {
            //TODO Parse string content to chunks object
            List <Chunck> chuncks = ParseRawDatas(content);


            int resPaire = await totalPaire(chuncks);

            CountBases resOccur = await totalOccurence(chuncks);

            return(resOccur);
        }
示例#2
0
文件: Module1.cs 项目: Mimi-Mika/DNA
        public async Task <CountBases> totalOccurence(List <Chunck> chuncks)
        {
            CountBases countBases = new CountBases();

            Console.WriteLine("Je suis module 1 : totalOccurence");
            Parallel.ForEach(chuncks, (chunck) =>
            {
                if (chunck.genotype.Length > 0)
                {
                    switch (chunck.genotype[0])
                    {
                    case 'A':
                        lock (countBases)
                        {
                            countBases.basesA++;
                        }
                        break;

                    case 'T':
                        lock (countBases)
                        {
                            countBases.basesT++;
                        }
                        break;

                    case 'G':
                        lock (countBases)
                        {
                            countBases.basesG++;
                        }
                        break;

                    case 'C':
                        lock (countBases)
                        {
                            countBases.basesC++;
                        }
                        break;

                    default:
                        lock (countBases)
                        {
                            countBases.basesUndefine++;
                        }
                        break;
                    }
                }
                if (chunck.genotype.Length > 1)
                {
                    switch (chunck.genotype[1])
                    {
                    case 'A':
                        lock (countBases)
                        {
                            countBases.basesA++;
                        }
                        break;

                    case 'T':
                        lock (countBases)
                        {
                            countBases.basesT++;
                        }
                        break;

                    case 'G':
                        lock (countBases)
                        {
                            countBases.basesG++;
                        }
                        break;

                    case 'C':
                        lock (countBases)
                        {
                            countBases.basesC++;
                        }
                        break;

                    default:
                        lock (countBases)
                        {
                            countBases.basesUndefine++;
                        }
                        break;
                    }
                }
            });
            return(countBases);
        }