diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae93cc7e2b945298b8648f50631ea29e256a8bd2..c754eb56852254654002e2bc0c853b4d9726aa13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -360,12 +360,13 @@ update-meilisearch-index:prod: stage: get-meili-key variables: MEILI_HOST: "http://localhost:7700" + MEILI_HOST_NO_PROTOCOLE: "localhost:7700" script: - > df-wiki-cli meilisearch --key "${MEILI_MASTER_KEY}" - --host ${MEILI_HOST} + --host "${MEILI_HOST}" get-env-var --output build.env artifacts: @@ -378,6 +379,7 @@ set-meili-env:dev: extends: .set-meili-env variables: MEILI_HOST: "https://${MEILI_HOST_DEV}" + MEILI_HOST_NO_PROTOCOLE: ${MEILI_HOST_DEV} rules: - if: $CI_COMMIT_BRANCH != "main" @@ -385,6 +387,8 @@ set-meili-env:prod: extends: .set-meili-env variables: MEILI_HOST: "https://${MEILI_HOST_PROD}" + MEILI_HOST_NO_PROTOCOLE: ${MEILI_HOST_PROD} + rules: - if: $CI_COMMIT_BRANCH == "main" @@ -416,7 +420,6 @@ sync-zotero: - *docker-login script: - echo $MEILI_HOST - - echo $MEILI_API_KEY - > docker buildx build --pull -t "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA" --build-arg "BASE_URL=$BASE_URL" @@ -450,7 +453,7 @@ build:prod:wiki: # - get-pfam variables: BASE_URL: /wiki/ - HOST_URL: https://${HOST_PROD} + HOST_URL: "https://${HOST_PROD}" rules: - if: $CI_COMMIT_BRANCH == "main" @@ -517,7 +520,7 @@ deploy:prod: variables: NODE_ENV: "production" KUBE_NAMESPACE: "defense-finder-prod" - PUBLIC_URL: "${HOST_PROD}" + PUBLIC_URL: "https://${HOST_PROD}" CI_DEBUG_TRACE: "false" ENV: "production" environment: @@ -601,7 +604,7 @@ create-structures-archives:prod: variables: NODE_ENV: "production" KUBE_NAMESPACE: "defense-finder-prod" - PUBLIC_URL: "${HOST_PROD}" + PUBLIC_URL: "https://${HOST_PROD}" CI_DEBUG_TRACE: "false" ENV: "production" environment: diff --git a/components/content/RefseqDb.vue b/components/content/RefseqDb.vue index 80b49c502f5cbed9f1f5adca52ba1ee60e5801bf..cf6322e59f6780a8a41ed714574b6436dc4b85f9 100644 --- a/components/content/RefseqDb.vue +++ b/components/content/RefseqDb.vue @@ -18,7 +18,12 @@ const itemValue = ref("id"); const { width } = useDisplay(); const dbName = ref("refseq") const taxonomyFacet = ref<Record<string, any> | undefined>(undefined) - +const cellPlotMargin = ref({ + marginLeft: 150, + marginBottom: 200, + marginTop: 0, + marginRight: 50 +}) onBeforeMount(async () => { @@ -150,7 +155,7 @@ const availableTaxo: Ref<string[]> = ref([ "Superkingdom" ]); -const scaleTypes = ref<string[]>(['linear', 'sqrt', 'log', 'symlog']) +const scaleTypes = ref<string[]>(['linear', 'sqrt', 'symlog']) const selectedTaxoRank = ref<"species" | "genus" | "family" | "order" | "class" | "phylum" | "Superkingdom">("Superkingdom"); const headers = ref([ @@ -190,7 +195,18 @@ const computedWidth = computed(() => { return Math.max(currentWidth, 550); }); +const cellPlotComputedDimension = computed(() => { + const { marginLeft, marginBottom, marginRight, marginTop } = toValue(cellPlotMargin) + const toValWidth = toValue(width) + const widthFixCell = countSystem.value * 50 + marginLeft + marginRight + const heigthFix = countClade.value * 50 + marginTop + marginBottom + if (widthFixCell > toValWidth) { + return { width: toValWidth - marginLeft - marginRight, height: undefined } + } else { + return { width: widthFixCell, height: heigthFix } + } +}) const allHits: Ref<Record<string, any> | undefined> = ref(undefined) @@ -364,17 +380,33 @@ const sortedCellDomain = computed(() => { } }) const binPlotOptions = computed(() => { + const { marginLeft, marginBottom } = toValue(cellPlotMargin) + const { height } = toValue(cellPlotComputedDimension) + return { - marginLeft: 150, - marginBottom: 200, + marginLeft, + marginBottom, padding: 0, grid: true, - aspectRatio: true, + aspectRatio: height ? undefined : 1, x: { tickRotate: 90, label: "Systems", domain: toValue(sortedCellDomain) }, color: { scheme: "plasma", legend: true, label: `Proportion per ${selectedTaxoRank.value}`, domain: [0, 100] }, } }) +const countSystem = computed(() => { + const toValueAllHits = toValue(allHits) + const data = toValueAllHits?.hits ?? [] + const setSystem = new Set(data.map(d => d.type)) + return setSystem.size +}) + +const countClade = computed(() => { + const toValueAllHits = toValue(allHits) + const data = toValueAllHits?.hits ?? [] + const setSystem = new Set(data.map(d => d[selectedTaxoRank.value])) + return setSystem.size +}) const binPlotGroup = computed(() => { return Plot.group( @@ -423,9 +455,13 @@ const binPlotDataOptions = computed(() => { const toValBinPlotGroup = toValue(binPlotGroup) const data = toValueAllHits?.hits ?? [] const plotCellMark = Plot.cell(data, toValBinPlotGroup) + const { width, height } = toValue(cellPlotComputedDimension) + + const dim = height ? { width, height } : { width } + return toValueAllHits?.hits?.length > 0 ? { ...binPlotOptions.value, - width: width.value, + ...dim, title: `Proportion of genomes with defense system X per ${selectedTaxoRank.value} taxonomic rank`, color: { ...binPlotOptions.value.color, diff --git a/deploy/df-wiki/values.yaml b/deploy/df-wiki/values.yaml index 1f56ee87cad5c8bc3d72797a8fb11ebab2a7e458..f35659908ad58a4e5a79602e5b0fa1515125ef58 100644 --- a/deploy/df-wiki/values.yaml +++ b/deploy/df-wiki/values.yaml @@ -35,6 +35,7 @@ securityContext: runAsNonRoot: true runAsUser: 101 runAsGroup: 101 + allowPrivilegeEscalation: false # capabilities: # drop: # - ALL diff --git a/deploy/meilisearch/Chart.yaml b/deploy/meilisearch/Chart.yaml index 35cb6b57488aa0b4e75c7df8be8477071e0eb2dd..b3c04f0c445e8930e31effa06182a2816077cf7f 100644 --- a/deploy/meilisearch/Chart.yaml +++ b/deploy/meilisearch/Chart.yaml @@ -25,6 +25,6 @@ appVersion: "1.16.0" dependencies: - name: meilisearch - version: 0.3.0 + version: 0.5.0 repository: "https://meilisearch.github.io/meilisearch-kubernetes" diff --git a/docker-compose.yml b/docker-compose.yml index 0cedb3670df391be58a329e1d72b5524cde783c0..6744c4e3daf6379122c804b82e81aa173c38b3bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: args: BASE_URL: /wiki MEILI_HOST: http://localhost:7700 - MEILI_API_KEY: f9cc073016cbb392365aae86517878cb3f3408bb85c1fafd06e27f73ccb35e3d + MEILI_API_KEY: f5f5f1bc48e6379fc2509f5bf0aed1fce96c1bbf86e0a194c605b258d7cfe890 HOST_URL: http://localhost:8082 container_name: nuxt environment: @@ -31,7 +31,7 @@ services: - main meilisearch: - image: getmeili/meilisearch:v1.5 + image: getmeili/meilisearch:v1.7 # command: # - meilisearch # - --http-addr diff --git a/packages/df-wiki-cli/df_wiki_cli/meilisearch/main.py b/packages/df-wiki-cli/df_wiki_cli/meilisearch/main.py index b722a7a7cf965837c610584c1c2a086f660cd039..b0b1d56fe9085b77fae2adad74b5a3c85433750f 100644 --- a/packages/df-wiki-cli/df_wiki_cli/meilisearch/main.py +++ b/packages/df-wiki-cli/df_wiki_cli/meilisearch/main.py @@ -137,7 +137,9 @@ def get_env_var( keys = client.get_keys() api_key = [res.key for res in keys.results if res.name == "Default Search API Key"] + print(ctx.obj.host) if len(api_key) == 1: with open(output, "a") as outfile: - outfile.write(f"MEILI_HOST={ctx.obj.host}\n") - outfile.write(f"MEILI_API_KEY={api_key[0]}\n") + print(ctx.obj.host) + outfile.write(f'MEILI_HOST="{ctx.obj.host}"\n') + outfile.write(f'MEILI_API_KEY="{api_key[0]}"\n') diff --git a/scripts/fill-local-meilisearch.sh b/scripts/fill-local-meilisearch.sh new file mode 100755 index 0000000000000000000000000000000000000000..cfd0aa4b422465f855d16ca9c92c81e4b4be5814 --- /dev/null +++ b/scripts/fill-local-meilisearch.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# REFSEQ +df-wiki-cli meilisearch delete-all-documents refseq +df-wiki-cli meilisearch update --file ../data/refseq_res.csv --document refseq + + +# REF SEQ TAXO +df-wiki-cli content refseq-group-per-assembly --input ../data/refseq_res.csv --output /tmp/refseqtaxo.csv +df-wiki-cli meilisearch delete-all-documents refseqtaxo +df-wiki-cli meilisearch update --file /tmp/refseqtaxo.csv --document refseqtaxo + +# REFSEQ TAXO TYPE + +df-wiki-cli content refseq-group-per-assembly-and-type --input ../data/refseq_res.csv --output /tmp/refseqtaxotype.csv +df-wiki-cli meilisearch delete-all-documents refseqtaxotype +df-wiki-cli meilisearch update --file /tmp/refseqtaxotype.csv --document refseqtaxotype + + +# SANITIZED REFSEQ +df-wiki-cli content refseq-sanitized-hits --input ../data/refseq_res.csv --output /tmp/refseq-sanitized.csv + +df-wiki-cli meilisearch delete-all-documents refseqsanitized +df-wiki-cli meilisearch update --file /tmp/refseq-sanitized.csv --document refseqsanitized + +# systems +df-wiki-cli content systems --dir ../content/3.defense-systems/ --pfam ../public/pfam-a-hmm.csv --output /tmp/list-systems.json +df-wiki-cli meilisearch update --file /tmp/list-systems.json --document systems + +# STRUCTURE +df-wiki-cli meilisearch update --file ../data/all_predictions_statistics_clean.csv --document structure + +# ARTICLES +# df-wiki-cli meilisearch delete-all-documents article +# df-wiki-cli meilisearch