def build_transcriptome(transcriptome_size, gene_library): print "building transcriptome..." #print len(gene_library) transcribed_genes = [random.choice(gene_library.items()) for n in range(transcriptome_size)] transcribed_genes = [(name, sequence.lower().replace('t', 'u')) for name, sequence in transcribed_genes] mRNAs = [MRNA_specific.mRNA_spec(index=n, sequence=transcribed_genes[n][1], geneID=transcribed_genes[n][0]) for n in range(transcriptome_size)] pickle.dump(mRNAs, open(os.path.join("mRNA_"+str(transcriptome_size)+".pkl"), "wb")) return mRNAs
def build_transcriptome(transcriptome_size, gene_library): print "building transcriptome..." #print len(gene_library) transcribed_genes = [ random.choice(gene_library.items()) for n in range(transcriptome_size) ] transcribed_genes = [(name, sequence.lower().replace('t', 'u')) for name, sequence in transcribed_genes] mRNAs = [ MRNA_specific.mRNA_spec(index=n, sequence=transcribed_genes[n][1], geneID=transcribed_genes[n][0]) for n in range(transcriptome_size) ] pickle.dump( mRNAs, open(os.path.join("mRNA_" + str(transcriptome_size) + ".pkl"), "wb")) return mRNAs
peptide_bonds, proteins = [], [] for duration in durations: print "#############################################################################################################" print "duration =", duration print "#############################################################################################################" for k, alpha in enumerate(alphas): print "#############################################################################################################" print "alpha =", alpha print "#############################################################################################################" # 1 mRNA mRNAs = [ MRNA_specific.mRNA_spec(index=0, sequence=examplesequence, geneID=1) ] gene_library = {1: examplesequence} tr = TRSL_specific.TRSL_spec(mRNAs, gene_library) tr.tRNA = col.Counter({ i: int(TRSL_specific.tRNA_types[i]['abundancy'] * attenuation_factors[i][k]) for i in TRSL_specific.tRNA_types }) #tr.tRNA = col.Counter({i:TRSL_specific.tRNA_types[i]['abundancy'] for i in TRSL_specific.tRNA_types}) #tr.tRNA[13] = 0 # we modify a relevant tRNA tr.tRNA_free = col.Counter({ i: int(TRSL_specific.tRNA_types[i]['abundancy'] * attenuation_factors[i][k])
'exome': pkl.load(open("../parameters/orf_coding.p", "rb")), 'transcriptome': pkl.load(open("../parameters/transcriptome_plotkin.p", "rb")), 'init_rates': pkl.load(open("../parameters/init_rates_plotkin.p", "rb")), 'decay_constants': pkl.load(open("../parameters/decay_constants.p", "rb")), 'description': 'full transcriptome and exome, with decay, specific best estimate initiation rates according to Plotkin' } genes = list(set(conf['exome']) & set(conf['transcriptome']) & set(conf['init_rates']) & set(conf['decay_constants'])) print "found %s genes in common." % len(genes) mRNAs = [] counter = 0 for gene in genes: # print "abundancies and initiation rates available for gene:", gene for instance in range(conf['transcriptome'][gene]): mRNAs.append(MRNA_specific.mRNA_spec(index=counter, sequence=conf['exome'][gene], geneID=gene, ribosomes={}, init_rate=conf['init_rates'][gene])) # do not just multiply the list counter += 1 print "built gene library, next: run TRSL_spec." description = conf['description'] print description duration = 20.0 tr = TRSL_spec(mRNAs, conf['exome'], conf['decay_constants'], nribo=20000) tr._tRNA = col.Counter({i: tRNA_types[i]['abundancy'] for i in tRNA_types}) tr._tRNA_free = col.Counter({i: int(tr._tRNA[i]) for i in tRNA_types}) # tRNA not bound to ribosomes tr._tRNA_bound = tr._tRNA - tr._tRNA_free # tRNA bound to ribosomes tr.solve_internal(0.0, duration, deltat=1.0)
genes = list( set(conf['exome']) & set(conf['transcriptome']) & set(conf['init_rates']) & set(conf['decay_constants'])) print "found %s genes in common." % len(genes) mRNAs = [] counter = 0 for gene in genes: # print "abundancies and initiation rates available for gene:", gene for instance in range(conf['transcriptome'][gene]): mRNAs.append( MRNA_specific.mRNA_spec( index=counter, sequence=conf['exome'][gene], geneID=gene, ribosomes={}, init_rate=conf['init_rates'] [gene])) # do not just multiply the list counter += 1 print "built gene library, next: run TRSL_spec." description = conf['description'] print description duration = 20.0 tr = TRSL_spec(mRNAs, conf['exome'], conf['decay_constants'], nribo=20000) tr._tRNA = col.Counter({i: tRNA_types[i]['abundancy'] for i in tRNA_types}) tr._tRNA_free = col.Counter({i: int(tr._tRNA[i])