Skip to content

Commit

Permalink
add dev configs and db dump to seed db, disclaimer, update readme. Re…
Browse files Browse the repository at this point in the history
…ady for first release
  • Loading branch information
emiliorighi committed May 18, 2022
1 parent 665d9bf commit a30557e
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 131 deletions.
18 changes: 17 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
DB_NAME=biogenome-db
DB_USER=biogenome-user
DB_PASS=biogenome-password
DB_HOST=mydatabase

# declare production db host here
# DB_PROD_HOST=

# default dev db host
DB_DEV_HOST=mydev-db

DB_PORT=27017
DB_DUMP=dump_2022-05-18.gz

MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=root
MONGO_INITDB_DATABASE=admin
MONGODB_DATA_DIR=/var/lib/mongodb-data
MONDODB_LOG_DIR=/dev/null

# change to 'production' or null in prod!!
FLASK_ENV=development
APP_NAME=RNAmaps
API_PORT=80
Expand All @@ -14,6 +28,8 @@ THREADS=2
USR=admin
JWT_SECRET_KEY=secret_restKey
RESTKEY=secretPassword


PROJECT_ACCESSION=PRJNA533106
PROJECTS=DTOL, VGP
EXEC_TIME=600
Expand Down
57 changes: 31 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,31 @@ This project is built with the following stack:
<!-- GETTING STARTED -->
## Getting Started

Before building the application it is necessary to configure the .env file in the project's root directory:
The .env file contains many parts that have to be configured depending on the needs:
By default the portal is configured to retrieve public data under the EBP umbrella (https://www.earthbiogenome.org/) it will load (at building stage) and seed the database with the last dump (/dump-db directory)

The API KEY part:
Configure this part if you want to enter samples locally
If you want to customize the portal follow the steps below:

USER=admin --> Define the user name that will be inserted to access the admin area
JWT_SECRET_KEY=secret_restKey #change this in production!! --> key to encrypt the RESTKEY (below)
RESTKEY=secretPassword #change this in production!! --> password that will be inserted to access the admin area
General configurations:
- Set the ROOT_NODE env variable with the Taxon name you want to use as a root (default: Eukaryota)

Public data management:
- in the .env file insert the PROJECT_ACCESSION (The INSDC BioProject accession) of the project you want to use as a root:
if the bioproject you want to use as a root is not under the EBP umbrella, you have to comment the volumes of the biogenome_mongo service in the docker-compose-dev file:
- ./mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
- ./mongo-restore.sh:/docker-entrypoint-initdb.d/mongo-restore.sh
- ./db-dump:/db-dump
- if the same project or sub projects are defined as attributes of the sample metadata (ex: project name: 'YOUR_PROJECT_NAME') submitted in INSDC, set the list of comma separated project names in the PROJECTS env variable (default values: VGP(https://vertebrategenomesproject.org/), DTOL(https://www.darwintreeoflife.org/))

-EXEC_TIME: how often, in seconds, the job should be performed it does nothing if PROJECTS OR PROJECT_ACCESSION are empty

The CRONJOB part:
Configure this part if you want to retrieve public data from ENA/BioSamples and/or NCBI (the sample metadata format must be compliant with the ENA checklist).
The cronjob will automatically check for read data in ENA if PROJECTS and/or PROJECT_ACCESSION are present
PROJECTS= --> list of projects (comma separated) wich name figures in the sample metadata submitted to the ENA/BioSamples
PROJECT_ACCESSION --> bioproject accession to retrieve data from NCBI
EXEC_TIME=600 --> how often, in seconds, the job should be performed
NOTE: if you are just interested in local data management remove the default values of PROJECTS and PROJECT_ACCESSION

The DATA PORTAL part:
This part have some default values that can be modified
Local data management:

ROOT_NODE=the INSDC bioproject acccession which will be used as the root project of the application
Configure this part if you want to enter samples locally
USR=admin --> Define the user name that will be inserted to access the admin area
JWT_SECRET_KEY=secret_restKey #change this in production!! --> key to encrypt the RESTKEY (below)
RESTKEY=secretPassword #change this in production!! --> password that will be inserted to access the admin area


To add a custom logo and an icon follow this steps:
Expand All @@ -129,12 +133,14 @@ To get a local copy up and running follow these simple example steps.

### Installation

You need to have docker compose installed (https://docs.docker.com/compose/)
You need to have docker compose installed (https://docs.docker.com/compose/).

1. Configure the .env file as above
2. Run this command in the root directory:
sudo docker-compose -f docker-compose.yml up --build
3. To start creating data go to: /admin from the home page and login
1. Run this command in the root directory:
sudo docker-compose -f docker-compose.dev.yml up --build

This will load the last generated db dump containing all the public data under the EBP scope (https://www.earthbiogenome.org/)

2. To start creating data go to: /admin from the home page and login


<p align="right">(<a href="#top">back to top</a>)</p>
Expand Down Expand Up @@ -175,11 +181,10 @@ The import function uses the BioSamples API to retrieve samples metadata via the
## Roadmap

- [ ] Add Changelog
- [ ] Add JSON schema (OAS docs)
- [X] Add local names management
- [X] Add organism photo management
- [X] Add sample accession import feature
- [ ] Add custom fields management
- [ ] Add API Documentation
- [ ] Add tests (I know..)





Expand Down
18 changes: 17 additions & 1 deletion client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
<b-overlay :show="loading">
<b-container fluid class="router-container">
<b-row>
<b-col lg="6">
<b-alert dismissible show variant="success">
<p>
This data portal is an instance of the <a href="https://github.com/guigolab/biogenome-portal" class="alert-link">BioGenome portal</a> software.
</p>
<p>
It tracks the <a href="https://www.insdc.org/" class="alert-link">INSDC</a> public data under the <a href="https://www.earthbiogenome.org/" class="alert-link">Earth BioGenome Project</a> umbrella.
</p>
<hr>
<p class="mb-0">
<strong>IMPORTANT</strong>: This is <strong>NOT</strong> the official data portal of the Earth BioGenome Project.
Refer to <a href="https://goat.genomehubs.org/" class="alert-link">GoaT</a> to view the Earth BioGenome Project sequencing progress.
</p>
</b-alert>
</b-col>
<alert-component/>
</b-row>
<b-row>
Expand All @@ -25,7 +40,7 @@
</template>

<script>
import {BOverlay} from 'bootstrap-vue'
import {BOverlay,BAlert} from 'bootstrap-vue'
import BreadCrumbComponent from './components/base/BreadCrumbComponent.vue';
import NavBarComponent from './components/base/NavBarComponent.vue'
import AlertComponent from './components/base/AlertComponent.vue';
Expand All @@ -42,6 +57,7 @@ components: {
NavBarComponent,
BreadCrumbComponent,
BOverlay,
BAlert,
AlertComponent,
LoginModal,
}
Expand Down
29 changes: 24 additions & 5 deletions client/src/components/data/AnnotationsComponent.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<template>
<div ref="annotationsTable">
<table-component stacked :sticky-header="stickyHeader" :items="annotations">
<table-component stacked :sticky-header="stickyHeader" :items="annotations" :fields="fields">
<template #cell(pageURL)="data">
<b-link class="no-underline" target="_blank" :href="data.value">Genome browser</b-link>
<b-link class="no-underline" target="_blank" :href="data.value">Open</b-link>
</template>
<template #cell(gffGzLocation)="data">
<b-link class="no-underline" target="_blank" :href="data.value">GFF3</b-link>
<b-link class="no-underline" target="_blank" :href="data.value">Download</b-link>
</template>
<template #cell(tabIndexLocation)="data">
<b-link class="no-underline" target="_blank" :href="data.value">GFF3 (Tabix)</b-link>
<b-link class="no-underline" target="_blank" :href="data.value">Download</b-link>
</template>
<template #cell(targetGenome)="data">
<template #cell(assemblyAccession)="data">
<b-link class="no-underline" target="_blank" :href="'https://www.ebi.ac.uk/ena/browser/view/' + data.value">{{data.value}}</b-link>
</template>
<template #cell(annotationSource)="data">
<b-link class="no-underline" target="_blank" :href="data.value">{{data.value}}</b-link>
</template>
<template #cell(evidenceSource)="data">
<div v-for="value in data.value.split('.')" :key="value">
{{value}}
</div>
</template>
</table-component>
</div>
</template>
Expand All @@ -27,6 +32,20 @@ import TableComponent from '../base/TableComponent.vue'
export default{
components: { TableComponent,BLink },
props: ['annotations'],
data(){
return {
fields:[
{key:'name', label: 'Name'},
{key:'gffGzLocation', label: 'GFF3 (.gz)'},
{key:'tabIndexLocation', label: 'GFF3 (gz.tbi)'},
{key:'pageURL', label: 'Genome Browser'},
{key:'annotationSource', label: 'Annotation Pipeline'},
{key:'evidenceSource', label: 'Evidence Source'},
{key:'targetGenome', label: 'Assembly Name'},
{key:'assemblyAccession', label: 'Assembly Accession'}
]
}
}
}
</script>
<style>
Expand Down
35 changes: 9 additions & 26 deletions client/src/components/organism/OrganismFilterComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<b-tooltip target="switch-description">
Retrieve only selected data ex: retrieve <stong>only</stong> organisms with 'Submitted Samples' or <stong>only</stong> 'Submitted Samples' and 'Submitted Assemblies'
</b-tooltip>
<b-form-checkbox-group :options="checkboxOptions" v-model="selectedCheckboxes"/>
<b-form-checkbox-group :options="checkboxOptions" v-model="selectedData"/>
<b-icon-arrow-clockwise variant="primary" @mouseenter="animation='spin-pulse'" @mouseleave="animation=''" :animation="animation" font-scale="2" id="refresh-action" @click="resetFilters()"/>
<b-tooltip target="refresh-action">
Refresh filters
Expand All @@ -37,52 +37,36 @@ import FilterComponent from '../base/FilterComponent.vue'
import portalService from '../../services/DataPortalService'
import {PROJECT_ACCESSION} from '../../utils/static-config'
import MultiSelectComponent from '../base/MultiSelectComponent.vue'
import {dataOptions} from '../../utils/static-config'
export default {
data(){
return {
options: [{name:'Species name',item:'species_name'},{name:'TaxID',item:'taxid'}, {name:'Common name',item:'common_name'},{name:'ToLID', item:'tolid'}],
checkboxOptions:[
{text: 'Acquired samples', value: 'local_samples'},
{text: 'Submitted samples', value: 'insdc_samples'},
{text: 'Submitted reads', value: 'experiments'},
{text: 'Submitted assemblies', value: 'assemblies'},
{text: 'Annotations', value: 'annotations'}
],
selectedCheckboxes:[],
checkboxOptions:dataOptions,
animation:'',
projectAccession: PROJECT_ACCESSION
}
},
computed: {
...mapFields({
fields: ['onlySelectedData','selectedBioproject'],
fields: ['selectedData','onlySelectedData','selectedBioproject'],
module: 'portal',
mutation: 'portal/setField'
})
}),
},
watch:{
selectedCheckboxes(values){
this.checkboxOptions
.map(it => {return it.value})
.forEach(it => {
if (values.filter(v => v === it).length){
this.$store.commit('portal/setField', {label: it, value:true})
}else{
this.$store.commit('portal/setField', {label: it, value:false})
}
})
this.$root.$emit('bv::refresh::table', 'organisms-table')
},
selectedBioproject(){
this.$root.$emit('bv::refresh::table', 'organisms-table')
},
onlySelectedData(){
this.$root.$emit('bv::refresh::table', 'organisms-table')
},
selectedData(){
this.$root.$emit('bv::refresh::table', 'organisms-table')
}
},
components:{
BFormCheckbox,BFormCheckboxGroup,BTooltip,
BFormCheckbox,BFormCheckboxGroup,BTooltip,
BIconArrowClockwise,FilterComponent,MultiSelectComponent
},
created(){
Expand All @@ -101,7 +85,6 @@ export default {
},
methods:{
resetFilters(){
this.selectedCheckboxes=[]
this.$store.dispatch('portal/resetFilters')
}
}
Expand Down
65 changes: 22 additions & 43 deletions client/src/components/organism/OrganismsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import SubmissionService from '../../services/SubmissionService';
import DataModal from '../modal/DataModal.vue';
import EditOrganismModal from '../modal/EditOrganismModal.vue';
import PaginationComponent from '../base/PaginationComponent.vue';
import {dataOptions} from '../../utils/static-config'
export default {
components:
Expand All @@ -103,9 +104,7 @@ export default {
fields: ['filter','perPage',
'onlySelectedData','selectedBioproject',
'option','taxName',
'totalRows','currentPage',
'insdc_samples','local_samples',
'experiments','assemblies','annotations'],
'totalRows','currentPage','selectedData'],
module: 'portal',
mutation: 'portal/setField'
}),
Expand Down Expand Up @@ -144,43 +143,18 @@ export default {
organism:null,
commonNames: '',
model:'',
dataOptions: dataOptions
}
},
watch: {
insdc_samples(value){
if (value){
this.fields.filter(f => f.key === 'insdc_samples').forEach(f => f.variant = "success")
}else{
this.fields.filter(f => f.key === 'insdc_samples').forEach(f => f.variant = "")
}
},
local_samples(value){
if (value){
this.fields.filter(f => f.key === 'local_samples').forEach(f => f.variant = "info")
}else{
this.fields.filter(f => f.key === 'local_samples').forEach(f => f.variant = "")
}
},
assemblies(value){
if (value){
this.fields.filter(f => f.key === 'assemblies').forEach(f => f.variant = "primary")
}else{
this.fields.filter(f => f.key === 'assemblies').forEach(f => f.variant = "")
}
},
experiments(value){
if (value){
this.fields.filter(f => f.key === 'experiments').forEach(f => f.variant = "warning")
}else{
this.fields.filter(f => f.key === 'experiments').forEach(f => f.variant = "")
}
},
annotations(value){
if (value){
this.fields.filter(f => f.key === 'annotations').forEach(f => f.variant = "secondary")
}else{
this.fields.filter(f => f.key === 'annotations').forEach(f => f.variant = "")
}
selectedData(values){
this.dataOptions.forEach(opt => {
if (values.includes(opt.value)){
this.fields.filter(f => f.key === opt.value).forEach(f => f.variant = opt.variant)
}else{
this.fields.filter(f => f.key === opt.value).forEach(f => f.variant = "")
}
})
},
option(){
this.filter=''
Expand Down Expand Up @@ -241,21 +215,26 @@ export default {
},
organismsProvider(ctx,callback){
const fromParam = (ctx.currentPage - 1) * ctx.perPage
const selectedData = this.dataOptions.map(opt => {
var data = {}
if (this.selectedData.includes(opt.value)){
data[opt.value] = true
}else{
data[opt.value] = false
}
return data
})
const params = {
filter: ctx.filter,
offset: fromParam,
limit: ctx.perPage,
sortColumn: ctx.sortBy,
sortOrder: ctx.sortDesc,
taxName: this.taxName,
insdc_samples: this.insdc_samples,
local_samples: this.local_samples,
assemblies: this.assemblies,
experiments: this.experiments,
annotations: this.annotations,
option: this.option,
onlySelectedData: this.onlySelectedData,
bioproject:this.selectedBioproject
bioproject:this.selectedBioproject,
...Object.assign({}, ...selectedData)
}
this.defaultSearch(params,callback)
}
Expand Down
Loading

0 comments on commit a30557e

Please sign in to comment.