Skip to content

Instantly share code, notes, and snippets.

@BastinRobin
Last active August 29, 2015 14:10
Show Gist options
  • Save BastinRobin/d99c207388b7bbda0bd3 to your computer and use it in GitHub Desktop.
Save BastinRobin/d99c207388b7bbda0bd3 to your computer and use it in GitHub Desktop.
Sushant JSON
data = [
{
"Compound_id":133,
"Compound_name":"carbofuran",
"Protein_id":858,
"Protein_name":"CDs 1",
"Type":"possible",
"RScore":31,
"combination_id":"133_858"
},
{
"Compound_id":106,
"Compound_name":"azobenzene",
"Protein_id":858,
"Protein_name":"CDs 1",
"Type":"possible",
"RScore":31,
"combination_id":"106_858"
},
{
"Compound_id":312,
"Compound_name":"benzalkonium chloride",
"Protein_id":787,
"Protein_name":"VDAC",
"Type":"reliable",
"RScore":85,
"combination_id":"312_787"
},
{
"Compound_id":1341,
"Compound_name":"rotenone",
"Protein_id":787,
"Protein_name":"VDAC",
"Type":"possible",
"RScore":35,
"combination_id":"1341_787"
},
{
"Compound_id":1403,
"Compound_name":"naphthalene",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"reliable",
"RScore":174,
"combination_id":"1403_764"
},
{
"Compound_id":309,
"Compound_name":"sulfur",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"reliable",
"RScore":124,
"combination_id":"309_764"
},
{
"Compound_id":1392,
"Compound_name":"carbon tetrachloride",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"reliable",
"RScore":86,
"combination_id":"1392_764"
},
{
"Compound_id":477,
"Compound_name":"biphenyl",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"reliable",
"RScore":82,
"combination_id":"477_764"
},
{
"Compound_id":348,
"Compound_name":"formaldehyde",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":75,
"combination_id":"348_764"
},
{
"Compound_id":730,
"Compound_name":"OCH",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":67,
"combination_id":"730_764"
},
{
"Compound_id":1404,
"Compound_name":"phosphine",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":47,
"combination_id":"1404_764"
},
{
"Compound_id":1391,
"Compound_name":"carbon disulfide",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":38,
"combination_id":"1391_764"
},
{
"Compound_id":1808,
"Compound_name":"sulfoxide",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":35,
"combination_id":"1808_764"
},
{
"Compound_id":1084,
"Compound_name":"paraquat",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"possible",
"RScore":32,
"combination_id":"1084_764"
},
{
"Compound_id":1393,
"Compound_name":"chloroform",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"unreliable",
"RScore":30,
"combination_id":"1393_764"
},
{
"Compound_id":1400,
"Compound_name":"hydrogen cyanide",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"unreliable",
"RScore":19,
"combination_id":"1400_764"
},
{
"Compound_id":968,
"Compound_name":"sulfuric acid",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"unreliable",
"RScore":12,
"combination_id":"968_764"
},
{
"Compound_id":1402,
"Compound_name":"methylene chloride",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"unreliable",
"RScore":8,
"combination_id":"1402_764"
},
{
"Compound_id":1242,
"Compound_name":"cyanamide",
"Protein_id":764,
"Protein_name":"MP2",
"Type":"unreliable",
"RScore":6,
"combination_id":"1242_764"
}
];
// Create Empty ARRAY
result = [];
// Possibilities array
check = ['unacceptable','unreliable','unreliable','possible','unacceptable','impossible','nottrustable','trustable'];
// Iterate the data JSON array
_.each(data, function(d) {
if(_.contains(check, d.Type)) {
result.push(d);
}
});
// Get result in result array
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment