Example #1
0
 def __init__(self, pheno_seq, haps, loci):
   phenotype.phenotype_count += 1
   print 'creating phenotype %d ...' % phenotype.phenotype_count
 
   self.count = 1
   self.loci = loci
   self.g_size = self.loci[0].g_size
   self.haps = haps
   self.name = phenotype.create_name(pheno_seq, loci)
   self.hap_sets = {}      # (hap_seq1, hap_seq2 ... hap_seqg_size) : weight
   
   hap_seq_sets = []
   self.generate_hap_seq_sets(pheno_seq, hap_seq_sets)
   
   # - Add any new haplotypes to the master haplotype dictionary.
   #
   for set in hap_seq_sets:
     for hap_seq in set:
       if not hap_seq in self.haps.haps:
         self.haps[hap_seq] = haplotype(hap_seq, self.loci)
       
     self.hap_sets[tuple(set)] = None        
       
   self.ambiguous = len(self.hap_sets) > 1
   self.init_weights()
Example #2
0
    def __init__(self, pheno_seq, haps, loci):
        phenotype.phenotype_count += 1
        print 'creating phenotype %d ...' % phenotype.phenotype_count
        self.count = 1
        self.loci = loci
        self.g_size = self.loci[0].g_size
        self.haps = haps
        self.name = phenotype.create_name(pheno_seq, loci)
        self.hap_sets = {}  # (hap_seq1, hap_seq2 ... hap_seqg_size) : weight
        self.hap_set_counts = {
        }  # (hap_seq1, hap_seq2 ... hap_seqg_size) : dictionary of haplotype counts

        hap_seq_sets = []  # keys to hap_sets
        self.generate_hap_seq_sets(pheno_seq, hap_seq_sets)

        # - Add any new haplotypes to the master haplotype dictionary.
        #
        for set in hap_seq_sets:
            for hap_seq in set:
                if not hap_seq in self.haps.haps:
                    self.haps[hap_seq] = haplotype(hap_seq, self.loci)

            self.hap_sets[tuple(set)] = None

        self.ambiguous = len(self.hap_sets) > 1
        self.init_weights()

        for set in self.hap_sets.keys():
            self.hap_set_counts[set] = phenotype.copy_counts(set)
Example #3
0
 def __init__(self, pheno_seq, haps, loci):
   self.count = 1
   self.hap_pairs = {}
   
   hap_seq_pairs = []
   self.generate_hap_seq_pairs(pheno_seq, hap_seq_pairs, loci)
   
   # - Add any new haplotypes to set of haplotypes.
   #
   for pair in hap_seq_pairs:
     first = tuple(pair[0])
     if not haps.has_key(first):
       haps[first] = haplotype(first, loci)
     second = tuple(pair[1])
     if not haps.has_key(second):
       haps[second] = haplotype(second, loci)
       
     self.hap_pairs[(first, second)] = None        
       
   self.ambiguous = len(self.hap_pairs) > 1
   self.init_weights()