Skip to content

Commit 2c40840

Browse files
authored
Merge pull request #2231 from broadinstitute/jlc_ontology_colon_fix
Correctly allow colon separator in ontology IDs (SCP-5861)
2 parents aab7c6b + 3ff7b0c commit 2c40840

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

app/javascript/lib/validation/validate-anndata.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,16 @@ async function checkOntologyLabelsAndIds(key, ontologies, groups) {
137137
const rawUniques = Array.from(labelIdPairs)
138138

139139
rawUniques.map(r => {
140-
const [id, label] = r.split(' || ')
140+
let [id, label] = r.split(' || ')
141141
const ontologyShortNameLc = id.split(/[_:]/)[0].toLowerCase()
142142
const ontology = ontologies[ontologyShortNameLc]
143143

144+
if (id.includes(':')) {
145+
// Convert colon to underscore for ontology lookup
146+
const idParts = id.split(':')
147+
id = `${idParts[0]}_${idParts[1]}`
148+
}
149+
144150
if (!(id in ontology)) {
145151
// Register invalid ontology ID
146152
const msg = `Invalid ontology ID: ${id}`

test/js/lib/validate-anndata.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ describe('Client-side file validation for AnnData', () => {
5656
expect(issues).toHaveLength(0)
5757
})
5858

59+
/* TODO: Uncomment this after PR merge
60+
it('Parses AnnData rows with colon ontology ID separator and detects no issues', async () => {
61+
const url = `${BASE_URL}/valid_with_colon.h5ad`
62+
const parseResults = await parseAnnDataFile(url)
63+
expect(parseResults.issues).toHaveLength(0)
64+
})
65+
*/
66+
5967
it('Parses AnnData rows and reports invalid ontology IDs', async () => {
6068
const url = `${BASE_URL}/invalid_disease_id.h5ad`
6169
const parseResults = await parseAnnDataFile(url)
50 KB
Binary file not shown.

0 commit comments

Comments
 (0)