Beispiel #1
0
 /// <summary>
 /// Return a VCF-like string representation for the alleles of this genotype.
 ///
 /// If ignoreRefState is true, will not append the reference * marker on the alleles.
 /// </summary>
 /// <returns> a string representing the genotypes, or null if the type is unavailable. </returns>
 public virtual string getGenotypeString(bool ignoreRefState)
 {
     if (Ploidy == 0)
     {
         return("NA");
     }
     // Notes:
     // 1. Make sure to use the appropriate separator depending on whether the genotype is phased
     // 2. If ignoreRefState is true, then we want just the bases of the Alleles (ignoring the '*' indicating a ref Allele)
     // 3. So that everything is deterministic with regards to integration tests, we sort Alleles (when the genotype isn't phased, of course)
     return(String.Join(Phased ? PHASED_ALLELE_SEPARATOR : UNPHASED_ALLELE_SEPARATOR, ignoreRefState ? AlleleStrings :
                        (Phased ? Alleles.Select(x => x.ToString()) : ParsingUtils.SortList(Alleles).Select(x => x.ToString()))));
 }
Beispiel #2
0
 /// <summary>
 /// Returns how many times allele appears in this genotype object?
 /// </summary>
 /// <param name="allele"> </param>
 /// <returns> a value >= 0 indicating how many times the allele occurred in this sample's genotype </returns>
 public virtual int CountAlleles(Allele allele)
 {
     return(Alleles.Count(x => x.Equals(allele)));
 }
Beispiel #3
0
 private void AddGenes(IEnumerable <bool> genes)
 {
     Alleles.AddRange(genes);
 }
Beispiel #4
0
 public void AddGene(bool gene)
 {
     Alleles.Add(gene);
 }