Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dcc6290
Changed tests to reflect actual results.
mathuin Jul 25, 2016
9130e24
Minor tweaks to tests.
mathuin Jul 25, 2016
3a2d3c8
Refactored occupancy select code.
mathuin Jul 25, 2016
45f7284
Minor fixes, rebuilt fixtures.
mathuin Jul 29, 2016
d0c2479
Cleaned up tests.
mathuin Jul 29, 2016
835d765
Minor modifications for line length and clarity.
mathuin Jul 29, 2016
1c7639a
Added new structure for tests.
mathuin Aug 4, 2016
34389f2
Fixed occupancy code again.
mathuin Aug 8, 2016
7ae1fd2
Reordered occupancy code, plus debugging.
mathuin Aug 11, 2016
1562602
Added check for structure parsing.
mathuin Aug 11, 2016
f397b7b
Added logging support.
mathuin Aug 24, 2016
744e3b5
Added argparse support for logging.
mathuin Aug 24, 2016
26c1b14
Enabled logging and pre-cleaning.
mathuin Aug 24, 2016
a284348
Fixed missing atom check.
mathuin Aug 25, 2016
23180f5
Properly trapped no-acceptable-altloc case.
mathuin Aug 25, 2016
a184dca
Disable debugging code.
mathuin Aug 25, 2016
d42ae8f
Fix for B factors, plus BioPython update.
mathuin Sep 14, 2016
a245ffb
Fixed division for B factors.
mathuin Sep 15, 2016
d5d511a
Fixed occupancy like B factor.
mathuin Sep 16, 2016
1382d31
Merge pull request #1 from mathuin/remove-undesirable-atoms
GiriB Sep 26, 2016
6eb80dc
Fix logging issue
GiriB Sep 26, 2016
617d1fb
Merge pull request #2 from GiriB/remove-undesirable-atoms
mathuin Sep 28, 2016
cb8d9b4
Removed hydrogen atoms.
mathuin Oct 17, 2016
a5a1fa3
Moved PGDSelect into its own file.
mathuin Oct 24, 2016
bac8c0d
Handled case where H is only disordered atom.
mathuin Oct 24, 2016
4ca6e1c
continue not break doh
mathuin Oct 24, 2016
fff0147
Cleaner handling of ordered residues.
mathuin Oct 27, 2016
bfb6ab1
Added support for icodes in select code.
mathuin Nov 4, 2016
da1ad95
Refactored AA_CHOICES to use BioPython values.
mathuin Nov 7, 2016
9434730
Removed hydrogen checks.
mathuin Nov 7, 2016
924719f
Disabled old prefilter, added is_hydrogen method.
mathuin Nov 15, 2016
6c32999
Removed MAINTAINER line.
mathuin Nov 30, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM centos:7

MAINTAINER OSU OSL [email protected]

EXPOSE 8000

# Dockerfiles do not support "here documents"
Expand Down
30 changes: 4 additions & 26 deletions pgd_constants.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
# The possible values for the 'aa' field (in Protein and elsewhere)
AA_CHOICES = (
('a', 'Ala'),
('r', 'Arg'),
('n', 'Asn'),
('d', 'Asp'),
('c', 'Cys'),
('q', 'Gln'),
('e', 'Glu'),
('g', 'Gly'),
('h', 'His'),
('i', 'Ile'),
('l', 'Leu'),
('k', 'Lys'),
('m', 'Met'),
('f', 'Phe'),
('p', 'Pro'),
('s', 'Ser'),
('t', 'Thr'),
('w', 'Trp'),
('y', 'Tyr'),
('v', 'Val'),
)
from Bio.Data.IUPACData import protein_letters_1to3
import operator

AA_CHOICES_DICT = {}
for choice in AA_CHOICES:
AA_CHOICES_DICT[choice[0]] = choice[1]
# The possible values for the 'aa' field (in Protein and elsewhere)
AA_CHOICES = sorted(protein_letters_1to3.items(), key=operator.itemgetter(1))

# The possible values for the 'ss' field (in Protein and elsewhere)
'''SS_CHOICES = (
Expand Down
15 changes: 11 additions & 4 deletions pgd_core/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import math

from django.db import models
from pgd_constants import AA_CHOICES, SS_CHOICES, AA_CHOICES_DICT
from pgd_constants import AA_CHOICES, SS_CHOICES
from django.contrib.auth.models import User
from Bio.Data.IUPACData import protein_letters_1to3


# Protein model
Expand All @@ -26,6 +27,9 @@ class Meta:
def __unicode__(self):
return self.code

def __str__(self):
return "<Protein %s>" % self.code

# Chain model
# Contains information about chains within a protein
#
Expand All @@ -43,6 +47,9 @@ class Chain (models.Model):
class Meta:
select_on_save = True

def __str__(self):
return "<Chain protein= code=%s>" % (self.protein.code, self.code)


class Sidechain_ARG(models.Model):
CB_CG = models.FloatField(null=True)
Expand Down Expand Up @@ -360,13 +367,13 @@ def __init__(self, *args, **kwargs):

def __getattribute__(self,name):
if name == 'aa_full':
return AA_CHOICES_DICT[self.aa]
return protein_letters_1to3[self.aa]
# normal attribute
else:
return object.__getattribute__(self, name)



def __str__(self):
return "<Residue protein=%s chain=%s oldID=%s>" % (self.protein.code, self.chain.code, self.oldID)


class Segmenter():
Expand Down
5 changes: 3 additions & 2 deletions pgd_search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
from django.contrib.auth.models import User

from pgd_core.models import Protein,Residue
from pgd_constants import AA_CHOICES, AA_CHOICES_DICT, SS_CHOICES
from pgd_constants import AA_CHOICES, SS_CHOICES
from pgd_splicer.sidechain import bond_lengths_string_dict, bond_angles_string_dict
from pgd_core.util import residue_indexes
from Bio.Data.IUPACData import protein_letters_1to3


range_re = re.compile("(?<=[^-<>=])-")
Expand Down Expand Up @@ -233,7 +234,7 @@ def compare(x,y):
# ... handle sidechain query strings ...
sidechain_fields = []
if search_res.aa:
for aa_type in [AA_CHOICES_DICT[aa].upper() for aa in search_res.aa]:
for aa_type in [protein_letters_1to3[aa].upper() for aa in search_res.aa]:
if aa_type in bond_lengths_string_dict:
field_base = '%s__%%s' % aa_type
for field in bond_lengths_string_dict[aa_type]:
Expand Down
2 changes: 1 addition & 1 deletion pgd_search/plot/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def renderToPNG(request):
height = 480

writer = io.BytesIO()
response = HttpResponse(mimetype="image/png")
response = HttpResponse(content_type="image/png")
response['Content-Disposition'] = 'attachment; filename="plot.png"'
svg.render_png(writer, width, height+30)
response.write(writer.getvalue())
Expand Down
7 changes: 4 additions & 3 deletions pgd_search/statistics/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from pgd_constants import AA_CHOICES, SS_CHOICES, AA_CHOICES_DICT
from pgd_constants import AA_CHOICES, SS_CHOICES
from pgd_search.statistics.aggregates import *
from pgd_search.statistics.directional_stddev import *
from pgd_search.statistics.form import StatsForm
from pgd_search.views import settings_processor
from pgd_splicer.sidechain import bond_angles_string_dict, bond_lengths_string_dict
from Bio.Data.IUPACData import protein_letters_1to3

stat_attributes = [('L1',u'C<sup>-1</sup>N'),
('L2',u'NC<sup>&alpha;</sup>'),
Expand Down Expand Up @@ -54,7 +55,7 @@
# rebuild bond angle list so they work with single letter codes
BOND_ANGLES = {}
BOND_LENGTHS = {}
for k, v in AA_CHOICES_DICT.items():
for k, v in protein_letters_1to3.items():
v = v.upper()
if v in bond_lengths_string_dict:
BOND_LENGTHS[k] = [s.replace('-','_') for s in bond_lengths_string_dict[v]]
Expand Down Expand Up @@ -207,7 +208,7 @@ def calculate_aa_statistics(queryset, aa, iIndex=0):
field_prefix = '%s%%s' % prefix

queryset = queryset.filter(**{'%saa'%prefix:aa})
full_aa = AA_CHOICES_DICT[aa].upper()
full_aa = protein_letters_1to3[aa].upper()

angles = []
if aa in BOND_LENGTHS:
Expand Down
4 changes: 2 additions & 2 deletions pgd_search/templatetags/search_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django import template
register = template.Library()

from pgd_constants import AA_CHOICES_DICT
from pgd_search.plot.PlotForm import PROPERTY_CHOICES_DICT
from Bio.Data.IUPACData import protein_letters_1to3


ROMAN_TO_GREEK = dict(
Expand All @@ -24,7 +24,7 @@ def full_aa(value):
"""
Filter that returns the full AA code from the 1 letter AA code
"""
return AA_CHOICES_DICT[value]
return protein_letters_1to3[value]
register.filter('full_aa',full_aa)


Expand Down
16 changes: 8 additions & 8 deletions pgd_search/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def testSearchCode(self):
)

def testSearchAa(self):
aa_range = ('a', 'r', 'n', 'd', 'c')
aa_range = ('A', 'R', 'N', 'D', 'C')
chainList = {}
for t in zip(range(1,6), aa_range):
i,aa_choice = t
Expand Down Expand Up @@ -400,7 +400,7 @@ def testSearchAa(self):
)

data['aa_i_0'] = 1
aa_choice = ('a', 'r', 'n')
aa_choice = ('A', 'R', 'N')
data['aa_0'] = (aa_choice)
search.data = data
#data['aa_i'] = 0
Expand All @@ -412,7 +412,7 @@ def testSearchAa(self):
)

data['aa_i_0'] = 0
aa_choice = ('a', 'r', 'n')
aa_choice = ('A', 'R', 'N')
data['aa_0'] = (aa_choice)
search.data = data
#data['aa_i'] = 0
Expand Down Expand Up @@ -776,14 +776,14 @@ def test_sidechain_statistics_present(self):
# Each row has one element for each angle or length.

ss_test_values = {
"aa_r": {
"aa_R": {
"CB_CG": {
"avg": "1.521",
"stddev": "0.014",
"avg": "1.523",
"stddev": "0.013",
},
"CA_CB_CG": {
"avg": "112.6",
"stddev": "2.8",
"avg": "112.5",
"stddev": "2.4",
},
},
}
Expand Down
Loading