Skip to content
Snippets Groups Projects
Commit 855a1513 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

automatic list systems

parent 8b69ab5d
No related branches found
No related tags found
2 merge requests!6Automatic systems list,!5Optional title abstract
Pipeline #111360 failed
...@@ -7,26 +7,34 @@ const props = defineProps<{ ...@@ -7,26 +7,34 @@ const props = defineProps<{
const itemsPerParge = ref(25) const itemsPerParge = ref(25)
const search = ref('') const search = ref('')
const sortBy = ref([{ key: 'system', order: 'asc' }]) const sortBy = ref([{ key: 'system', order: 'asc' }])
// const headers = ref([{
// title: "Systems",
// key: "system"
// }, { title: "Articles", key: "doi" }
// ])
function filterOnlyCapsText(value, query, item) {
if (value != null && query != null) {
if (typeof value === 'string') {
return value.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1
}
if (typeof value == 'object') {
if (value?.name) {
return value.name.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1
}
}
}
return false
}
</script> </script>
<template> <template>
<v-card flat color="transparent" class="my-5"> <v-card flat color="transparent" class="my-5">
<v-toolbar> <v-toolbar>
<v-toolbar-title>Defense Systems</v-toolbar-title> <v-toolbar-title>Defense Systems</v-toolbar-title>
<v-text-field v-model="search" density="compact" variant="underlined" append-inner-icon="mdi-magnify" <v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify"
label="Search" single-line hide-details class="mx-2"></v-text-field> label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field>
</v-toolbar> </v-toolbar>
<v-data-table :items-per-page="itemsPerParge" v-model:sort-by="sortBy" :headers="props.headers" :items="props.systems" <v-data-table :items-per-page="itemsPerParge" v-model:sort-by="sortBy" :headers="props.headers"
:search="search"> :custom-filter="filterOnlyCapsText" :items="props.systems" :search="search">
<template #[`item.system`]="{ item }"> <template #[`item.system`]="{ item }">
<v-chip variant="text" link :to="`/defense-systems/${item.columns.system.toLowerCase()}`">{{ <v-chip variant="text" link :to="`${item.columns.system.path}`">{{
item.columns.system }}</v-chip> item.columns.system.name }}</v-chip>
</template> </template>
<template #[`item.doi`]="{ item }"> <template #[`item.doi`]="{ item }">
<ArticleDoiList v-if="item.columns?.doi" :items="[item.columns.doi]" :divider="false" /> <ArticleDoiList v-if="item.columns?.doi" :items="[item.columns.doi]" :divider="false" />
......
--- ---
title: Abi2 title: Abi2
tableDescription: tableColumns:
doi: 10.1016/j.mib.2005.06.006 doi: 10.1016/j.mib.2005.06.006
--- ---
......
--- ---
title: AbiA title: AbiA
tableColumns:
doi: 10.1016/j.mib.2005.06.006
--- ---
The AbiA system have been describe in a total of 2 subsystems. The AbiA system have been describe in a total of 2 subsystems.
......
--- ---
title: AbiB title: AbiB
tableColumns:
doi: 10.1016/j.mib.2005.06.006
--- ---
The AbiB system is composed of one protein: AbiB. The AbiB system is composed of one protein: AbiB.
......
--- ---
title: AbiC title: AbiC
tableColumns:
doi: 10.1016/j.mib.2005.06.006
--- ---
The AbiC system is composed of one protein: AbiC. The AbiC system is composed of one protein: AbiC.
......
--- ---
title: AbiD title: AbiD
tableColumns:
doi: 10.1016/j.mib.2005.06.006
--- ---
The AbiD system is composed of one protein: AbiD. The AbiD system is composed of one protein: AbiD.
......
--- ---
title: AbiE title: AbiE
tableDescription: tableColumns:
doi: 10.1093/nar/gkt1419 doi: 10.1016/j.mib.2005.06.006
other: blabla
--- ---
AbiE is a family of an anti-phage defense systems. They act through a Toxin-Antitoxin mechanism, and are comprised of a pair of genes, with one gene being toxic while the other confers immunity to this toxicity. AbiE is a family of an anti-phage defense systems. They act through a Toxin-Antitoxin mechanism, and are comprised of a pair of genes, with one gene being toxic while the other confers immunity to this toxicity.
......
--- ---
title: AbiG title: AbiG
tableColumns:
doi: 10.1016/j.mib.2005.06.006
--- ---
The AbiG system is composed of 2 proteins: AbiGi and, AbiGii. The AbiG system is composed of 2 proteins: AbiGi and, AbiGii.
......
--- ---
title: AbiH title: AbiH
tableColumns:
doi: 10.1111/j.1574-6968.1996.tb08446.x
--- ---
## Example of genomic structure ## Example of genomic structure
......
--- ---
title: AbiV title: AbiV
tableColumns:
doi: 10.1128/AEM.00780-08
--- ---
## Example of genomic structure ## Example of genomic structure
......
--- ---
title: Rst_PARIS title: Rst_PARIS
tableColumns:
doi: https://doi.org/10.1101/2021.01.21.427644
--- ---
## Description ## Description
......
<script setup lang="ts"> <script setup lang="ts">
const { data, error, pending } = await useAsyncData('list-defense-systems', () => queryContent('/defense-systems').find()) const { data, error, pending } = await useAsyncData(
'list-defense-systems',
() => queryContent('/defense-systems').find()
)
const defaultHeaders = ref([{ title: 'System', key: "system" }]) const defaultHeaders = ref([{ title: 'System', key: "system" }])
const tableDescriptionKey = ref("tableDescription") const tableKey = "tableColumns"
const headers = computed(() => {
if (data?.value && data.value?.length > 0) { const sanitizedData = computed(() => {
const uniqHeaders = Array.from(data.value.reduce((headerSet, df) => {
if (df?.[tableDescriptionKey.value]) {
return new Set([...headerSet, ...Object.keys(df[tableDescriptionKey.value])])
}
else { return headerSet }
}, new Set()))
return [...defaultHeaders.value, ...uniqHeaders.map(value => { return { title: value, key: value } })]
}
else {
return []
}
})
const systems = computed(() => {
if (data?.value && data.value?.length > 0) { if (data?.value && data.value?.length > 0) {
return data.value.map(({ title, tableDescription }) => { return data.value?.filter(entry => {
return { if (entry._dir === "old" || entry._dir === "") {
system: title, return false
...tableDescription
} }
return true
}) })
} else { } else {
return [] return []
} }
})
const headers = computed(() => {
const uniqHeaders = Array.from(sanitizedData.value.reduce((headerSet, df) => {
if (df?.[tableKey]) {
return new Set([...headerSet, ...Object.keys(df[tableKey])])
}
else { return headerSet }
}, new Set()))
return [...defaultHeaders.value, ...uniqHeaders.map(value => { return { title: value, key: value } })]
})
const systems = computed(() => {
return sanitizedData.value.map((content) => {
return {
system: { name: content.title, path: content._path },
...content[tableKey]
}
})
}) })
console.log(headers.value)
console.log(systems.value)
</script> </script>
<template> <template>
<v-card> <v-card>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment