Skip to content

Commit

Permalink
Add jsonParse to jexl
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 12, 2024
1 parent 94dfbd9 commit 49098e6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/util/jexl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default function (/* config?: any*/): JexlNonBuildable {
)
j.addFunction('toLowerCase', (s: string) => s.toLowerCase())
j.addFunction('toUpperCase', (s: string) => s.toUpperCase())
j.addFunction('jsonParse', (s: string) => JSON.parse(s))
j.addFunction('trim', (s: string) => s.trim())
j.addFunction('trimEnd', (s: string) => s.trimEnd())
j.addFunction('trimStart', (s: string) => s.trimStart())
Expand Down
33 changes: 33 additions & 0 deletions products/jbrowse-web/src/__snapshots__/jbrowseModel.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,39 @@ exports[`JBrowse model creates with non-empty snapshot 1`] = `
"trackId": "volvox_sv",
"type": "AlignmentsTrack",
},
{
"adapter": {
"gffLocation": {
"internetAccountId": undefined,
"internetAccountPreAuthorization": undefined,
"locationType": "UriLocation",
"uri": "volvox.sort.gff3",
},
"type": "Gff3Adapter",
},
"assemblyNames": [
"volvox",
],
"category": [
"Miscellaneous",
],
"displays": [
{
"displayId": "gff3_genes-LinearBasicDisplay",
"type": "LinearBasicDisplay",
},
{
"displayId": "gff3_genes-LinearArcDisplay",
"type": "LinearArcDisplay",
},
],
"formatDetails": {
"feature": "jexl:{table:jsonParse(feature.table)}",
},
"name": "GFF3 genes",
"trackId": "gff3_genes",
"type": "FeatureTrack",
},
{
"adapter": {
"gffGzLocation": {
Expand Down
18 changes: 18 additions & 0 deletions test_data/volvox/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,24 @@
}
}
},
{
"type": "FeatureTrack",
"trackId": "gff3_genes",
"assemblyNames": ["volvox"],
"name": "GFF3 genes",
"formatDetails": {
"feature": "jexl:{table:jsonParse(feature.table)}"
},
"category": ["Miscellaneous"],
"adapter": {
"type": "Gff3Adapter",
"gffLocation": {
"uri": "volvox.sort.gff3",
"locationType": "UriLocation"
}
}
},

{
"type": "FeatureTrack",
"trackId": "gff3tabix_genes",
Expand Down
2 changes: 1 addition & 1 deletion test_data/volvox/volvox.sort.gff3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# multi-exon gene - several linked CDSs
# single exon gene - one CDS only
##gff-version 3
ctgA example contig 1 50001 . . . Name=ctgA;multivalue=val1,val2,val3
ctgA example contig 1 50001 . . . Name=ctgA;multivalue=val1,val2,val3;table=%5B%7B%22name%22%3A%22hello1%22%2C%22value%22%3A1%7D%2C%7B%22name%22%3A%22hello2%22%2C%22value%22%3A2%7D%2C%7B%22name%22%3A%22hello3%22%2C%22value%22%3A3%7D%2C%7B%22name%22%3A%22hello4%22%2C%22value%22%3A4%7D%2C%7B%22name%22%3A%22hello5%22%2C%22value%22%3A5%7D%5D
ctgA example BAC 1000 20000 . . . ID=b101.2;Name=b101.2;Note=Fingerprinted BAC with end reads
ctgA example SNP 1000 1000 0.987 . . ID=FakeSNP1;Name=FakeSNP;Note=This is a fake SNP that should appear at 1000 with length 1
ctgA example clone_start 1000 1500 . + . Parent=b101.2
Expand Down

0 comments on commit 49098e6

Please sign in to comment.