Commit d94c62fb authored by Laura Morel's avatar Laura Morel
Browse files

Add memcached cache

Fix annotations for heatmap
parent 6846c6c8
......@@ -5,7 +5,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
import { ColorPickerModule } from 'ngx-color-picker';
import { NgxSpinnerModeule } from "ngx-spinner";
import { NgxSpinnerModule } from "ngx-spinner";
import { AppComponent } from './app.component';
import { ControllerComponent } from './controller/controller.component';
......
<ng-container *ngIf="src; else elseTemplate">
<img id="heatmap" [src]="src" />
</ng-container>
<ng-container *ngIf="src==='no_heatmap'; else loadingTemplate">
<ng-template #elseTemplate>
<ng-template #elseTemplate>
<p> No heatmap </p>
</ng-template>
<ng-template #loadingTemplate>
<p> Loading... </p>
</ng-template>
</ng-container>
</ng-template>
......@@ -31,7 +31,7 @@ ALLOWED_HOSTS = []
CORS_ORIGIN_ALLOW_ALL = False
CORS_ALLOWED_ORIGINS = [
'http://localhost:4200',
'http://localhost:4200',
]
# Application definition
......@@ -78,6 +78,14 @@ TEMPLATES = [
WSGI_APPLICATION = 'VizFaDa.wsgi.application'
# Caches
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211'
}
}
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
......@@ -128,4 +136,4 @@ USE_TZ = True
STATIC_URL = '/assets/'
STATIC_ROOT = os.path.join(BASE_DIR, "assets")
STATICFILES_DIRS = [ os.path.join(BASE_DIR, "data/assets")]
STATICFILES_DIRS = [os.path.join(BASE_DIR, "data/assets")]
......@@ -44,6 +44,7 @@ class ClusteredHeatmap:
self.seaborn_options.update(seaborn_options)
self.fig = None
self.highlighted = None
self.annotated = ""
self.get_fields()
def _filter_meta(self, filters: Filters) -> pd.DataFrame:
......@@ -110,8 +111,9 @@ class ClusteredHeatmap:
self.fig.ax_col_dendrogram.legend(loc="center", ncol=4)
self.highlighted = self.fig
def _annotate(self, field: str) -> None:
def _annotate(self) -> None:
print("Annotating heatmap..")
field = self.annotated
try:
values = self.fields[field]
except KeyError:
......@@ -127,7 +129,8 @@ class ClusteredHeatmap:
def annotate_field(self, field: str) -> None:
self.get_fields()
self._annotate(field)
self.annotated = field
self._annotate()
def add_filters(self, filters: Filters) -> None:
if not filters == {}:
......
......@@ -23,7 +23,7 @@ def fill_db(verbose=False):
correlation = pd.read_csv(correlation, sep=",", header=0, index_col=0)
c = Correlation(species=sp, correlation=spDir +
"/corPickle", metadata=spDir + "/metaPickle")
metadata.applymap(str)
metadata = metadata.applymap(str)
c.pickle(correlation, "correlation")
c.pickle(metadata, "metadata")
c.save()
......
......@@ -2,3 +2,4 @@ django==3.1.1
seaborn==0.11.0
django-cors-headers==3.5.0
fastcluster==1.1.26
distinctipy==1.1.5
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment