Skip to content

simulation部分接口 #2

Description

@cairijun

simulation部分需要进行编译。
编译依赖:boost(只需要boost::numeric::odeint)、Cython、支持C++11的C++编译器。
运行./setup.py build_ext -i即可编译。

进行模拟前需要先把设计方案发送到后端进行预处理,生成调控关系等信息,然后再进行模拟。

  • POST /simulation/preprocess

    请求:

    [
        {
            "inputs": [
                {"id": 8, "receptor_id": 12, "promoter_id": 1}, 
                {"id": 9, "receptor_id": 13, "promoter_id": 17}
            ], 
            "logics": [16], 
            "outputs": [1]
        },
        {
            "inputs": [
                {"id": 3, "receptor_id": 4, "promoter_id": 9}, 
                {"id": 4, "receptor_id": 5, "promoter_id": 20}
            ], 
            "logics": [12], 
            "outputs": [2]
        }
    ]

    响应:

    {
      "output_RBS": {  /* 每个output对应的RBS,output包括中间产物,用户可以更换RBS */
        "BBa_C0079": "BBa_B0034", 
        "RFP": "BBa_B0034", 
        "T7ptag": "BBa_B0034", 
        "ZntR": "BBa_B0034", 
        "supD": "BBa_B0034"
      }, 
      "reactants": [  /* 参与反应的物质列表,请勿修改 */
        "RFP", "aTc", "BBa_C0079", "ZntR", "Arsenic ions", 
        "YFP", "Zinc ions", "PAI", "supD", "T7ptag"
      ], 
      "relationships": [  /* 调控关系,请勿修改 */
        {
          "K": 0.001, "from": "PAI", "gamma": 0.002, 
          "n": 1.0, "to": "supD", "type": "PROMOTE"
        }, 
        {
          "K": 0.0021, "from": "Zinc ions", "gamma": 0.122, 
          "n": 1.2, "to": "T7ptag", "type": "PROMOTE"
        }, 
        {
          "K": 1.0, "from_1": "supD", "from_2": "T7ptag", "gamma": 0.0, 
          "n": 1.0, "to": "RFP", "type": "BIPROMOTE"
        }, 
        {
          "K": 0.0056, "from": "aTc", "gamma": 0.07, 
          "n": 3.0, "to": "ZntR", "type": "PROMOTE"
        }, 
        {
          "K": 0.0056, "from": "BBa_C0079", "gamma": 0.07, 
          "n": 3.0, "to": "ZntR", "type": "REPRESS"
        }, 
        {
          "K": 6.8e-05, "from": "Arsenic ions", "gamma": 0.0023, 
          "n": 1.0, "to": "BBa_C0079", "type": "PROMOTE"
        }, 
        {
          "K": 6.8e-05, "from": "ZntR", "gamma": 0.0023, 
          "n": 1.0, "to": "BBa_C0079", "type": "REPRESS"
        }, 
        {
          "from": "BBa_C0079", "to": "YFP", "type": "SIMPLE"
        }
      ]
    }
  • POST /simulation/simulate

    请求:

    {
      "output_RBS": {/* ... */},
      "reactants": [/* ... */],
      "relationships": [/* ... */],
      "x0": {  /* 部分反应物的初始浓度,其余为0 */
        "Arsenic ions": 0.003, "aTc": 0.001, "Zinc ions": 0.01, "PAI": 0.004
      },
      "t": 200  /* 反应时间 */
    }

    响应:

    {
      "t": [0.0, 0.0011698867286399487, 0.0023397734572798974, ..., 200.0],  /* 时间刻度 */
      "c": [
        [0.0, ..., 5.902561416597707],  /* 第一种反应物的浓度变化 */
        [0.0, ..., 4.096369890704216],  /* 第二种反应物的浓度变化 */
      ]
    }

更多例子请参考/tests/test_simulation.py中的单元测试。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions