Esempio n. 1
0
            # Read wildtype solution from file
            wtSolution = MetabolicFlux()
            try:
                wtSolution.readFromFile(options.wtSolution)
            except IOError, strerror:
                print("An error occurred while trying to read file %s:" %
                      os.path.basename(options.wtSolution))
                print strerror
                _mpi_exit(comm, 1)
            except SyntaxError, strerror:
                print("An error occurred parsing file %s:" %
                      os.path.basename(options.wtSolution))
                print strerror
                _mpi_exit(comm, 1)

            if not wtSolution.hasSameReactions(model):
                print(
                    "Error in file %s: FBA solution and model must have the "
                    "same reactions." % os.path.basename(options.wtSolution))
                _mpi_exit(comm, 1)

            # Build coefficient vector of linear objective function
            objective = array(
                ParamParser.convertObjFuncToLinVec(objStr, model.reactionDict))
            wt_obj_value = dot(objective,
                               wtSolution.getVecOrderedByModel(model))

        # 7.b If FBA solution is not given, perform FBA

        else:
            # Compute wildtype solution via FBA
Esempio n. 2
0
    wtFlux = MetabolicFlux()
    try:
        wtFlux.readFromFile(options.wtSolution)
    except IOError, strerror:
        print("An error occurred while trying to read file %s:" %
              os.path.basename(options.wtSolution))
        print strerror
        exit()
    except SyntaxError, strerror:
        print("An error occurred parsing file %s:" %
              os.path.basename(options.wtSolution))
        print strerror
        exit()

    if not wtFlux.hasSameReactions(model):
        print "Error: Solution and model must have the same reactions."
        exit()

    # 5. (Optionally) Read FVA solution for reducing the solution space
    #    - skip if full matrix is to be used

    if options.redFvaFile and not options.useFullMatrix:
        try:
            fbaSolution, redMinmax = \
                FvAnalyzer.parseSolutionFile(options.redFvaFile)
        except IOError, strerror:
            print("An error occurred while trying to read file %s:" %
                  os.path.basename(options.redFvaFile))
            print strerror
            exit()