Skip to content

Commit

Permalink
ADD skeleton for GB
Browse files Browse the repository at this point in the history
  • Loading branch information
eboileau committed Jul 15, 2024
1 parent c8a7236 commit 066fcb8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
13 changes: 10 additions & 3 deletions client/src/utils/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ export const updSelectionFromAll = (selection, slctMod, slctOrg, slctTech) => {
idsTech.includes(item.technology_id)
)
let selection_id = opts.map((item) => item.selection_id)
let taxid = [...new Set(opts.map((item) => item.taxa_id))]
// there should be only one RNA type, bt we don't check...
let taxaId = [...new Set(opts.map((item) => item.taxa_id))]
let taxaName = [...new Set(opts.map((item) => item.taxa_name))]
// there should be only one, but we don't check...
let rna = [...new Set(opts.map((item) => item.rna))]
return { selection: selection_id, technology: idsTech, taxid: taxid[0], rna: rna[0] }
return {
selection: selection_id,
technology: idsTech,
taxaId: taxaId[0],
taxaName: taxaName[0],
rna: rna[0]
}
}
36 changes: 31 additions & 5 deletions client/src/views/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const selectedTechnologyIds = ref([])
const organism = ref()
const selectedOrganism = ref()
const selectionIds = ref([])
const taxid = ref()
const taxaId = ref()
const taxaName = ref()
const genes = ref()
const selectedGene = ref()
const filteredGenes = ref()
Expand Down Expand Up @@ -115,15 +116,16 @@ const updateSelection = () => {
)
selectedTechnologyIds.value = result.technology
selectionIds.value = result.selection
taxid.value = result.taxid
taxaId.value = result.taxaId
taxaName.value = result.taxaName
rnaType.value = result.rna
if (selectionIds.value.length == 0) {
// handle the case where all checkboxes are unticked
selectedTechnology.value = undefined
chroms.value = undefined
} else {
// get chrom.sizes
HTTP.get(`/chroms/${taxid.value}`)
HTTP.get(`/chroms/${taxaId.value}`)
.then(function (response) {
chroms.value = response.data
})
Expand Down Expand Up @@ -225,6 +227,10 @@ function isAnyExtraSelected() {
return selectedGene.value != null || selectedChrom.value != null
}
function addOne(value) {
return value + 1
}
function lazyLoad(event) {
loading.value = true
lazyParams.value = { ...lazyParams.value, first: event?.first || first.value }
Expand All @@ -250,7 +256,7 @@ function lazyLoad(event) {
organism: selectedOrganism.value.key,
technology: selectedTechnologyIds.value,
rnaType: rnaType.value,
taxid: taxid.value,
taxaId: taxaId.value,
geneFilter: fmtFilter(filters),
chrom: selectedChrom.value == null ? null : selectedChrom.value.chrom,
chromStart: selectedChromStart.value == null ? 0 : selectedChromStart.value,
Expand Down Expand Up @@ -500,7 +506,27 @@ onMounted(() => {
<ProgressSpinner style="width: 60px; height: 60px" strokeWidth="6" />
</template>
<Column field="chrom" header="Chrom" sortable exportHeader="chrom"></Column>
<Column field="start" header="Start" sortable exportHeader="chromStart"></Column>
<Column field="start" header="Start" sortable exportHeader="chromStart">
<template #body="{ data }">
<a
class="text-primary-500 hover:text-secondary-500"
:href="
'https://www.ensembl.org/' +
taxaName.replace(/ /g, '_') +
'/Location/View?r=' +
data.chrom +
':' +
data.start +
'-' +
addOne(data.end) +
';db=core'
"
target="_blank"
rel="noopener noreferrer"
>{{ data.start }}
</a>
</template>
</Column>
<Column field="end" header="End" exportHeader="chromEnd"></Column>
<Column field="name" header="Name" exportHeader="name">
<template #body="{ data }">
Expand Down
2 changes: 1 addition & 1 deletion server/src/scimodom/api/modification.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_modifications():
organism_id = request.args.get("organism", type=int)
technology_ids = request.args.getlist("technology", type=int)
rna_type = request.args.get("rnaType", type=str)
taxa_id = request.args.get("taxid", type=int)
taxa_id = request.args.get("taxaId", type=int)
gene_filter = request.args.getlist("geneFilter", type=str)
chrom = request.args.get("chrom", type=str)
chrom_start = request.args.get("chromStart", type=int)
Expand Down
2 changes: 0 additions & 2 deletions server/src/scimodom/services/modification.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def get_modifications_by_source(
modification_id,
organism_id,
technology_ids,
taxa_id,
gene_filter,
chrom,
chrom_start,
Expand All @@ -109,7 +108,6 @@ def _return_ensembl_query(
modification_id: int,
organism_id: int,
technology_ids: list[int],
taxa_id: int,
gene_filter: list[str],
chrom: str | None,
chrom_start: int,
Expand Down
1 change: 1 addition & 0 deletions server/src/scimodom/services/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def get_selections(self) -> list[dict[str, Any]]:
Taxonomy.domain,
Taxonomy.kingdom,
Taxa.id.label("taxa_id"),
Taxa.name.label("taxa_name"),
Taxa.short_name.label("taxa_sname"),
Organism.cto,
Selection.id.label("selection_id"),
Expand Down

0 comments on commit 066fcb8

Please sign in to comment.