Skip to content

Commit

Permalink
new barcode category
Browse files Browse the repository at this point in the history
  • Loading branch information
pszgaspar committed Jul 9, 2018
1 parent bf3527e commit 645a53b
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 5 deletions.
120 changes: 120 additions & 0 deletions build/management/commands/build_g_proteins.py
Expand Up @@ -130,6 +130,126 @@ def handle(self, *args, **options):
# yaml.dump(dic, f, indent=4)
# return 0

# with open(self.barcode_data_file,'r') as bdf:
# bdf_lines = bdf.readlines()
# new_lines = []
# for line in bdf_lines:
# line_split = line.split(',')
# if line_split[4] in ['G.hgh4.09','G.hgh4.10','G.H4.01','G.H4.02','G.H4.03','G.H4.04','G.H4.05','G.H4.06','G.H4.07','G.H4.08','G.H4.09','G.H4.10','G.H4.11','G.H4.12','G.H4.13',
# 'G.H4.14','G.H4.15','G.H4.16','G.H4.17','G.H4.18','G.H4.19','G.H4.20','G.H4.21','G.H4.22','G.H4.23','G.H4.24','G.H4.25','G.H4.26','G.H4.27']:
# line_split[1] = str(0)
# line_split[2] = str(0)
# line_split[5] = str(0)+'\n'
# if line_split[4] in ['G.hgh4.09','G.hgh4.10']:
# if line_split[3] not in ['GNAS2', 'GNAL']:
# if line_split[4]=='G.hgh4.09':
# line_split[4] = 'G.H4.01'
# if line_split[4]=='G.hgh4.10':
# line_split[4] = 'G.H4.02'
# elif line_split[4]=='G.H4.01':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.11'
# else:
# line_split[4] = 'G.H4.03'
# elif line_split[4]=='G.H4.02':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.12'
# else:
# line_split[4] = 'G.H4.04'
# elif line_split[4]=='G.H4.03':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.13'
# else:
# line_split[4] = 'G.H4.05'
# elif line_split[4]=='G.H4.04':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.14'
# else:
# line_split[4] = 'G.H4.06'
# elif line_split[4]=='G.H4.05':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.15'
# else:
# line_split[4] = 'G.H4.07'
# elif line_split[4]=='G.H4.06':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.16'
# else:
# line_split[4] = 'G.H4.08'
# elif line_split[4]=='G.H4.07':
# if line_split[3] in ['GNAS2', 'GNAL']:
# line_split[4] = 'G.hgh4.17'
# else:
# line_split[4] = 'G.H4.09'
# if line_split[3] in ['GNAS2', 'GNAL']:
# if line_split[4]=='G.H4.08':
# line_split[4] = 'G.hgh4.18'
# elif line_split[4]=='G.H4.09':
# line_split[4] = 'G.hgh4.19'
# elif line_split[4]=='G.H4.10':
# line_split[4] = 'G.hgh4.20'
# elif line_split[4]=='G.H4.11':
# line_split[4] = 'G.hgh4.21'
# elif line_split[4]=='G.H4.12':
# line_split[4] = 'G.H4.01'
# elif line_split[4]=='G.H4.13':
# line_split[4] = 'G.H4.02'
# elif line_split[4]=='G.H4.14':
# line_split[4] = 'G.H4.03'
# elif line_split[4]=='G.H4.15':
# line_split[4] = 'G.H4.04'
# elif line_split[4]=='G.H4.16':
# line_split[4] = 'G.H4.05'
# elif line_split[4]=='G.H4.17':
# line_split[4] = 'G.H4.06'
# elif line_split[4]=='G.H4.18':
# line_split[4] = 'G.H4.07'
# elif line_split[4]=='G.H4.19':
# line_split[4] = 'G.H4.08'
# elif line_split[4]=='G.H4.20':
# line_split[4] = 'G.H4.10'
# elif line_split[4]=='G.H4.21':
# line_split[4] = 'G.H4.11'
# elif line_split[4]=='G.H4.22':
# line_split[4] = 'G.H4.12'
# elif line_split[4]=='G.H4.23':
# line_split[4] = 'G.H4.13'
# elif line_split[4]=='G.H4.24':
# line_split[4] = 'G.H4.14'
# elif line_split[4]=='G.H4.25':
# line_split[4] = 'G.H4.15'
# elif line_split[4]=='G.H4.26':
# line_split[4] = 'G.H4.16'
# elif line_split[4]=='G.H4.27':
# line_split[4] = 'G.H4.17'
# else:
# if line_split[4]=='G.H4.20':
# line_split[4] = 'G.H4.10'
# elif line_split[4]=='G.H4.21':
# line_split[4] = 'G.H4.11'
# elif line_split[4]=='G.H4.22':
# line_split[4] = 'G.H4.12'
# elif line_split[4]=='G.H4.23':
# line_split[4] = 'G.H4.13'
# elif line_split[4]=='G.H4.24':
# line_split[4] = 'G.H4.14'
# elif line_split[4]=='G.H4.25':
# line_split[4] = 'G.H4.15'
# elif line_split[4]=='G.H4.26':
# line_split[4] = 'G.H4.16'
# elif line_split[4]=='G.H4.27':
# line_split[4] = 'G.H4.17'
# new_lines.append(line_split)
# with open(os.sep.join([settings.DATA_DIR, 'g_protein_data', 'barcode_test.csv']), 'w') as f:
# out_lines = []
# for l in new_lines:
# out_line = ','.join(l)
# out_lines.append(out_line)
# out = ''.join(out_lines)
# f.write(out)

# return 0

if options['filename']:
filenames = options['filename']
else:
Expand Down
4 changes: 3 additions & 1 deletion build/management/commands/build_residue_sets.py
Expand Up @@ -64,7 +64,7 @@ def create_residue_sets(self):
],
'Gprotein Barcode': [
'cgn',
['G.hns1.02','G.hns1.03','G.S1.02','G.s2s3.01','G.S3.01','G.S3.03','G.H4.26','G.H4.27','G.h4s6.03','G.h4s6.20','G.H5.08','G.H5.11','G.H5.12',
['G.hns1.02','G.hns1.03','G.S1.02','G.s2s3.01','G.S3.01','G.S3.03','G.H4.16','G.H4.17','G.h4s6.03','G.h4s6.20','G.H5.08','G.H5.11','G.H5.12',
'G.H5.13','G.H5.15','G.H5.16','G.H5.17','G.H5.19','G.H5.20','G.H5.21','G.H5.22','G.H5.23','G.H5.24','G.H5.25','G.H5.26'],
'Barcode',
'gprotein'
Expand All @@ -89,9 +89,11 @@ def create_residue_sets(self):
for set_name in residue_sets.keys():
residues = []
for res in residue_sets[set_name][1]:
print(res)
try:
residues.append(ResidueGenericNumberEquivalent.objects.get(label=res, scheme__slug=residue_sets[set_name][0]))
except Exception as e:
print('ERROR: ', res)
print(e)
if residues:
try:
Expand Down
3 changes: 2 additions & 1 deletion common/diagrams.py
Expand Up @@ -114,7 +114,8 @@ def drawColorPanel(self, nobuttons=None):
output += ' <button style="width:220px;" onclick="ajaxPTMs(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show PTM sites</button>'
# output += ' <button style="width:220px;" onclick="ajaxCancerMutation(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show Cancer Mutations</button>'
# output += ' <button style="width:220px;" onclick="ajaxDiseaseMutation(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show Disease Mutations</button>'
output += '<br><button style="width:120px;" onclick="ajaxBarcode(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show Barcode</button>'
if 'human' in self.receptorId: # only show barcode button for human gproteins
output += '<br><button style="width:120px;" onclick="ajaxBarcode(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show Barcode</button>'
elif nobuttons == 'arrestin':
output += ' <button style="width:220px;" onclick="ajaxInterface(\''+self.type+'\',\''+str(self.receptorId)+'\')">Show Receptor Interface</button>'

Expand Down
4 changes: 4 additions & 0 deletions signprot/views.py
Expand Up @@ -342,6 +342,8 @@ def ajaxBarcode(request, slug, cutoff, **response_kwargs):

conserved = list(SignprotBarcode.objects.filter(protein__entry_name=slug, paralog_score__gte=cutoff, seq_identity__gte=cutoff).prefetch_related('residue__display_generic_number').values_list('residue__display_generic_number__label', flat=True))

na_data = list(SignprotBarcode.objects.filter(protein__entry_name=slug, seq_identity=0, paralog_score=0).values_list('residue__display_generic_number__label', flat=True))

all_positions = Residue.objects.filter(protein_conformation__protein__entry_name=slug).prefetch_related('display_generic_number')

for res in all_positions:
Expand All @@ -351,6 +353,8 @@ def ajaxBarcode(request, slug, cutoff, **response_kwargs):
jsondata[res] = [0, 'Conserved', cgn]
elif cgn in selectivity_pos and cgn not in conserved:
jsondata[res] = [1, 'Selectivity determining', cgn]
elif cgn in na_data:
jsondata[res] = [3, 'NA', cgn]
else:
jsondata[res] = [2, 'Evolutionary neutral', cgn]

Expand Down
3 changes: 3 additions & 0 deletions static/home/js/diagrams.js
Expand Up @@ -820,6 +820,9 @@ function ajaxBarcode(plotid,protein) {
} else if (val[1]=='Evolutionary neutral') {
color = "#f8dfb4";
extra = "\n" + String(val[1]);
} else if (val[1]=='NA') {
color = "#ffffff"
extra = "\n" + String(val[1]);
} else {
color = "#4dc7e6";
extra = "\n" + String(val[1]);
Expand Down
6 changes: 3 additions & 3 deletions structure/functions.py
Expand Up @@ -819,7 +819,7 @@ def select_chain(self):


class PdbStateIdentifier():
def __init__(self, structure, tm2_gn='2x41', tm6_gn='6x38', tm3_gn='3x44', tm7_gn='7x52', inactive_cutoff=2, intermediate_cutoff=7.5):
def __init__(self, structure, tm2_gn='2x41', tm6_gn='6x38', tm3_gn='3x44', tm7_gn='7x52', inactive_cutoff=2, intermediate_cutoff=7.15):
self.structure_type = None

try:
Expand All @@ -845,12 +845,12 @@ def __init__(self, structure, tm2_gn='2x41', tm6_gn='6x38', tm3_gn='3x44', tm7_g
self.structure = structure
self.structure_type = 'complex'
family = structure.receptor_protein.family
if tm2_gn=='2x41' and tm6_gn=='6x38' and tm3_gn=='3x44' and tm7_gn=='7x52' and inactive_cutoff==2 and intermediate_cutoff==7.5:
if tm2_gn=='2x41' and tm6_gn=='6x38' and tm3_gn=='3x44' and tm7_gn=='7x52' and inactive_cutoff==2 and intermediate_cutoff==7.15:
if family.slug.startswith('002') or family.slug.startswith('003'):
tm6_gn, tm7_gn = '6x33', '7x51'
inactive_cutoff, intermediate_cutoff = 2.5, 6
elif family.slug.startswith('004'):
inactive_cutoff, intermediate_cutoff = 5, 7.5
inactive_cutoff, intermediate_cutoff = 5, 7.15
self.tm2_gn, self.tm6_gn, self.tm3_gn, self.tm7_gn = tm2_gn, tm6_gn, tm3_gn, tm7_gn
self.inactive_cutoff = inactive_cutoff
self.intermediate_cutoff = intermediate_cutoff
Expand Down

0 comments on commit 645a53b

Please sign in to comment.