Skip to content

Commit

Permalink
fixed GN in mutations table of the DB
Browse files Browse the repository at this point in the history
  • Loading branch information
gurdeep330 committed May 5, 2023
1 parent 8ab14f8 commit 3222121
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions DB/make_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import psycopg2
# from backports import zoneinfo
import pandas as pd
sys.path.insert(1, '../ML/')
import fetchData

def connection():
'''Function to connect to postgresql database'''
Expand Down Expand Up @@ -218,7 +220,8 @@ def fetch_mappings_dic():
def find_pfampos(mycursor, acc, uniprotPos)->None:
mycursor.execute("select pfampos from positions \
where acc=%s and uniprotpos=%s", (acc, uniprotPos))
pfamPos = mycursor.fetchone()[0]
pfamPos = mycursor.fetchone()
if pfamPos is not None: pfamPos = pfamPos[0]
return pfamPos

def create_mutations_table(mycursor)->None:
Expand All @@ -241,7 +244,9 @@ def create_mutations_table(mycursor)->None:
mutAA = line.split('\t')[4].replace(',', '')
if len(wtAA) > 1 or len(mutAA) > 1: continue
wtPos = str(line.split('\t')[3])
print (gene, acc, wtAA, wtPos, mutAA)
pfamPos = find_pfampos(mycursor, acc, wtPos)
if pfamPos is None: continue
mut_type = line.split('\t')[5]
# print (acc, kinases[acc].gene, wtAA, position, mutAA)
mutation = wtAA + wtPos + mutAA
Expand All @@ -258,6 +263,7 @@ def create_mutations_table(mycursor)->None:
for line in open('../AK_mut_w_sc_feb2023/res_mut_v3_only_subs_KD_neighb.tsv', 'r'):
if line.split('\t')[0] == 'uniprot_id': continue
acc = line.split('\t')[0]
acc, gene, uniprot_id, protein_name = fetchData.getAccGene(mycursor, acc)
wtAA = line.split('\t')[1]
mutAA = line.split('\t')[3]
if mutAA == 'X': continue
Expand All @@ -280,6 +286,7 @@ def create_mutations_table(mycursor)->None:
for line in open('../AK_mut_w_sc_feb2023/nat_mut_tidy_v2_march2023.tsv', 'r'):
if line.split('\t')[1] == 'UniProtID': continue
acc = line.split('\t')[1]
acc, gene, uniprot_id, protein_name = fetchData.getAccGene(mycursor, acc)
wtAA = line.split('\t')[2]
mutAA = line.split('\t')[4]
if mutAA == 'X': continue
Expand Down Expand Up @@ -509,8 +516,8 @@ def create_kinases_table(mycursor)->None:

# Create tables
# create_hmm_table(mycursor)
create_kinases_table(mycursor)
# create_mutations_table(mycursor)
# create_kinases_table(mycursor)
create_mutations_table(mycursor)
# create_homology_table(mycursor)
# create_ptm_table(mycursor)
# create_alignment_table(mycursor)
Expand Down
4 changes: 2 additions & 2 deletions webApp/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def makeText(acc, gene, mutation, hmmPos, mycursor):
row = []
row.append(ref_gene)
# row.append(ref_acc)
row.append('<a href=\"https://www.uniprot.org/uniprot/'+acc+'\" target=\"_blank\">'+acc+'<i class="bi bi-box-arrow-in-up-right"></i></a>')
row.append('<a href=\"https://www.uniprot.org/uniprot/'+ref_acc+'\" target=\"_blank\">'+ref_acc+'<i class="bi bi-box-arrow-in-up-right"></i></a>')
row.append(ref_mutation[0])
row.append(ref_mutation[1:-1])
row.append(ref_mutation[-1])
Expand Down Expand Up @@ -597,7 +597,7 @@ def get_SummaryTable(**kwargs):
# text += '<br><b>More information:</b><br>' + row['text']
# break

dic = {'data': data, 'acc': acc}
dic = {'data': data, 'acc': acc, 'gene': gene}
return jsonify(dic)

@app.route('/AJAXAlignment', methods=['GET', 'POST'])
Expand Down
2 changes: 1 addition & 1 deletion webApp/static/js/showSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function defineSummaryDataTable (tableID, uniqID, kinase, mutation, results)
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print', 'colvis',
{
text: "Show "+kinase+" instances only",
text: "Show "+response['gene']+" instances only",
action: function(e, dt, node, config){
dt.column(1).search(response['acc']).draw();
}
Expand Down

0 comments on commit 3222121

Please sign in to comment.