Open cairijun opened 10 years ago
非常好!
更新后的数据结构定义:
Basic Component
{
"id": 1, //在Circuit或Device中时,"id": null表示无输入只有promoter(s)
"type": "input",
"name": "Input XXX",
//以下字段仅在Circuit或Device中存在
"receptor": {/* A receptor object */},
"promoters": [
{/* A promoter object */},
{/* A promoter object */},
],
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "output",
"name": "Output XXX",
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "receptor",
"name": "Receptor XXX",
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "promoter",
"name": "Promoter XXX",
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "rbs",
"name": "RBS XXX",
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "logic",
"name": "And Gate XXX",
"truth_table": "FFFT",
"intermedia": ["XXX", "YYY"],
//以下两个字段在Circuit或Device中能被替换
"inputs": [
{
"RBS": {/* An RBS object */},
"output": {/* An output object */}
},
{
"RBS": {/* An RBS object */},
"output": {/* An output object */}
},
],
"outputs": [
{
"promoter": {/* An promoter object */},
"RBS": {/* An RBS object */},
},
],
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
Circuit(能够用一个预先确定的方程组表示)
{
"inputs": [
{/* An input object */},
{/* An input object */},
],
"outputs": [
{/* An output object */},
],
//如果是简单通路,则"logic": null
//circuit的inputs和outputs,与logic中的inputs和outputs按顺序一一对应
"logic": {/* An logic object */},
}
{
"inputs": [
{"id": 1, "receptor_id": 1, "promoter_ids": [1, 2]},
{"id": 2, "receptor_id": 4, "promoter_ids": [5]},
],
"outputs": [2],
"truth_table": [ //可以不完整
{"inputs": [false, false], "outputs": [false]}
{"inputs": [false, true], "outputs": [false]},
{"inputs": [true, false], "outputs": [false]},
{"inputs": [true, true], "outputs": [true]},
]
}
{
"logic": [
null,
{/* An logic object */},
{/* An logic object */},
]
//其余与单个完整通路一样
}
{
"circuits": [
{/* A circuit object */},
{/* A circuit object */},
{/* A circuit object */},
],
"relationships": [
{
"from": "58d44e82aa1c4ca0bf3983583fedc556",
"to": "c5820968a77f4c278093a048fe60e28a",
"type": "promote",
},
{
"from": "02d32d2742a2494f98a641b3c535d0fe",
"to": "418d4ad9ebf04655a4815799af23a915",
"type": "repress",
}
]
}
基本元件会根据需要添加其他字段用于对元件进行更详细的描述。
改动:
{
"id": 1,
"type": "XXX",
"name": "Input XXX",
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
{
"id": 1,
"type": "logic",
"name": "And Gate XXX",
"truth_table": "FFFT",
"intermedia": ["XXX", "YYY"],
//以下两个字段在Circuit或Device中能被替换
/* 如果不存在逻辑门,比如只有一个input,那么以下就只会得到promoter和output。*/
"inputparts": [
[
{/* An promoter biobrick */},
{/* An RBS biobrick */},
{/* An output biobrick */}
{/* An terminator biobrick */}
],
[
{/* An promoter biobrick */},
{/* An RBS biobrick */},
{/* An output biobrick */}
{/* An terminator biobrick */}
],
],
"outputpart":
[
{/* An promoter biobrick */},
{/* An RBS biobrick */},
{/* An output biobrick */}
{/* An terminator biobrick */}
],
//以下字段仅在Circuit或Device中存在
"eid": "c5820968a77f4c278093a048fe60e28a",
}
一个circuit可能会有多个不同的logic,output直接存在logic里
{
"inputs": [
[/*a biobrick array*/], /*其实就是存input和receptor*/
[/*a biobrick array*/],
],
"logics": [
{/* An logic object */},
{/* An logic object */},
{/* An logic object */}
]
}
增加type为terminator的Biobrick
感觉把inputparts中的promoters移到inputs中会比较好:
{
"inputs": [
[
{/* An input object */},
{/* A receptor object */},
{/* A promoter object */},
{/* A promoter object */}
],
[
/* ... */
]
],
"logics": [
{/* A logic object */},
{/* A logic object */}
]
}
因为inputparts中的promoters不是logic的一部分,不是存储在数据库中的,移出来后logic可以使用数据库中取出来的数据,不用再去修改了
另外,circuit实现方案的响应格式如下:
{
"inputs": [/* ... */],
"logics": [
[{/* Option 1 for output 1 */}, {/* Option 2 for output 2 */}],
[{/* Option 1 for output 2 */}],
[{/* Option 1 for output 3 */}, {/* Option 2 for output 3 */}, {/* Option 3 for output 3 */}]
]
}
此外,考虑到存在多个输出的Logic,outputpart
改为outputparts
,是一个数组,类似inputparts
circuit的promoter的放置按照原来 @LiuXiangyu 的方案
terminator需要用户选择,circuit实现方案的请求格式如下:
{
"inputs": [
{"id": 1, "receptor_id": 1, "promoter_id": 3},
{"id": 2, "receptor_id": 2, "promoter_id": 4},
],
"outputs": [
{"id": 1, "terminator_id": 1},
{"id": 2, "terminator_id": 1},
],
"truth_table": [/* 略 */]
}
{
"inputs": [
{"id": 1, "receptor_id": 1, "promoter_id": 3},
{"id": 2, "receptor_id": 2, "promoter_id": 4},
],
"outputs": [1, 2], /*用户不用选择terminator,还是改成id的数组*/
"truth_table": [/* 略 */]
}
GET
/biobrick/<type>
<type>
可取值input
、output
、receptor
、promoter
,获取某种元件的列表。返回格式:GET
/biobrick/<type>?id=XXX
根据ID获取某个元件的信息。返回格式:
GET
/biobrick/suggest/promoters?input_id=XXX
根据Input推荐Promoter。返回格式:
GET
/biobrick/suggest/receptors?input_id=XXX&promoter_id=YYY
根据Input和Promoter推荐Receptor。返回格式:
POST
/circuit/schemes
根据真值表设计通路。(目前的算法实现只能处理完整的真值表) 请求格式:
响应格式:
每个元件用
eid
来唯一标识。其他的还在设计,尽快写~