Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankbrgowda committed Aug 20, 2024
2 parents 3044ad6 + c5434ce commit 8f99105
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 880 deletions.
877 changes: 1 addition & 876 deletions packages/apollo-cli/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/apollo-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"yaml": "^2.3.4"
},
"devDependencies": {
"@apollo-annotation/shared": "workspace:^",
"@istanbuljs/esm-loader-hook": "^0.2.0",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@oclif/test": "^3.1.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/apollo-cli/src/commands/feature/import.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'node:fs'

import { type SerializedAddFeaturesFromFileChange } from '@apollo-annotation/shared'
import { Flags } from '@oclif/core'
import { Agent, RequestInit, fetch } from 'undici'

Expand Down Expand Up @@ -69,7 +70,7 @@ export default class Import extends BaseCommand<typeof Import> {
'text/x-gff3',
)

const body = {
const body: SerializedAddFeaturesFromFileChange = {
typeName: 'AddFeaturesFromFileChange',
assembly: assembly[0],
fileId: uploadId,
Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress/e2e/editFeature.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
describe('Different ways of editing features', () => {
before(() => {
cy.deleteAssemblies()
cy.wrap(
window.indexedDB.databases().then((dbs) => {
for (const db of dbs) {
if (db.name) {
window.indexedDB.deleteDatabase(db.name)
}
}
}),
)
cy.addOntologies()
})

Expand Down
49 changes: 49 additions & 0 deletions packages/jbrowse-plugin-apollo/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IDBPDatabase, openDB } from 'idb'

Cypress.Commands.add('loginAsGuest', () => {
cy.visit('/?config=http://localhost:3999/jbrowse/config.json')
cy.contains('Linear Genome View', { timeout: 10_000 }).click()
Expand All @@ -16,6 +18,47 @@ Cypress.Commands.add('deleteAssemblies', () => {
}
})

type OntologyKey = 'nodes' | 'edges' | 'meta'

async function loadOntology(
ontologyGZip: Buffer,
name: string,
version: number,
) {
const blob = new Blob([ontologyGZip])
const ds = new DecompressionStream('gzip')
const decompressedStream = blob.stream().pipeThrough(ds)
const ontologyBlob = await new Response(decompressedStream).blob()
const ontologyJSON = await ontologyBlob.text()
const ontologyData = JSON.parse(ontologyJSON) as Record<
OntologyKey,
unknown[]
>
await openDB(name, version, {
async upgrade(database: IDBPDatabase): Promise<void> {
const meta = database.createObjectStore('meta')
await meta.add(ontologyData.meta[0], 'meta')
const nodes = database.createObjectStore('nodes', { keyPath: 'id' })
nodes.createIndex('by-label', 'lbl')
nodes.createIndex('by-type', 'type')
nodes.createIndex('by-synonym', ['meta', 'synonyms', 'val'])
nodes.createIndex('full-text-words', 'fullTextWords', {
multiEntry: true,
})
for (const node of ontologyData.nodes) {
await nodes.add(node)
}
const edges = database.createObjectStore('edges', { autoIncrement: true })
edges.createIndex('by-subject', 'sub')
edges.createIndex('by-object', 'obj')
edges.createIndex('by-predicate', 'pred')
for (const edge of ontologyData.edges) {
await edges.add(edge)
}
},
})
}

Cypress.Commands.add('addOntologies', () => {
cy.deleteMany({}, { collection: 'jbrowseconfigs' })
cy.insertOne(
Expand Down Expand Up @@ -45,6 +88,12 @@ Cypress.Commands.add('addOntologies', () => {
},
{ collection: 'jbrowseconfigs' },
)
cy.readFile('cypress/data/go.json.gz', null).then((goGZip: Buffer) => {
cy.wrap<Promise<void>>(
loadOntology(goGZip, 'Apollo Ontology "Gene Ontology" "full"', 2),
{ timeout: 120_000 },
)
})
})

Cypress.Commands.add('addAssemblyFromGff', (assemblyName, fin) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const OntologyRecordType = types
addDisposer(
self,
autorun(() => {
// this.initDataStore()
this.initDataStore()
}),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export function clientDataStoreFactory(
afterCreate() {
addDisposer(
self,
autorun((reaction) => {
autorun(() => {
// Merge in the ontologies from our plugin configuration.
// Ontologies of a given name that are already in the session
// take precedence over the ontologies in the configuration.
Expand Down Expand Up @@ -171,7 +171,6 @@ export function clientDataStoreFactory(
}
// TODO: add in any configured ontology prefixes that we don't already
// have in the session (or hardcoded in the model)
reaction.dispose()
}),
)
},
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@apollo-annotation/cli@workspace:packages/apollo-cli"
dependencies:
"@apollo-annotation/shared": "workspace:^"
"@inquirer/input": "npm:^1.2.14"
"@inquirer/password": "npm:^1.1.14"
"@inquirer/select": "npm:^1.3.1"
Expand Down

0 comments on commit 8f99105

Please sign in to comment.