Example #1
0
        static void Main(string[] args)
        {
            ISample simpleSample = new SimpleSample();

            simpleSample.Execute();

            Console.Read();
        }
Example #2
0
        /// <summary>
        /// Call SNPs from the sorted list of sequences using the pile-up method.
        /// </summary>
        /// <returns>The SN ps.</returns>
        /// <param name="sequences">Sequences.</param>
        public static SNPCallerReport CallSNPs(IEnumerable <CompactSAMSequence> sequences)
        {
            // Get a pile up and convert it to genotypes
            var pileups   = PileUpProducer.CreatePileupFromReads(sequences);
            var genotypes = ContinuousGenotypeCaller.CallContinuousGenotypes(pileups).ToList();

            // Filter down to a usable set
            var usable = genotypes.Where(x => x.ResultType == GenotypeCallResult.GenotypeCalled && x.OriginalPosition.HasValue).ToList();

            if (usable.Count == 0)
            {
                return(new SNPCallerReport(AlgorithmResult.Failed));
            }

            // Get median coverage at sites
            var data_counts = usable.Select(x => x.TotalObservedBases).ToList();

            data_counts.Sort();
            var median = data_counts[data_counts.Count / 2];

            //now create a cut-off for required coverage as the square root of the median.
            var cut_off = Math.Sqrt(median);

            //Get a list of genotypes, and if a simple SNP, make a polymorphism if it doesn't match
            //the reference
            var genotypedPositions    = new HashSet <int> ();
            List <Polymorphism> polys = new List <Polymorphism> ();

            foreach (var geno in usable)
            {
                if (geno.TotalObservedBases >= cut_off)
                {
                    genotypedPositions.Add(geno.OriginalPosition.Value);
                    var org_bp = ReferenceGenome.GetReferenceBaseAt_rCRSPosition(geno.OriginalPosition.Value);
                    var cur_bp = geno.GetMostFrequentGenotype();
                    if (org_bp != cur_bp[0])
                    {
                        var poly = new Polymorphism(geno.OriginalPosition.Value, MutationAssigner.getBase(cur_bp));
                        polys.Add(poly);
                    }
                }
            }
            //Now assign haplotype
            HaplotypeSearcher  hts = new HaplotypeSearcher();
            PolymorphismFilter pf  = new PolymorphismFilter(p => p.IsSNP && genotypedPositions.Contains(p.Position));
            var simpSample         = new SimpleSample("Pileup", polys, pf);
            var hap_report         = hts.GetHaplotypeReport(simpSample);

            return(new SNPCallerReport(genotypes, hap_report));
        }
Example #3
0
        static void Main(string[] args)
        {
            // Define the default EduHub Directory if non-standard environment (ie. testing)
            // EduHubContext.DefaultEduHubDirectory = @"E:\eduHub";

            // Simple Sample
            SimpleSample.Run();

            // Navigation Sample
            NavigationSample.Run();

            // Complex Sample (May only run successfully when AKC and AR datasets are manually added to Service C)
            ComplexSample.Run();

            // Write-Back Sample
            // WriteBackSample.Run();
        }
Example #4
0
        public void Setup()
        {
            service = new FormatKeyValuePairsService();

            sample = new SimpleSample()
            {
                Name = "SAMPLE1", Amount = 1
            };
            hasSample = new HasSimpleSample()
            {
                Name = "HAS1", SS = sample
            };
            hasHasSample = new HasHasSimpleSample()
            {
                Name = "HASHAS1", HSS = hasSample
            };
        }