Esempio n. 1
0
        private static (string formattedVrfs, string alleleDepths) MergeAndSortByVrf(AlleleStats alleleStats)
        {
            var vrfToAd = new Dictionary <string, int>();

            foreach ((string vrf, int ad) in alleleStats.vrf.Select(x => x.ToString("0.###"))
                     .Zip(alleleStats.ad, (a, b) => (a, b)))
            {
                if (vrfToAd.ContainsKey(vrf))
                {
                    vrfToAd[vrf] += ad;
                }
                else
                {
                    vrfToAd[vrf] = ad;
                }
            }

            var formattedVrfs = new string[vrfToAd.Count];
            var alleleDepths  = new int[vrfToAd.Count];
            var i             = 0;

            foreach (var vrf in vrfToAd.Keys.OrderBy(x => double.Parse(x)))
            {
                formattedVrfs[i] = vrf;
                alleleDepths[i]  = vrfToAd[vrf];
                i++;
            }

            return(string.Join(',', formattedVrfs), string.Join(',', alleleDepths));
        }
Esempio n. 2
0
 public MitoHeteroplasmyItem(IChromosome chromosome, int position, string refAllele, string altAllele, AlleleStats stats)
 {
     Chromosome = chromosome;
     Position   = position;
     RefAllele  = refAllele;
     AltAllele  = altAllele;
     _stats     = stats;
 }