コード例 #1
0
 def exo_35(self, mrna, pos, k, tag=False):
     """Inactivate deadenylated/endonucleolytically cleaved mRNA from 3' to 5'
     """
     # convert the position from intact to exocleaved only if not occupied by
     # ribosome
     mrna_reactant_args = {f'p{pos}': None, f'r{pos}': 'intact'}
     mrna_product_args = {f'p{pos}': None, f'r{pos}': 'exocleaved'}
     # 3' to 5' exonucleolysis can occur only
     # if 3' nt was also cleaved endo or exonucleolytically.
     # The exception is the last nt of the mRNA which can be
     # exonucleosed only if the poly A is absent.
     if pos == self.mrna_length - 1:
         mrna_reactant_args['pA1'] = 'exocleaved'
         mrna_product_args['pA1'] = 'exocleaved'
         sb.Rule('exonucleolysis_3end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
     else:
         # exo
         mrna_reactant_args[f'r{pos + 1}'] = 'exocleaved'
         mrna_product_args[f'r{pos + 1}'] = 'exocleaved'
         sb.Rule('exonucleolysis_3end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
         # endo
         mrna_reactant_args[f'r{pos + 1}'] = 'endocleaved'
         mrna_product_args[f'r{pos + 1}'] = 'endocleaved'
         sb.Rule('exonucleolysis_from_endo_3end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
コード例 #2
0
 def exo_53(self, mrna, pos, k, tag=False):
     """Inactivate decapped or endonucleolytically mRNA from 5' to 3'
     """
     # convert the position from intact to exocleaved only if not occupied by
     # ribosome
     mrna_reactant_args = {f'p{pos}': None, f'r{pos}': 'intact'}
     mrna_product_args = {f'p{pos}': None, f'r{pos}': 'exocleaved'}
     # 5' to 3' exonucleolysis can occur only
     # if previous nt was also cleaved endo or exonucleolytically.
     # The exception is the first nt of the mRNA which can be
     # exonucleosed only if the cap is absent.
     if pos == 0:
         mrna_reactant_args['cap'] = 'no'
         mrna_product_args['cap'] = 'no'
         sb.Rule('exonucleolysis_5end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
     else:
         # exo
         mrna_reactant_args[f'r{pos - 1}'] = 'exocleaved'
         mrna_product_args[f'r{pos - 1}'] = 'exocleaved'
         sb.Rule('exonucleolysis_5end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
         # endo
         mrna_reactant_args[f'r{pos - 1}'] = 'endocleaved'
         mrna_product_args[f'r{pos - 1}'] = 'endocleaved'
         sb.Rule('exonucleolysis_from_endo_5end_' + str(pos),
                 mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
                 k,
                 tag=tag)
コード例 #3
0
 def terminate(self,
               ribosome,
               mrna,
               pos,
               k,
               mrna_length,
               ribosome_footprint_size,
               cleavestate,
               tag=False):
     """Terminate ribosome by leaving mRNA at position pos.
     Ribosome can be not hit or hit from 5'.
     """
     mrna_reactant_args = {
         'p' + str(pos): 1,
     }
     mrna_product_args = {
         'p' + str(pos): None,
     }
     ribosome_reactant_args = {'asite': 1, 'hit3': None, 'hit5': None}
     ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
     # mrna becomes free to initiate if ribosomes terminated
     # within footprint distance of ATG
     if pos <= ribosome_footprint_size:
         mrna_reactant_args['start_region'] = 'blocked'
         mrna_product_args['start_region'] = 'free'
     # termination of ribosomes that are hit neither front or back
     sb.Rule('term_no_hit_{}'.format(pos),
             ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args)
             >> ribosome(**ribosome_product_args) +
             mrna(**mrna_product_args) + protein(),
             k,
             tag=tag)
     # termination out of a collision, need to consider the ribosome behind
     # but only if not separate by cleavage
     if pos > ribosome_footprint_size:
         mrna_reactant_args = {
             'p' + str(pos - ribosome_footprint_size): 1,
             'p' + str(pos): 3,
             'r' + str(pos): cleavestate,
         }
         mrna_product_args = {
             'p' + str(pos - ribosome_footprint_size): 1,
             'p' + str(pos): None,
             'r' + str(pos): cleavestate,
         }
         ribosome_reactant_args = {'asite': 3, 'hit3': None, 'hit5': 2}
         ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
         ribosome_5_reactant_args = {'asite': 1, 'hit3': 2}
         ribosome_5_product_args = {'asite': 1, 'hit3': None}
         sb.Rule(
             'term_5_hit_{}_{}'.format(cleavestate, pos),
             ribosome(**ribosome_5_reactant_args) %
             mrna(**mrna_reactant_args) % ribosome(**ribosome_reactant_args)
             >>
             ribosome(**ribosome_5_product_args) % mrna(**mrna_product_args)
             + ribosome(**ribosome_product_args) + protein(),
             k,
             tag=tag)
コード例 #4
0
 def endocleave_no_hit(self,
                       ribosome,
                       mrna,
                       pos,
                       k,
                       mrna_length,
                       ribosome_footprint_size,
                       cleave_distance,
                       tag=False):
     """Cleave mRNA behind the ribosome which is not hit.
     Note that we assume that only one endonucleolytic cleavage
     occurs per mRNA. So we model this as only capped mRNAs
     can be endonucleolytically cleaved.
     The mRNA also becomes decapped right away so that
     it cannot be initiated.
     """
     mrna_reactant_args = {
         'p' + str(pos): 1,
         'r' + str(pos - ribosome_footprint_size): 'intact',
         'cap': 'yes',
     }
     mrna_product_args = {
         'p' + str(pos): 1,
         'r' + str(pos - ribosome_footprint_size): 'endocleaved',
         'cap': 'no'
     }
     ribosome_reactant_args = {'asite': 1, 'hit3': None, 'hit5': None}
     ribosome_product_args = {'asite': 1, 'hit3': None, 'hit5': None}
     sb.Rule(
         'endocleave_no_hit_' + str(pos),
         ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args) >>
         ribosome(**ribosome_product_args) % mrna(**mrna_product_args),
         k,
         tag=tag)
コード例 #5
0
 def preterm_no_hit(self,
                    ribosome,
                    mrna,
                    pos,
                    k,
                    mrna_length,
                    ribosome_footprint_size,
                    cleavestate,
                    tag=False):
     """Premature termination of ribosomes that are hit neither
     from front or back.
     cleavestate indicate whether mrna pos is intact or cleaved.
     """
     mrna_reactant_args = {'p' + str(pos): 1, 'r' + str(pos): cleavestate}
     mrna_product_args = {'p' + str(pos): None, 'r' + str(pos): cleavestate}
     ribosome_reactant_args = {'asite': 1, 'hit3': None, 'hit5': None}
     ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
     # mrna becomes free to initiate if ribosomes terminated
     # within footprint distance of ATG
     if pos <= ribosome_footprint_size:
         mrna_reactant_args['start_region'] = 'blocked'
         mrna_product_args['start_region'] = 'free'
     # termination of ribosomes that are hit neither front or back
     sb.Rule('preterm_no_hit_{}_{}'.format(cleavestate, pos),
             ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args)
             >> ribosome(**ribosome_product_args) +
             mrna(**mrna_product_args) + abortedprotein(),
             k,
             tag=tag)
コード例 #6
0
 def initiate(self, ribosome, mrna, pos, k, tag=False):
     """Initiate a ribosome at codon 'pos' on mRNA with rate k
     """
     # ribosomes can initiate only if the initation codon
     # has not been inactivated by cleavage
     mrna_reactant_args = {
         'p' + str(pos): None,
         'r' + str(pos): 'intact',
         'start_region': 'free',
         'cap': 'yes'
     }
     mrna_product_args = {
         'p' + str(pos): 1,
         'r' + str(pos): 'intact',
         'start_region': 'blocked',
         'cap': 'yes'
     }
     ribosome_reactant_args = {'asite': None}
     ribosome_product_args = {'asite': 1}
     sb.Rule(
         'initiation',
         ribosome(**ribosome_reactant_args) + mrna(**mrna_reactant_args) >>
         ribosome(**ribosome_product_args) % mrna(**mrna_product_args),
         k,
         total_rate=True,
         tag=tag)
コード例 #7
0
 def decap(self, mrna, k, tag=False):
     """Decap deadenylated mRNA
     """
     # decapping can occur only if the polyA at pos was deadenylated
     pos = 0
     mrna_reactant_args = {'pA' + str(pos): 'exocleaved'}
     mrna_product_args = {'pA' + str(pos): 'exocleaved'}
     mrna_reactant_args['cap'] = 'yes'
     mrna_product_args['cap'] = 'no'
     sb.Rule('decapping',
             mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
             k,
             tag=tag)
コード例 #8
0
    def preterm_both_hit(self,
                         ribosome,
                         mrna,
                         pos,
                         k,
                         mrna_length,
                         ribosome_footprint_size,
                         cleavestate,
                         tag=False):
        """Premature termination of ribosomes that are hit both 5' and 3'.
        cleavestate indicate whether mrna pos is intact or cleaved.
        """
        if pos >= mrna_length - ribosome_footprint_size:
            raise ValueError("There can be ribosome after stop!")

        if pos < ribosome_footprint_size:
            raise ValueError("There cannot be ribosome behind this one!")

        mrna_reactant_args = {
            'p' + str(pos - ribosome_footprint_size): 1,
            'p' + str(pos): 3,
            'r' + str(pos): cleavestate,
            'p' + str(pos + ribosome_footprint_size): 5,
        }

        mrna_product_args = {
            'p' + str(pos - ribosome_footprint_size): 1,
            'p' + str(pos): None,
            'r' + str(pos): cleavestate,
            'p' + str(pos + ribosome_footprint_size): 5,
        }

        ribosome_5_reactant_args = {'asite': 1, 'hit3': 2}
        ribosome_5_product_args = {'asite': 1, 'hit3': None}
        ribosome_reactant_args = {'asite': 3, 'hit3': 4, 'hit5': 2}
        ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
        ribosome_3_reactant_args = {'asite': 5, 'hit5': 4}
        ribosome_3_product_args = {'asite': 5, 'hit5': None}

        sb.Rule(
            'preterm_both_hit_{}_{}'.format(cleavestate, pos),
            ribosome(**ribosome_5_reactant_args) %
            ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args) %
            ribosome(**ribosome_3_reactant_args) >>
            ribosome(**ribosome_product_args) +
            ribosome(**ribosome_5_product_args) % mrna(**mrna_product_args) %
            ribosome(**ribosome_3_product_args) + abortedprotein(),
            k,
            tag=tag)
コード例 #9
0
 def deadenylate(self, mrna, pos, k, l_polya, tag=False):
     """Inactivate polyA tail at position pos
     """
     # convert the position from intact to exocleaved
     mrna_reactant_args = {'pA' + str(pos): 'intact'}
     mrna_product_args = {'pA' + str(pos): 'exocleaved'}
     # deadenylation at non-terminal As can occur only
     # if previous A was deadenylated
     if pos < l_polya - 1:
         mrna_reactant_args['pA' + str(pos + 1)] = 'exocleaved'
         mrna_product_args['pA' + str(pos + 1)] = 'exocleaved'
     sb.Rule('deadenylation_' + str(pos),
             mrna(**mrna_reactant_args) >> mrna(**mrna_product_args),
             k,
             tag=tag)
コード例 #10
0
 def endocleave_both_hit(self,
                         ribosome,
                         mrna,
                         pos,
                         k,
                         mrna_length,
                         ribosome_footprint_size,
                         cleave_distance,
                         tag=False):
     """Cleave mRNA behind the ribosome which is hit both 5' and 3'.
     Bond between the 5' ribosome and this ribosome is broken.
     Note that we assume that only one endonucleolytic cleavage
     occurs per mRNA. So we model this as only capped mRNAs
     can be endonucleolytically cleaved.
     The mRNA also becomes decapped right away so that
     it cannot be initiated.
     """
     mrna_reactant_args = {
         'p' + str(pos - ribosome_footprint_size): 1,
         'r' + str(pos - ribosome_footprint_size): 'intact',
         'p' + str(pos): 3,
         'p' + str(pos + ribosome_footprint_size): 5,
         'cap': 'yes'
     }
     mrna_product_args = {
         'p' + str(pos - ribosome_footprint_size): 1,
         'r' + str(pos - ribosome_footprint_size): 'endocleaved',
         'p' + str(pos): 3,
         'p' + str(pos + ribosome_footprint_size): 5,
         'cap': 'no'
     }
     ribosome_5_reactant_args = {'asite': 1, 'hit3': 2}
     ribosome_5_product_args = {'asite': 1, 'hit3': None}
     ribosome_reactant_args = {'asite': 3, 'hit5': 2, 'hit3': 4}
     ribosome_product_args = {'asite': 3, 'hit5': None, 'hit3': 4}
     ribosome_3_reactant_args = {'asite': 5, 'hit5': 4}
     ribosome_3_product_args = {'asite': 5, 'hit5': 4}
     sb.Rule(
         'endocleave_both_hit_{}'.format(pos),
         ribosome(**ribosome_5_reactant_args) %
         ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args) %
         ribosome(**ribosome_3_reactant_args) >>
         ribosome(**ribosome_5_product_args) %
         ribosome(**ribosome_product_args) % mrna(**mrna_product_args) %
         ribosome(**ribosome_3_product_args),
         k,
         tag=tag)
コード例 #11
0
    def transcribe(self, dna, mrna, k, l_mrna=0, l_polya=0, tag=False):
        """Produce an mRNA from DNA
        """
        mrna_product_args = {'cap': 'yes', 'start_region': 'free'}

        # new mrnas do not have any ribosomes;
        # no sites either in coding or polyatail are cleaved
        for pos in range(l_mrna):
            mrna_product_args[f'p{pos}'] = None
            mrna_product_args[f'r{pos}'] = 'intact'
        for pos in range(l_polya):
            mrna_product_args['pA' + str(pos)] = 'intact'

        sb.Rule('transcription',
                dna() >> dna() + mrna(**mrna_product_args),
                k,
                tag=tag)
コード例 #12
0
    def preterm_3_hit(self,
                      ribosome,
                      mrna,
                      pos,
                      k,
                      mrna_length,
                      ribosome_footprint_size,
                      cleavestate,
                      tag=False):
        """Premature termination of ribosomes that are hit only from 3'.
        cleavestate indicate whether mrna pos is intact or cleaved.
        """
        if pos >= mrna_length - ribosome_footprint_size:
            raise ValueError("There can be ribosome after stop!")
        mrna_reactant_args = {
            'p' + str(pos): 1,
            'r' + str(pos): cleavestate,
            'p' + str(pos + ribosome_footprint_size): 3,
        }

        mrna_product_args = {
            'p' + str(pos): None,
            'r' + str(pos): cleavestate,
            'p' + str(pos + ribosome_footprint_size): 3,
        }
        ribosome_reactant_args = {'asite': 1, 'hit3': 2, 'hit5': None}
        ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
        ribosome_3_reactant_args = {'asite': 3, 'hit5': 2}
        ribosome_3_product_args = {'asite': 3, 'hit5': None}
        # mrna becomes free to initiate if ribosomes terminated
        # within footprint distance of ATG
        if pos <= ribosome_footprint_size:
            mrna_reactant_args['start_region'] = 'blocked'
            mrna_product_args['start_region'] = 'free'
        sb.Rule(
            'preterm_3_hit_{}_{}'.format(cleavestate, pos),
            ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args) %
            ribosome(**ribosome_3_reactant_args) >>
            ribosome(**ribosome_product_args) + mrna(**mrna_product_args) %
            ribosome(**ribosome_3_product_args) + abortedprotein(),
            k,
            tag=tag)
コード例 #13
0
 def preterm_5_hit(self,
                   ribosome,
                   mrna,
                   pos,
                   k,
                   mrna_length,
                   ribosome_footprint_size,
                   cleavestate,
                   tag=False):
     """Premature termination of ribosomes that are hit only from 5'.
     cleavestate indicate whether mrna pos is intact or cleaved.
     """
     # note that mRNA cannot become free from this type of termination
     if pos < ribosome_footprint_size:
         raise ValueError("There cannot be ribosome behind this one!")
     mrna_reactant_args = {
         'p' + str(pos - ribosome_footprint_size): 1,
         'p' + str(pos): 3,
         'r' + str(pos): cleavestate,
     }
     mrna_product_args = {
         'p' + str(pos - ribosome_footprint_size): 1,
         'p' + str(pos): None,
         'r' + str(pos): cleavestate,
     }
     ribosome_reactant_args = {'asite': 3, 'hit3': None, 'hit5': 2}
     ribosome_product_args = {'asite': None, 'hit3': None, 'hit5': None}
     ribosome_5_reactant_args = {'asite': 1, 'hit3': 2}
     ribosome_5_product_args = {'asite': 1, 'hit3': None}
     sb.Rule(
         'preterm_5_hit_{}_{}'.format(cleavestate, pos),
         ribosome(**ribosome_5_reactant_args) % mrna(**mrna_reactant_args) %
         ribosome(**ribosome_reactant_args) >>
         ribosome(**ribosome_5_product_args) % mrna(**mrna_product_args) +
         ribosome(**ribosome_product_args) + abortedprotein(),
         k,
         tag=tag)
コード例 #14
0
 def ribosomes_collide(self,
                       ribosome,
                       mrna,
                       pos,
                       k,
                       mrna_length,
                       ribosome_footprint_size,
                       tag=False):
     """Ribosome at codon pos collides with ribosome at codon
     pos + ribosome_footprint_size on mRNA
     """
     if pos > mrna_length - ribosome_footprint_size:
         raise ValueError('There cannot be ribosome after stop!')
     # ribosomes can collide only if the back ribosome has an intact A-site
     mrna_reactant_args = {
         f'p{pos}': 1,
         f'r{pos}': 'intact',
         f'p{pos + ribosome_footprint_size}': 2,
     }
     mrna_product_args = {
         f'p{pos}': 1,
         f'r{pos}': 'intact',
         f'p{pos + ribosome_footprint_size}': 2,
     }
     ribosome_reactant_args = {'asite': 1, 'hit3': None}
     ribosome_product_args = {'asite': 1, 'hit3': 3}
     ribosome_3_reactant_args = {'asite': 2, 'hit5': None}
     ribosome_3_product_args = {'asite': 2, 'hit5': 3}
     sb.Rule(
         'collision_' + str(pos),
         ribosome(**ribosome_reactant_args) %
         ribosome(**ribosome_3_reactant_args) % mrna(**mrna_reactant_args)
         >> ribosome(**ribosome_product_args) %
         ribosome(**ribosome_3_product_args) % mrna(**mrna_product_args),
         k,
         tag=tag)
コード例 #15
0
    def elongate(self,
                 ribosome,
                 mrna,
                 pos,
                 k,
                 mrna_length,
                 ribosome_footprint_size,
                 tag=False):
        """Move ribosome from codon 'pos' on mRNA to 'pos' + 1
        """
        # ribosomes can elongate only if mrna is not inactivated by cleavage
        mrna_reactant_args = {
            f'p{pos}': 1,
            f'p{pos + 1}': None,
            f'r{pos}': 'intact',
        }
        mrna_product_args = {
            f'p{pos}': None,
            f'p{pos + 1}': 1,
            f'r{pos}': 'intact',
        }
        ribosome_reactant_args = {'asite': 1, 'hit5': None, 'hit3': None}
        ribosome_product_args = {'asite': 1, 'hit5': None, 'hit3': None}

        # ribosomes can elongate only if there is no ribosome immediately in
        # front this extra condition is necessary only if the ribosome is
        # larger than footprint
        if (pos < mrna_length - ribosome_footprint_size
                and ribosome_footprint_size > 1):
            mrna_reactant_args['p' + str(pos + ribosome_footprint_size)] = None
            mrna_product_args['p' + str(pos + ribosome_footprint_size)] = None

        # if ribosome moves beyond a footprint from ATG, mrna is free to
        # initiate
        if pos == ribosome_footprint_size - 1:
            mrna_reactant_args['start_region'] = 'blocked'
            mrna_product_args['start_region'] = 'free'
        sb.Rule(
            'elongation_' + str(pos),
            ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args) >>
            ribosome(**ribosome_product_args) % mrna(**mrna_product_args),
            k,
            tag=tag)
        # elongation out of a collision, need to consider the ribosome behind
        if pos > ribosome_footprint_size - 1:
            mrna_reactant_args['p' + str(pos - ribosome_footprint_size)] = 2
            mrna_product_args['p' + str(pos - ribosome_footprint_size)] = 2
            ribosome_reactant_args = {'asite': 1, 'hit5': 3, 'hit3': None}
            ribosome_product_args = {'asite': 1, 'hit5': None, 'hit3': None}
            ribosome_5_reactant_args = {
                'asite': 2,
                'hit3': 3,
            }
            ribosome_5_product_args = {
                'asite': 2,
                'hit3': None,
            }
            sb.Rule(
                'elongation_with_hit5_' + str(pos),
                ribosome(**ribosome_5_reactant_args) %
                ribosome(**ribosome_reactant_args) % mrna(**mrna_reactant_args)
                >> ribosome(**ribosome_5_product_args) %
                ribosome(**ribosome_product_args) % mrna(**mrna_product_args),
                k,
                tag=tag)
コード例 #16
0
     assert 1 <= len(r.reactants) <= 2
     assert len(r.products) == 1
     lterms = [model.monomers[s.name]() for s in r.reactants]
     lhs = sum(lterms[1:], lterms[0]())
     rhs = model.monomers[r.products[0].name]()
     kf = model.parameters[r.kf.name]
     kr = model.parameters[r.kr.name]
     if len(lterms) == 2 and r.reactants[0] == r.reactants[1]:
         expr_name = kf.name + '_symmetric'
         try:
             kf = model.expressions[expr_name]
         except KeyError:
             kf = pysb.Expression(expr_name, kf * 2, _export=False)
             model.add_component(kf)
     if kr.get_value() == 0:
         rule = pysb.Rule(r.name, lhs >> rhs, kf, _export=False)
     else:
         rule = pysb.Rule(r.name, lhs <> rhs, kf, kr, _export=False)
     model.add_component(rule)
 sbml_perb11_names = [
     'c483',
     'c136',
     'c23',
     'c7',
     'c25',
     'c88',
     'c27',
     'c89',
     'c29',
     'c90',
     'c34',