Exemple #1
0
def assemble_loopy():
    """Assemble INDRA Statements into a Loopy model using SIF Assembler."""
    if request.method == 'OPTIONS':
        return {}
    response = request.body.read().decode('utf-8')
    body = json.loads(response)
    stmts_json = body.get('statements')
    stmts = stmts_from_json(stmts_json)
    sa = SifAssembler(stmts)
    sa.make_model(use_name_as_key=True)
    model_str = sa.print_loopy(as_url=True)
    res = {'loopy_url': model_str}
    return res
Exemple #2
0
def assemble_loopy():
    """Assemble INDRA Statements into a Loopy model using SIF Assembler."""
    if request.method == 'OPTIONS':
        return {}
    response = request.body.read().decode('utf-8')
    body = json.loads(response)
    stmts_json = body.get('statements')
    stmts = stmts_from_json(stmts_json)
    sa = SifAssembler(stmts)
    sa.make_model(use_name_as_key=True)
    model_str = sa.print_loopy(as_url=True)
    res = {'loopy_url': model_str}
    return res
Exemple #3
0
    def post(self):
        """Assemble INDRA Statements into a Loopy model using SIF Assembler.

        Parameters
        ----------
        statements : list[indra.statements.Statement.to_json()]
            A list of INDRA Statements to assemble.

        Returns
        -------
        loopy_url : str
            Assembled Loopy model string.
        """
        args = request.json
        stmts_json = args.get('statements')
        stmts = stmts_from_json(stmts_json)
        sa = SifAssembler(stmts)
        sa.make_model(use_name_as_key=True)
        model_str = sa.print_loopy(as_url=True)
        res = {'loopy_url': model_str}
        return res