Skip to content

Commit

Permalink
Add tests for genelist
Browse files Browse the repository at this point in the history
  • Loading branch information
akikuno committed Mar 1, 2025
1 parent 197e695 commit 9df8cb0
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 0 deletions.
84 changes: 84 additions & 0 deletions tests/gene_list/Asxl1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[ {
"data": {
"id": "Asxl1",
"label": "Asxl1",
"node_color": 1,
"annotation": [
"abnormal cornea morphology (Hetero)",
"cornea opacity (Hetero)",
"decreased circulating glucose level (Hetero, \u2640)",
"decreased circulating iron level (Hetero, \u2640)",
"decreased hematocrit (Hetero, \u2640)",
"decreased hemoglobin content (Hetero)",
"decreased mean corpuscular hemoglobin (Hetero)",
"decreased mean corpuscular volume (Hetero)",
"decreased sacral vertebrae number (Hetero)",
"hyperactivity (Hetero)",
"impaired pupillary reflex (Hetero)",
"increased blood uric acid level (Hetero, \u2642)",
"increased bone mineral content (Hetero)",
"increased lumbar vertebrae number (Hetero)",
"preweaning lethality, complete penetrance (Homo)",
"vertebral fusion (Hetero)"
]
}
},
{
"data": {
"id": "Rab10",
"label": "Rab10",
"node_color": 0,
"annotation": [
"abnormal auditory brainstem response (Hetero)",
"decreased mean corpuscular hemoglobin (Hetero)",
"decreased mean corpuscular volume (Hetero)",
"embryonic lethality prior to organogenesis (Homo)",
"increased startle reflex (Hetero, \u2640)",
"iris synechia (Hetero)",
"preweaning lethality, complete penetrance (Homo)"
]
}
},
{
"data": {
"id": "Rev3l",
"label": "Rev3l",
"node_color": 0,
"annotation": [
"abnormal retina morphology (Hetero)",
"cataract (Hetero)",
"decreased blood urea nitrogen level (Hetero)",
"decreased circulating creatinine level (Hetero, \u2640)",
"decreased mean corpuscular volume (Hetero)",
"hyperactivity (Hetero)",
"hyperactivity (Hetero, \u2642)",
"increased mean corpuscular hemoglobin concentration (Hetero)",
"preweaning lethality, complete penetrance (Homo)"
]
}
},
{
"data": {
"source": "Asxl1",
"target": "Rab10",
"edge_size": 0.15,
"annotation": [
"decreased mean corpuscular hemoglobin (Hetero)",
"decreased mean corpuscular volume (Hetero)",
"preweaning lethality, complete penetrance (Homo)"
]
}
},
{
"data": {
"source": "Atp6v1b2",
"target": "Rab10",
"edge_size": 0.214,
"annotation": [
"decreased mean corpuscular hemoglobin (Hetero)",
"embryonic lethality prior to organogenesis (Homo)",
"preweaning lethality, complete penetrance (Homo)"
]
}
}
]
Empty file added tests/gene_list/Rab10.json
Empty file.
78 changes: 78 additions & 0 deletions tests/gene_list/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="ja">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON フィルタリング</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}

textarea {
width: 100%;
height: 150px;
}

pre {
background-color: #f4f4f4;
padding: 10px;
border-radius: 5px;
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>

<body>

<h1>JSONデータのフィルタリング</h1>

<label for="geneInput">遺伝子名(カンマ区切りで入力):</label>
<input type="text" id="geneInput" value="Asxl1, Rab10">
<button onclick="filterJson()">フィルタリング</button>

<h2>フィルタ結果</h2>
<pre id="output"></pre>

<script>
// JSONデータ
const jsonData = [
{
"data": { "id": "Asxl1", "label": "Asxl1", "node_color": 1 }
},
{
"data": { "id": "Rab10", "label": "Rab10", "node_color": 0 }
},
{
"data": { "id": "Rev3l", "label": "Rev3l", "node_color": 0 }
},
{
"data": { "source": "Asxl1", "target": "Rab10", "edge_size": 0.15 }
},
{
"data": { "source": "Atp6v1b2", "target": "Rab10", "edge_size": 0.214 }
}
];

function filterJson() {
// 入力された遺伝子名を取得し、配列に変換
const geneInput = document.getElementById("geneInput").value;
const geneKeys = new Set(geneInput.split(",").map(gene => gene.trim()));

// JSONデータをフィルタリング
const filteredData = jsonData.filter(item => {
const data = item.data;
return geneKeys.has(data.id) || geneKeys.has(data.source) || geneKeys.has(data.target);
});

// 結果を表示
document.getElementById("output").textContent = JSON.stringify(filteredData, null, 2);
}
</script>

</body>

</html>
9 changes: 9 additions & 0 deletions tests/gene_list/memo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

```bash
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | grep -n "Rab10"
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | grep -n "Asxl1"
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | head -n 50 | tail -n 50
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | head -n 450 | tail -n 50
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | head -n 800 | tail -n 50
zcat test-tsumugi/data/genesymbol/Asxl1.json.gz | head -n 950 | tail -n 50
```

0 comments on commit 9df8cb0

Please sign in to comment.