Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }