KarrLab/intro_to_wc_modeling

View on GitHub

Showing 135 of 135 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

return (self.gR*self.VmPFK*x[3]*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)*(1 + x[3]/self.KmPFKF6P + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KmPFKATP) + (self.gR*x[3]*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/((2 - 8*self.KeqAK)*self.KmPFKATP*self.KmPFKF6P)))/((2 - 8*self.KeqAK)*self.KmPFKATP*self.KmPFKF6P*((self.L0*(1 + (self.CPFKF26BP*self.F26BP)/self.KPFKF26BP + (self.CPFKF16BP*x[2])/self.KPFKF16BP)**2*(1 + (2*self.CPFKAMP*self.KeqAK*(self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)**2)/((-1 + 4*self.KeqAK)*self.KPFKAMP*(self.SUMAXP - x[12] + 4*self.KeqAK*x[12] - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)))**2*(1 + (self.CiPFKATP*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/((2 - 8*self.KeqAK)*self.KiPFKATP))**2*(1 + (self.CPFKATP*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/((2 - 8*self.KeqAK)*self.KmPFKATP))**2)/((1 + self.F26BP/self.KPFKF26BP + x[2]/self.KPFKF16BP)**2*(1 + (2*self.KeqAK*(self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)**2)/((-1 + 4*self.KeqAK)*self.KPFKAMP*(self.SUMAXP - x[12] + 4*self.KeqAK*x[12] - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)))**2*(1 + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KiPFKATP))**2) + (1 + x[3]/self.KmPFKF6P + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KmPFKATP) + (self.gR*x[3]*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/((2 - 8*self.KeqAK)*self.KmPFKATP*self.KmPFKF6P))**2))
Severity: Major
Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 4 days to fix
intro_to_wc_modeling/cell_modeling/model_composition.py on lines 292..292

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return (self.VmGLK*(-((x[4]*(self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)) /
((1 - 4*self.KeqAK)*self.KeqGLK)) + (x[5]*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/(2 - 8*self.KeqAK)))/(self.KmGLKATP*self.KmGLKGLCi*(1 + x[4]/self.KmGLKG6P + x[5]/self.KmGLKGLCi)*(1 + (self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((1 - 4*self.KeqAK)*self.KmGLKADP) + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KmGLKATP)))
Severity: Major
Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 4 days to fix
intro_to_wc_modeling/cell_modeling/model_composition.py on lines 307..307

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return (self.VmPGK*((self.KeqPGK*x[1]*(self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/(1 - 4*self.KeqAK) - (x[9]*(-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/(2 - 8*self.KeqAK)))/(self.KmPGKATP*self.KmPGKP3G*(1 + x[1]/self.KmPGKBPG + x[9]/self.KmPGKP3G)*(1 + (self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((1 - 4*self.KeqAK)*self.KmPGKADP) + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KmPGKATP)))
Severity: Major
Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 4 days to fix
intro_to_wc_modeling/cell_modeling/model_composition.py on lines 271..272

File mrna_and_proteins_using_several_methods.py has 743 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Stochastic simulation tutorial
 
:Author: Jonathan Karr <jonrkarr@gmail.com>
:Date: 2017-08-30
:Copyright: 2017, Karr Lab

    File model.py has 671 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    '''
    Reads models specified in Excel into a Python object
     
    @author Jonathan Karr, karr@mssm.edu
    @date 3/22/2016

      File model_composition.py has 614 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """ Model composition tutorial
       
      - Glycolysis model (Teusink et al., 2000)
      - Glycerol synthesis model (Cronwright et al., 2002)
       
       
      Severity: Major
      Found in intro_to_wc_modeling/cell_modeling/model_composition.py - About 1 day to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        return (self.VmPYK*((x[10]*(self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5))/(1 - 4*self.KeqAK) - ((-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)*x[11])/((2 - 8*self.KeqAK)*self.KeqPYK)))/(self.KmPYKADP*self.KmPYKPEP*(1 + (self.SUMAXP - (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((1 - 4*self.KeqAK)*self.KmPYKADP) + (-self.SUMAXP + x[12] - 4*self.KeqAK*x[12] + (self.SUMAXP**2 - 2*self.SUMAXP*x[12] + 8*self.KeqAK*self.SUMAXP*x[12] + x[12]**2 - 4*self.KeqAK*x[12]**2)**0.5)/((2 - 8*self.KeqAK)*self.KmPYKATP))*(1 + x[10]/self.KmPYKPEP + x[11]/self.KmPYKPYR))
        Severity: Major
        Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 1 day to fix
        intro_to_wc_modeling/cell_modeling/model_composition.py on lines 271..271

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        m_percentiles[i, :] = [
        numpy.percentile(m[i, :], 1),
        numpy.percentile(m[i, :], 5),
        numpy.percentile(m[i, :], 33.33),
        numpy.percentile(m[i, :], 50),
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 898..905

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        n_percentiles[i, :] = [
        numpy.percentile(n[i, :], 1),
        numpy.percentile(n[i, :], 5),
        numpy.percentile(n[i, :], 33.33),
        numpy.percentile(n[i, :], 50),
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 889..896

        Function getModelFromExcel has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

        def getModelFromExcel(filename):
        # Reads model from Excel file into a Python object
         
        with warnings.catch_warnings():
        warnings.filterwarnings("ignore", "Discarded range with reserved name", UserWarning)

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        class Compartment(Base):
        """ Represents an compartment
         
        Attributes:
        name (:obj:`str`): name
        intro_to_wc_modeling/concepts_skills/software_engineering/databases/core.py on lines 61..74

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        class Specie(Base):
        """ Represents a species
         
        Attributes:
        name (:obj:`str`): name
        intro_to_wc_modeling/concepts_skills/software_engineering/databases/core.py on lines 44..58

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def v_2(self, x):
        # Glucose-6-phosphate isomerase
        # G6P <=> F6P
        return (self.VmPGI*(-(x[3]/self.KeqPGI) + x[4]))/(self.KmPGIG6P*(1 + x[3]/self.KmPGIF6P + x[4]/self.KmPGIG6P))
        Severity: Major
        Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 6 hrs to fix
        intro_to_wc_modeling/cell_modeling/model_composition.py on lines 309..312

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        def v_9(self, x):
        # Phosphoglycerate mutase
        # P3G <=> P2G
        return (self.VmPGM*(-(x[8]/self.KeqPGM) + x[9]))/(self.KmPGMP3G*(1 + x[8]/self.KmPGMP2G + x[9]/self.KmPGMP3G))
        Severity: Major
        Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 6 hrs to fix
        intro_to_wc_modeling/cell_modeling/model_composition.py on lines 274..277

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        def __init__(self, k_m=5, k_n=20, gamma_m=numpy.log(2) * 60 / 3, gamma_n=numpy.log(2) / 10, m_0=1, n_0=98):
        """
        Args:
        k_m (:obj:`float`, optional): mRNA synthesis rate constant (molecules h\ :sup:`-1`)
        k_n (:obj:`float`, optional): protein synthesis rate constant (\ :sup:`-1`\ h\ :sup:`-1`)
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 36..51

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        def __init__(self, k_m=5, k_n=20, gamma_m=numpy.log(2) * 60 / 3, gamma_n=numpy.log(2) / 10, m_0=1, n_0=98):
        """
        Args:
        k_m (:obj:`float`, optional): mRNA synthesis rate constant (molecules h\ :sup:`-1`)
        k_n (:obj:`float`, optional): protein synthesis rate constant (\ :sup:`-1`\ h\ :sup:`-1`)
        intro_to_wc_modeling/cell_modeling/simulation/mrna_and_proteins_using_several_methods.py on lines 674..689

        GlycolysisModel has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GlycolysisModel(object):
        """ Glycolysis model (Teusink et al., 2000)
         
        Based on the `version from JWS Online <http://jjj.biochem.sun.ac.za/models/teusink/>`_
         
         
        Severity: Minor
        Found in intro_to_wc_modeling/cell_modeling/model_composition.py - About 4 hrs to fix

          Function simulate has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

          def simulate(mdl):
          # simulates model
           
          # Get metabolism submodel
          submdl = mdl.getComponentById('Metabolism')

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          def dNADH_dt(self, x):
          return 1.0 * self.v_7(x) + 3.0 * self.v_13(x) - 1.0 * self.v_15(x) - 1.0 * self.v_16(x)
          Severity: Major
          Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 4 hrs to fix
          intro_to_wc_modeling/cell_modeling/model_composition.py on lines 372..373

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          def dNAD_dt(self, x):
          return 1.0 * self.v_15(x) + 1.0 * self.v_16(x) - 1.0 * self.v_7(x) - 3.0 * self.v_13(x)
          Severity: Major
          Found in intro_to_wc_modeling/cell_modeling/model_composition.py and 1 other location - About 4 hrs to fix
          intro_to_wc_modeling/cell_modeling/model_composition.py on lines 375..376
          Severity
          Category
          Status
          Source
          Language