Skip to content

Commit

Permalink
- Cambiamento frasi (Matteo)
Browse files Browse the repository at this point in the history
- Salvare "merge columns" su client
- Glycosylation sites -> mostro tutti insieme
- Upload dominio da utente
- Cambio nomi dei file download
- Open analysis -> inserire file o manualmente accession ids
- Open analysis -> multiple drop downs
- Aggiornamento proteine, lineages, all_geo ogni 24h
  • Loading branch information
LucaCilibrasi committed Aug 6, 2021
1 parent 410e563 commit 231c705
Show file tree
Hide file tree
Showing 26 changed files with 2,758 additions and 462 deletions.
130 changes: 98 additions & 32 deletions backend/apis/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from scipy.stats import binom
from flask_restplus import Namespace, Resource

from datetime import datetime, timedelta
from threading import Timer

from pymongo import MongoClient

from .downloadLineagesInfo import dict_lineage_mutation
Expand Down Expand Up @@ -301,49 +304,23 @@
class FieldList(Resource):
@api.doc('all_geo')
def get(self):

conn = http.client.HTTPConnection('geco.deib.polimi.it')
conn.request('GET', '/virusurf_epitope/api/epitope/allGeo')

response = conn.getresponse()
all_geo = response.read().decode()
all_geo = json.loads(all_geo)

all_geo = all_geo_dict['all_geo']
return all_geo


@api.route('/allLineages')
class FieldList(Resource):
@api.doc('all_lineages')
def get(self):

conn = http.client.HTTPConnection('geco.deib.polimi.it')
conn.request('GET', '/virusurf_epitope/api/epitope/allLineages')

response = conn.getresponse()
all_lin = response.read().decode()
all_lin = json.loads(all_lin)

all_lin = all_lineage_dict['all_lineage']
return all_lin


@api.route('/allProtein')
class FieldList(Resource):
@api.doc('all_protein')
def post(self):

to_send = api.payload

conn = http.client.HTTPConnection('geco.deib.polimi.it')
headers = {'Content-type': 'application/json'}
send = to_send
json_data = json.dumps(send)
conn.request('POST', '/virusurf_epitope/api/epitope/allProtein', json_data, headers)

response = conn.getresponse()
all_protein = response.read().decode()
all_protein = json.loads(all_protein)

def get(self):
all_protein = all_protein_dict['all_protein']
return all_protein


Expand Down Expand Up @@ -1036,7 +1013,7 @@ def recursive_children_lineage(parent, lineage, alias, dict_copy2, dict_lineages


def get_all_important_mutation():
print("inizio request")
print("inizio request important mutation")
conn = http.client.HTTPConnection('geco.deib.polimi.it')
conn.request('GET', '/virusurf_epitope/api/epitope/allImportantMutations')

Expand All @@ -1047,12 +1024,98 @@ def get_all_important_mutation():
for mutation_per_lineage in all_important_mutation:
lineage = mutation_per_lineage['lineage']
all_important_mutation_dict[lineage] = mutation_per_lineage
print("fine request important mutation")
x = datetime.today()
y = x.replace(day=x.day, hour=2, minute=0, second=0, microsecond=0) + timedelta(days=1)
delta_t = y - x
secs = delta_t.total_seconds()
t1 = Timer(secs, get_all_important_mutation)
t1.start()


all_protein_dict = {}


def get_all_protein():
print("inizio request protein")
to_send = {'gcm': {'taxon_name':["severe acute respiratory syndrome coronavirus 2"]}}

conn = http.client.HTTPConnection('geco.deib.polimi.it')
headers = {'Content-type': 'application/json'}
send = to_send
json_data = json.dumps(send)
conn.request('POST', '/virusurf_epitope/api/epitope/allProtein', json_data, headers)

response = conn.getresponse()
all_protein = response.read().decode()
all_protein = json.loads(all_protein)
all_protein_dict['all_protein'] = all_protein
print("fine request protein")
x = datetime.today()
y = x.replace(day=x.day, hour=2, minute=0, second=0, microsecond=0) + timedelta(days=1)
delta_t = y - x
secs = delta_t.total_seconds()
t2 = Timer(secs, get_all_protein)
t2.start()

print("fine request")

all_lineage_dict = {}


def get_all_lineage():
print("inizio request lineage")
conn = http.client.HTTPConnection('geco.deib.polimi.it')
conn.request('GET', '/virusurf_epitope/api/epitope/allLineages')

response = conn.getresponse()
all_lin = response.read().decode()
all_lin = json.loads(all_lin)
all_lineage_dict['all_lineage'] = all_lin
print("fine request lineage")
x = datetime.today()
y = x.replace(day=x.day, hour=2, minute=0, second=0, microsecond=0) + timedelta(days=1)
delta_t = y - x
secs = delta_t.total_seconds()
t3 = Timer(secs, get_all_lineage)
t3.start()


all_geo_dict = {}


def get_all_geo():
print("inizio request geo")
conn = http.client.HTTPConnection('geco.deib.polimi.it')
conn.request('GET', '/virusurf_epitope/api/epitope/allGeo')

response = conn.getresponse()
all_geo = response.read().decode()
all_geo = json.loads(all_geo)
all_geo_dict['all_geo'] = all_geo
print("fine request geo")
x = datetime.today()
y = x.replace(day=x.day, hour=2, minute=0, second=0, microsecond=0) + timedelta(days=1)
delta_t = y - x
secs = delta_t.total_seconds()
t4 = Timer(secs, get_all_geo)
t4.start()


def prova_mongo_db():
print("prova Mongo")
# results = db.seq.aggregate([
# {
# "$group": {
# "fullname": {
# "$covv_accession_id"
# }
# }
# }]
# )
# print("qui", results)
# for i, x in enumerate(results):
# print("qui2", x)

seq = db.seq

pipeline = [
Expand Down Expand Up @@ -1089,4 +1152,7 @@ def prova_mongo_db():


get_all_important_mutation()
get_all_geo()
get_all_protein()
get_all_lineage()
# prova_mongo_db()
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ <h2 class="text-primary" style="margin: 20px 0; font-size:38px">Contacts</h2>
<p> <a href="mailto:[email protected]">[email protected]</a></p>
</td>
</tr>
<tr>
<td>
<b style="font-size:1.3em">Dr. Matteo Chiara</b>
<p>Use cases, Testing</p>
</td>
</tr>
<tr>
<td>
<b>Dipartimento di Elettronica, Informazione e Bioingegneria</b><br>
Expand Down Expand Up @@ -137,6 +143,7 @@ <h2 class="text-primary" style="margin: 20px 0; font-size:38px">Third-party soft
<p><a href="https://www.postgresql.org/">PostgreSQL</a></p>
<p><a href="https://vuejs.org/">Vue.js</a></p>
<p><a href="http://flask.pocoo.org/">Flask</a></p>
<p><a href="https://echarts.apache.org/">Apache ECharts</a></p>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -168,51 +175,13 @@ <h3 class="text-primary">GISAID data acknowledgement</h3>
</span>
</td>
</tr>
<tr>
<td>
<h3 class="text-primary">Personal acknowledgements</h3>
The authors would like to thank several researchers
for their contribution to requirements elicitation and for inspiring future developments
of this research.
They are listed in strict alphabetical order by last name.
<br>
<br>

<!--<p style="font-size:20px">Ilaria Capua</p>
<p style="font-size:13px">One Health Center of Excellence (University of Florida,
US)</p>
<br>-->

<p style="font-size:20px">Matteo Chiara</p>
<p style="font-size:13px">Università degli Studi di Milano Statale (IT)</p>
<br>
</td>
</tr>
<tr>
<td>
<h3 class="text-primary">Resources acknowledgements</h3>
We also acknowledge the support from Amazon Machine Learning Research
Award "Data-driven Machine and Deep Learning for Genomics".
</td>
</tr>
<!-- <tr>
<td>
<h3 class="text-primary">Operational collaborations</h1>
The authors would like to thank the following researchers for their technical and knowledge contributions related to the ViruSurf project.
<br>
<br>
<p style="font-size:20px">Tommaso Alfonsi</p>
<p style="font-size:13px">Politecnico di Milano (IT)</p>
<br>
<p style="font-size:20px">Ruba Al Khalaf</p>
<p style="font-size:13px">Politecnico di Milano (IT)</p>
<br>
<p style="font-size:20px">Damianos P. Melidis</p>
<p style="font-size:13px">Leibniz University Hannover (DE)</p>
<br>
</td>
</tr>-->
</tbody>
</table>

Expand Down
65 changes: 0 additions & 65 deletions backend/repo_static/about_viruclust.html

This file was deleted.

4 changes: 2 additions & 2 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
style="background-color: transparent; width: 100px">
<span>Wiki</span>
</v-btn>
<v-btn icon text href="/viruclust_gisaid/repo_static/about_viruclust_.html" target="_blank"
<v-btn icon text href="/viruclust_gisaid/repo_static/about__viruclust.html" target="_blank"
style="background-color: transparent; width: 100px">
<span>ABOUT</span>
</v-btn>
Expand Down Expand Up @@ -94,7 +94,7 @@
</v-list-item>
<v-list-item style="background-color: white; border-top: grey solid 1px">
<v-list-item-content>
<v-btn icon text href="/viruclust_gisaid/repo_static/about_viruclust_.html" target="_blank"
<v-btn icon text href="/viruclust_gisaid/repo_static/about__viruclust.html" target="_blank"
style="background-color: transparent; width: 200px">
<span>ABOUT</span>
</v-btn>
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/components/AnalyzeDistributionLineageInGeo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<v-card-text>
<v-layout row wrap justify-center style="padding: 30px;">
<v-flex class="no-horizontal-padding xs12 d-flex" style="justify-content: center; margin-top: 10px">
<h2>SELECT GEO-GRANULARITY AND LOCATION</h2>
<h2>PICK A PLACE</h2>
</v-flex>
<v-flex class="no-horizontal-padding xs2 d-flex" style="justify-content: center;">
<v-select
Expand All @@ -24,7 +24,7 @@
<v-autocomplete
v-model="selectedSpecificGeo"
:items="possibleSpecificGeo"
label="Specific Locality"
label="Place"
solo
hide-details
:item-text="getFieldText"
Expand Down Expand Up @@ -155,7 +155,9 @@
:descColumn = "sortDescTableLineageCountry"
:numSequences = "numberOfSequencesGeo"
:geoGranularity = "selectedGeo"
:denominators = "denominators">
:denominators = "denominators"
:selectedSpecificGeo = "selectedSpecificGeo"
:selectedGeoCount = "selectedGeoCount">
</HeatmapAnalyzeDistribution>
</v-flex>
<v-flex class="no-horizontal-padding xs12 d-flex" style="justify-content: center; margin-top: 20px">
Expand Down Expand Up @@ -231,7 +233,8 @@ export default {
if(table === 'table_geo'){
text = this.json2csv(result_sorted, this.headerTableLineageCountry);
}
let filename = 'result.csv';
let filename = 'lineage_analysis_table_' + this.selectedGeoCount + '%' + '_' + this.selectedSpecificGeo + '_' + this.startDateDistributionLineageInGeo
+ '_' + this.stopDateDistributionLineageInGeo + '.csv';
let element = document.createElement('a');
element.setAttribute('download', filename);
var data = new Blob([text]);
Expand Down
Loading

0 comments on commit 231c705

Please sign in to comment.