Skip to content

Commit

Permalink
Merge pull request #28 from zprobot/main
Browse files Browse the repository at this point in the history
update: gene
  • Loading branch information
ypriverol authored Mar 12, 2024
2 parents 95219b5 + 6f50042 commit 5823076
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
Binary file not shown.
1 change: 0 additions & 1 deletion public/data/proteinTable.json

This file was deleted.

Binary file removed public/data/proteinTable.json.gz
Binary file not shown.
Binary file added public/data/tissueJson.json.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions src/api/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export const queryKey = (proteinName) => {
export const getProteins = () => {
return request({
method: 'get',
url: '/data/proteinTable.json.gz',
url: '/data/tissueJson.json.gz',
responseType: 'arraybuffer'
})
}

export const getCellLineProteins = () => {
return request({
method: 'get',
url: '/data/Cell_lines_IBAQ.json.gz',
url: '/data/cellJson.json.gz',
responseType: 'arraybuffer'
})
}
22 changes: 13 additions & 9 deletions src/components/AeShow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import { getProteins,getCellLineProteins } from '@/api/search'
import { inflate } from 'pako'
import * as echarts from 'echarts'
import {useRouter, onBeforeRouteUpdate} from "vue-router";
import { ref, onMounted, nextTick } from 'vue'
import { ref, onMounted, nextTick,computed } from 'vue'
import {getBoxTooltips,options} from './option'
const router = useRouter();
const drawer = ref(false)
Expand All @@ -84,6 +84,9 @@ const protein = ref([])
const sortTags = ref([])
// tags
const proteinTags = ref([])
const tags = computed(() => {
return proteinTags.value.map((item)=>item.split('(')[0])
})
// tags color
const tagsColor = ["#8DD3C7", "#EDBC63", "#BEBADA", "#FB8072", "#80B1D3"]
// map html
Expand Down Expand Up @@ -129,7 +132,7 @@ const getProteinTable = async () => {
const handleClose = (tag) => {
dataHistory.value.splice(proteinTags.value.indexOf(tag), 1)
proteinTags.value.splice(proteinTags.value.indexOf(tag), 1)
routerName.value ==='tissues' ? router.push({ path: "/ae/tissues", query: { protein: proteinTags.value } }) : router.push({ path: "/ae/cellline", query: { protein: proteinTags.value } })
routerName.value ==='tissues' ? router.push({ path: "/ae/tissues", query: { protein: tags.value } }) : router.push({ path: "/ae/cellline", query: { protein: tags.value} })
}
// qeury
const queryProtein = (input) => {
Expand All @@ -142,26 +145,27 @@ const queryProtein = (input) => {
let proteins = proteinTable
input.value.map((protein) => {
const output = proteins.find((item) => {
return item.name === protein.trim()
return item.name === protein.trim() || item.gene_name === protein.trim()
})
if (!output) {
alert('Please enter a legal protein name')
return
}
if (!proteinTags.value.includes(protein.trim())) {
let tag = `${output.name}(${output.gene_name})`
if (!proteinTags.value.includes(tag.trim())) {
if (proteinTags.value.length === 5) {
proteinTags.value.shift()
proteinTags.value.push(protein.trim())
proteinTags.value.push(tag)
dataHistory.value.shift()
dataHistory.value.push(output)
} else {
proteinTags.value.push(protein.trim())
proteinTags.value.push(tag)
dataHistory.value.push(output)
}
}
})
if (proteinTags.value.length != input.value.length) {
routerName.value ==='tissues' ? router.push({ path: "/ae/tissues", query: { protein: proteinTags.value } }) : router.push({ path: "/ae/cellline", query: { protein: proteinTags.value } })
routerName.value ==='tissues' ? router.push({ path: "/ae/tissues", query: { protein: tags.value } }) : router.push({ path: "/ae/cellline", query: { protein: tags.value } })
//router.push({ path: "/ae/tissues", query: { protein: proteinTags.value } })
} else {
showImg.value = true
Expand Down Expand Up @@ -424,7 +428,7 @@ const init = () => {
height: imgH
})
myChart.setOption(options)
setTimeout(() => {
nextTick(() => {
if (protein.value.length !== 0) {
let imgDataUrl = myChart.getDataURL({
type: 'svg',
Expand All @@ -438,7 +442,7 @@ const init = () => {
}
imgs.value.unshift(urlFile)
}
}, 2000)
})
}
// count single value
const countSingleValue = (data, dimension) => {
Expand Down

0 comments on commit 5823076

Please sign in to comment.