Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve map access #275

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<el-button @click="setMultiFlatmap()" size="small">Set MultiFlatmap</el-button>
<el-button @click="setLegacyMultiFlatmap()" size="small">Set Legacy MultiFlatmap</el-button>
<el-button @click="setScaffold()" size="small">Set To Scaffold</el-button>
<el-button @click="setWholebody()" size="small">Set to Wholebody</el-button>
<el-button @click="setFlatmap()" size="small">Set Flatmap</el-button>
<el-button @click="setSearch()" size="small">Set Search</el-button>
</el-row>
Expand Down Expand Up @@ -165,6 +166,15 @@ export default {
}
);
},
setWholebody: function() {
this.$refs.map.setCurrentEntry(
{
type: "Scaffold",
label: "Human",
isBodyScaffold: true
}
);
},
setSearch: function() {
this.$refs.map.openSearch([], "10.26275/1uno-tynt");
},
Expand Down
91 changes: 53 additions & 38 deletions src/components/MapContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { useSettingsStore } from '../stores/settings';
import { useSplitFlowStore } from '../stores/splitFlow';
import { findSpeciesKey } from './scripts/utilities.js';
import { MapSvgSpriteColor} from '@abi-software/svg-sprite';
import { initialState } from "./scripts/utilities.js";
import { initialState, getBodyScaffoldInfo } from "./scripts/utilities.js";
import RetrieveContextCardMixin from "../mixins/RetrieveContextCardMixin.js"
import {
ElLoading as Loading
Expand Down Expand Up @@ -201,7 +201,7 @@ export default {
*/
setCurrentEntry: async function(state) {
if (state && state.type) {
if (state.type === "Scaffold" && state.url) {
if (state.type === "Scaffold" && (state.url || state.isBodyScaffold)) {
//State for scaffold containing the following items:
// label - Setting the name of the dialog
// region - Which region/group currently focusing on
Expand All @@ -216,52 +216,67 @@ export default {
state: state.state,
viewUrl: state.viewUrl
};
// Add content from scicrunch for the context card
const contextCardInfo = await this.retrieveContextCardFromUrl(state.url);
newView = {...newView, ...contextCardInfo};
if (state.isBodyScaffold) {
const data = await getBodyScaffoldInfo(this.options.sparcApi, state.label);
newView = { ...newView, ...data.datasetInfo, resource: data.url };
} else {
// Add content from scicrunch for the context card
const contextCardInfo = await this.retrieveContextCardFromUrl(state.url);
newView = { ...newView, ...contextCardInfo };
}
this.$refs.flow.createNewEntry(newView);
} else if (state.type === "MultiFlatmap") {
//State for scaffold containing the following items:
// label - Setting the name of the dialog
// taxo - taxo of species to set
// biologicalSex - biological sex to be displayed (PATO)
// organ - Target organ, flatmap will conduct a local search
// using this

//Look for the key in the available species array,
//it will use the taxo and biologicalSex as hints.
const key = findSpeciesKey(state);
if (key) {
const currentState = this.getState();
if (currentState && currentState.entries) {
for (let i = 0; i < currentState.entries.length; i++) {
const entry = currentState.entries[i];
if (entry.type === "MultiFlatmap") {
entry.resource = key;
entry.state = {species: key};
if (state.organ || state.uuid) {
entry.state.state = { searchTerm: state.organ, uuid: state.uuid };
//if it contains an uuid, use the taxo to help identify if the uuid
//is current
if (state.uuid) entry.state.state.entry = state.taxo;
if (state.resource) {
//State for new multiflatmap containing the following items:
// label - Setting the name of the dialog
// resource - the url to metadata
// state - state to restore (viewport)
const newView = {
type: state.type,
resource: state.resource,
state: state.state,
label: state.label
};
this.$refs.flow.createNewEntry(newView);
} else {
//State for multiflatmap containing the following items:
// taxo - taxo of species to set
// biologicalSex - biological sex to be displayed (PATO)
// organ - Target organ, flatmap will conduct a local search
// using this

//Look for the key in the available species array,
//it will use the taxo and biologicalSex as hints.
const key = findSpeciesKey(state);
if (key) {
const currentState = this.getState();
if (currentState && currentState.entries) {
for (let i = 0; i < currentState.entries.length; i++) {
const entry = currentState.entries[i];
if (entry.type === "MultiFlatmap") {
entry.resource = key;
entry.state = { species: key };
if (state.organ || state.uuid) {
entry.state.state = { searchTerm: state.organ, uuid: state.uuid };
//if it contains an uuid, use the taxo to help identify if the uuid
//is current
if (state.uuid) entry.state.state.entry = state.taxo;
}
this.$refs.flow.setState(currentState);
//Do not create a new entry, instead set the multiflatmap viewer
//to the primary slot
this.$refs.flow.setIdToPrimaryPane(entry.id);
break;
}
this.$refs.flow.setState(currentState);
//Do not create a new entry, instead set the multiflatmap viewer
//to the primary slot
this.$refs.flow.setIdToPrimaryPane(entry.id);
break;
}
}
}
}
}
else if (state.type === "Flatmap") {
//State for scaffold containing the following items:
} else if (state.type === "Flatmap") {
//State for flatmap containing the following items:
// label - Setting the name of the dialog
// region - Which region/group currently focusing on
// resource - the url to metadata
// state - state to restore (viewport)
// viewUrl - relative path of the view file to metadata
const newView = {
type: state.type,
resource: state.resource,
Expand Down