self.model.late( time=None, scripts=substitution_script, comment="fixes mutations in haploid gen" ) if __name__ == "__main__": import shadie with shadie.Model() as mod: # define mutation types m0 = shadie.mtype(0.5, 'n', 0, 0.4) m1 = shadie.mtype(0.5, 'g', 0.8, 0.75) #I suggest we add a checkpoint that calculates the average #fitness of mutations input by the user. If fitness is too high #the simuulation will lag tremendously. # OK: a good use case for logger.warning('fitness is too high...') # define elements types e0 = shadie.etype([m0, m1], [1, 2]) e1 = shadie.etype([m1], [1]) # design chromosome of elements chrom = shadie.chromosome.random( genome_size=20000, noncds=e0, intron=e0,
'gam_pop_size': "NA", 'spo_mutation_rate': self.model.metadata['mutation_rate'], 'recombination_rate': self.model.metadata['recomb_rate'] } self.model.map["initialize"][0]['constants']["K"] = self.pop_size self.model.map["initialize"][0]['simglobals'][ "METADATA"] = metadata_dict if __name__ == "__main__": import shadie # define mutation types m0 = shadie.mtype(0.5, 'n', 0, 0.4) m1 = shadie.mtype(0.5, 'g', 0.8, 0.75, diffexpr="diploid") # define elements types e0 = shadie.etype([m0, m1], [1, 2]) e1 = shadie.etype([m1], [1]) # design chromosome of elements chrom = shadie.chromosome.random( genome_size=20000, noncds=e0, intron=e0, exon=e1, ) print(m1._expr)
self.data.loc[start] = ( data[key].altname, start, end, data[key].name, data[key], data[key].coding, ) if __name__ == "__main__": import shadie # define mutation types m0 = shadie.mtype(0.5, 'n', 2.0, 1.0) m1 = shadie.mtype(0.5, 'g', 3.0, 1.0) m2 = shadie.mtype(0.5, 'f', 0) # define elements types e0 = shadie.etype([m0, m1], [1, 2]) e1 = shadie.etype([m2], [1]) # # print(e0.mlist) # chrom = shadie.chromosome.random(100000) # #print(chrom.data.iloc[:50, :4]) # #chrom.review("chromosome") # default = shadie.chromosome.default() # print(default.data)
Returns a toyplot histogram of the selection coefficients. """ canvas, axes, marks = self[0].draw(show_mean=False, **kwargs) for mut in self[1:]: marks.append(mut._draw_hists(axes=axes)) return canvas, axes, marks if __name__ == "__main__": # generate random chromosome import shadie mlist = shadie.mlist( #shadie.mtype(0.5, 'f', 0.0), shadie.mtype(0.5, 'f', 0.1), shadie.mtype(0.5, 'n', 0.5, 0.25), shadie.mtype(0.5, 'g', 2.0, 0.1), shadie.mtype(0.1, 'e', 2.5, diffexpr="diploid"), ) for muta in mlist: muta.summary() #m2 = shadie.mtype(0.5, 'f', 0) print(mlist) test = [] expr = [] for mut in mlist: test.append(mut.name) expr.append(mut._expr) print(test)
"min value in the 99% CI of all MutationType distributions" return min([i.mlist.min for i in self]) @property def max(self): "max value in the 99% CI of all MutationType distributions" return max([i.mlist.max for i in self]) if __name__ == "__main__": import shadie # create mutationlist mlist = shadie.mlist( shadie.mtype(0.5, 'f', 0.1), shadie.mtype(0.5, 'n', 0.05, 0.02), ) # create elements (a mutation list with frequencies) ele1 = ElementType( mlist, (1, 1), ) ele2 = ElementType(mlist, (0.5, 1)) print(ele1.mlist) print(ele2) print(ele2.to_slim()) print(ele2.coding) for mut in ele1.mlist: