【发布时间】:2019-10-07 21:10:55
【问题描述】:
我收到以下数据作为我的一项网络服务的响应。我想根据不同值的几种组合过滤数据。什么是最简单的方法,它会影响我的网络服务的性能
数据:我正在获取对象数组
[
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000366563",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "42",
"coexpression3": "42",
"experimental": "174",
"database2": "0",
"combinedscore3": "298",
"combinedscore4": "298",
"experimental2": "174",
"combinedscore": "298",
"database": "0",
"combinedscore2": "298",
"experimental3": "174",
"experimental4": "174",
"coexpression4": "42",
"textmining3": "184",
"coexpression": "42",
"textmining4": "184",
"textmining2": "184",
"textmining": "184"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000402551",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "148",
"coexpression3": "148",
"experimental": "138",
"database2": "0",
"combinedscore3": "247",
"combinedscore4": "247",
"experimental2": "138",
"combinedscore": "247",
"database": "0",
"combinedscore2": "247",
"experimental3": "138",
"experimental4": "138",
"coexpression4": "148",
"textmining3": "57",
"coexpression": "148",
"textmining4": "57",
"textmining2": "57",
"textmining": "57"
}
},
{
"source": "9606.ENSP00000000233",
"target": "9606.ENSP00000386239",
"relationship": "ON_INTERACTION_WITH",
"relationshipdetails": {
"database4": "0",
"database3": "0",
"coexpression2": "49",
"coexpression3": "49",
"experimental": "120",
"database2": "0",
"combinedscore3": "190",
"combinedscore4": "190",
"experimental2": "120",
"combinedscore": "190",
"database": "0",
"combinedscore2": "190",
"experimental3": "120",
"experimental4": "120",
"coexpression4": "49",
"textmining3": "110",
"coexpression": "49",
"textmining4": "110",
"textmining2": "110",
"textmining": "110"
}
}
]
条件:where textmining >/</= 100 and coexpression >/</= 30 and combinedscore >/</= 250
数据必须根据大于/等于/小于条件的 5 个过滤器值(文本挖掘、共表达、实验、数据库和组合分数)进行过滤,所有这些都必须用作输入。
【问题讨论】:
-
请更具体。你在过滤什么?举几个输入输出的例子。
-
条件是什么?更清楚。 >/// 是什么意思?
-
这是一个对象数组。你可以使用Array.prototype.filter 做你想做的事。
-
顺便说一句,那些不是对象,它是 JSON @Archer
-
@Kevin.a JSON 是一种文本格式。一旦你从任何地方获取数据,它就是一个对象数组。
标签: javascript node.js express filter