Skip to content

Commit

Permalink
Merge pull request #21 from germinateplatform/uav-support
Browse files Browse the repository at this point in the history
Uav support
  • Loading branch information
sebastian-raubach authored Oct 31, 2022
2 parents fad8daa + 6409396 commit f20236d
Show file tree
Hide file tree
Showing 38 changed files with 3,602 additions and 204 deletions.
1,924 changes: 1,882 additions & 42 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "germinate",
"version": "4.4.2",
"version": "4.5.0",
"description": "Germinate is an open source plant database infrastructure and application programming platform on which complex data from genetic resource collections can be stored, queried and visualized",
"author": "Sebastian Raubach",
"scripts": {
Expand All @@ -14,6 +14,7 @@
"bootstrap": "~4.6.1",
"bootstrap-vue": "~2.22.0",
"bootswatch": "~4.6.1",
"buffer": "^6.0.3",
"citation-js": "~0.5.7",
"core-js": "~3.8.3",
"d3-dsv": "~3.0.1",
Expand All @@ -28,6 +29,7 @@
"leaflet.sync": "~0.2.4",
"path-browserify": "~1.0.1",
"plotly.js-dist-min": "^2.15.0",
"shpjs": "^4.0.4",
"simplex-noise": "~2.4.0",
"tiny-emitter": "~2.1.0",
"vis-data": "^7.1.4",
Expand Down Expand Up @@ -61,6 +63,7 @@
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~5.1.0",
"eslint-plugin-vue": "~8.0.3",
"node-polyfill-webpack-plugin": "^2.0.1",
"querystring-es3": "~0.2.1",
"sass": "~1.32.7",
"sass-loader": "~12.0.0",
Expand Down
114 changes: 114 additions & 0 deletions public/img/tools/helium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/components/charts/BaseChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export default {
if (this.imageType === 'svg') {
downloadSvgsFromContainer(this.$slots.chart[0].elm, this.chartType === 'plotly', this.userFilename + '-' + getDateTimeString())
} else if (this.imageType === 'png') {
Plotly.downloadImage(this.$slots.chart[0].elm, { format: 'png', width: this.width(), height: this.height(), filename: this.userFilename + '-' + getDateTimeString() })
const container = this.$slots.chart[0].elm
const chart = container.classList.contains('js-plotly-plot') ? container : container.querySelector('.js-plotly-plot')
Plotly.downloadImage(chart, { format: 'png', width: this.width(), height: this.height(), filename: this.userFilename + '-' + getDateTimeString() })
}
},
chartColorsChangedHandler: function () {
Expand Down
53 changes: 27 additions & 26 deletions src/components/charts/BoxplotChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { mdiHelpCircleOutline } from '@mdi/js'
const Plotly = require('plotly.js-dist-min')
let plotData = null
export default {
props: {
datasetIds: {
Expand Down Expand Up @@ -67,7 +69,6 @@ export default {
return {
mdiHelpCircleOutline,
id: id,
plotData: null,
loading: false,
xTypes: {
traits: {
Expand Down Expand Up @@ -102,7 +103,7 @@ export default {
]),
baseSourceFile: function () {
return {
blob: new Blob([JSON.stringify(this.plotData)], { type: 'application/json' }),
blob: new Blob([JSON.stringify(plotData)], { type: 'application/json' }),
filename: this.baseFilename,
extension: 'json'
}
Expand All @@ -125,15 +126,15 @@ export default {
if (this.chartMode === 'itemByGroup') {
const groups = []
this.plotData.stats.forEach(s => {
plotData.stats.forEach(s => {
if (groups.indexOf(s.groupIds) === -1) {
groups.push(s.groupIds)
}
})
return 200 + this.plotData[this.xTypes[this.xType].itemKey].length * 30 * groups.length
return 200 + plotData[this.xTypes[this.xType].itemKey].length * 30 * groups.length
} else {
return 200 + this.plotData[this.xTypes[this.xType].itemKey].length * 30 * this.plotData.datasets.length
return 200 + plotData[this.xTypes[this.xType].itemKey].length * 30 * plotData.datasets.length
}
},
redraw: function () {
Expand All @@ -147,7 +148,7 @@ export default {
}
apiPostTraitStats(this.xTypes[this.xType].apiKey, query, result => {
this.plotData = result
plotData = result
this.chart()
this.loading = false
})
Expand All @@ -161,17 +162,17 @@ export default {
// Are we plotting datasets and grouping by trait/climate?
if (this.chartMode === 'datasetByItem') {
Object.keys(this.plotData.datasets).forEach(dataset => {
Object.keys(plotData.datasets).forEach(dataset => {
for (let i = 0; i < 6; i++) {
// If so, datasets are our Ys
y.push(this.plotData.datasets[dataset].datasetName)
y.push(plotData.datasets[dataset].datasetName)
}
})
} else if (this.chartMode === 'itemByDataset' || this.chartMode === 'itemByGroup') {
Object.keys(this.plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
Object.keys(plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
for (let j = 0; j < 6; j++) {
// Else, use this complicated thing to extract the trait/climate name
y.push(this.plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].nameKey])
y.push(plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].nameKey])
}
})
}
Expand Down Expand Up @@ -226,7 +227,7 @@ export default {
const groups = []
this.plotData.stats.forEach(s => {
plotData.stats.forEach(s => {
if (groups.indexOf(s.groupIds) === -1) {
groups.push(s.groupIds)
}
Expand All @@ -235,9 +236,9 @@ export default {
groups.forEach((group, index) => {
const x = []
Object.keys(this.plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = this.plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
const itemData = this.plotData.stats.filter(s => s.groupIds === group && s.xId === itemId)[0]
Object.keys(plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
const itemData = plotData.stats.filter(s => s.groupIds === group && s.xId === itemId)[0]
if (itemData) {
// This trait/climate by group combination is available, add all the information
Expand Down Expand Up @@ -274,13 +275,13 @@ export default {
},
getData: function (y) {
const traces = []
Object.keys(this.plotData.datasets).forEach(dataset => {
const datasetId = this.plotData.datasets[dataset].datasetId
Object.keys(plotData.datasets).forEach(dataset => {
const datasetId = plotData.datasets[dataset].datasetId
const x = []
Object.keys(this.plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = this.plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
const itemData = this.plotData.stats.filter(s => s.datasetId === datasetId && s.xId === itemId)[0]
Object.keys(plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
const itemData = plotData.stats.filter(s => s.datasetId === datasetId && s.xId === itemId)[0]
if (itemData) {
// This trait/climate by dataset combination is available, add all the information
Expand All @@ -304,7 +305,7 @@ export default {
traces.push({
x: x,
y: y,
name: this.plotData.datasets[dataset].datasetName,
name: plotData.datasets[dataset].datasetName,
marker: { color: getColor(dataset) },
type: 'box',
boxmean: false,
Expand All @@ -316,13 +317,13 @@ export default {
},
getInvertedData: function (y) {
const traces = []
Object.keys(this.plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = this.plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
Object.keys(plotData[this.xTypes[this.xType].itemKey]).forEach(item => {
const itemId = plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].idKey]
const x = []
Object.keys(this.plotData.datasets).forEach(d => {
const datasetId = this.plotData.datasets[d].datasetId
const datasetData = this.plotData.stats.filter(s => s.xId === itemId && s.datasetId === datasetId)[0]
Object.keys(plotData.datasets).forEach(d => {
const datasetId = plotData.datasets[d].datasetId
const datasetData = plotData.stats.filter(s => s.xId === itemId && s.datasetId === datasetId)[0]
if (datasetData && datasetData.min !== datasetData.max) {
// This dataset by trait/climate combination is available, add all the information
Expand All @@ -346,7 +347,7 @@ export default {
traces.push({
x: x,
y: y,
name: this.plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].nameKey],
name: plotData[this.xTypes[this.xType].itemKey][item][this.xTypes[this.xType].nameKey],
marker: { color: getColor(item) },
type: 'box',
boxmean: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/charts/MatrixChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default {
.call(plotlyScatterMatrix(Plotly)
.darkMode(this.storeDarkMode)
.colorBy(colorBy)
.columnsToIgnore(['name', 'puid', 'taxonomy', 'latitude', 'longitude', 'elevation', 'germplasm_synonyms', 'entity_parent_name', 'entity_parent_general_identifier', 'rep', 'block', 'dbId', 'general_identifier', 'dataset_name', 'dataset_description', 'dataset_version', 'license_name', 'location_name', 'trial_site', 'Site', 'treatments_description', 'year', 'group_ids'])
.columnsToIgnore(['name', 'puid', 'taxonomy', 'latitude', 'longitude', 'elevation', 'germplasm_synonyms', 'entity_parent_name', 'entity_parent_general_identifier', 'rep', 'block', 'trial_row', 'trial_column', 'dbId', 'general_identifier', 'dataset_name', 'dataset_description', 'dataset_version', 'license_name', 'location_name', 'trial_site', 'Site', 'treatments_description', 'year', 'group_ids'])
.onPointClicked(p => {
// For trials we show the passport page on click
if (this.datasetType === 'trials') {
Expand Down
15 changes: 9 additions & 6 deletions src/components/charts/PedigreeChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</b-form-select>
</b-form-group>

<div v-if="plotData">
<div v-if="hasPlotData">
<BaseChart :id="id" :width="() => 1280" :height="() => 600" :filename="baseFilename" chartType="d3.js" v-on:resize="update" :supportsPngDownload="false" :supportsSvgDownload="false" v-on:force-redraw="update">
<div id="pedigree-chart" slot="chart" ref="pedigreeChart" class="pedigree-chart" />

Expand Down Expand Up @@ -57,6 +57,8 @@ import { Pages } from '@/mixins/pages'
const emitter = require('tiny-emitter/instance')
let plotData = null
export default {
props: {
germplasm: {
Expand All @@ -74,7 +76,7 @@ export default {
mdiDownload,
mdiFileImage,
id: id,
plotData: null,
hasPlotData: false,
dataset: null,
datasets: [],
popoverContent: [{
Expand Down Expand Up @@ -143,11 +145,11 @@ export default {
this.$refs.pedigreeChart.firstChild.remove()
}
if (this.plotData) {
if (plotData) {
const nodes = {}
const connections = []
this.plotData.forEach(r => {
plotData.forEach(r => {
nodes[r.childId] = {
id: r.childId,
name: r.childName,
Expand All @@ -160,7 +162,7 @@ export default {
}
})
this.plotData.forEach(r => {
plotData.forEach(r => {
let edgeColor = '#999999'
if (r.relationshipType === 'F') {
edgeColor = '#e74c3c'
Expand Down Expand Up @@ -293,7 +295,8 @@ export default {
apiPostPedigreeTable(query, result => {
if (result && result.data && result.data.length > 0) {
this.plotData = result.data
plotData = result.data
this.hasPlotData = true
this.update()
}
Expand Down
Loading

0 comments on commit f20236d

Please sign in to comment.