diff --git a/pgd/pgd_core/models.py b/pgd/pgd_core/models.py
index 5da558e..50bbd29 100644
--- a/pgd/pgd_core/models.py
+++ b/pgd/pgd_core/models.py
@@ -8,7 +8,7 @@ class Protein(models.Model):
code = models.CharField(max_length=4, primary_key=True, unique=True)
threshold = models.IntegerField() # new type; this should probably be a boolean type
resolution = models.FloatField(db_index=True)
- rfactor = models.FloatField()
+ rfactor = models.FloatField(db_index=True)
def __unicode__(self):
return self.code
diff --git a/pgd/pgd_search/models.py b/pgd/pgd_search/models.py
index 871af91..e84cb29 100644
--- a/pgd/pgd_search/models.py
+++ b/pgd/pgd_search/models.py
@@ -33,6 +33,8 @@ class Search(models.Model):
threshold = models.IntegerField(null=True)
resolution_min = models.FloatField(null=True)
resolution_max = models.FloatField(null=True)
+ rfactor_min = models.FloatField(null=True)
+ rfactor_max = models.FloatField(null=True)
segmentLength = models.IntegerField()
_querySet = None
@@ -70,6 +72,14 @@ class Search(models.Model):
if self.resolution_max != None:
query = query.filter(protein__resolution__lte=self.resolution_max)
+ # ...filter by rfactor...
+ if self.resolution_min != None:
+ query = query.filter(protein__rfactor__gte=self.rfactor_min)
+
+ # ...filter by rfactor...
+ if self.resolution_max != None:
+ query = query.filter(protein__rfactor__lte=self.rfactor_max)
+
# ...filter by threshold...
if self.threshold != None:
query = query.filter(protein__threshold__lte=self.threshold)
diff --git a/pgd/pgd_search/search/SearchForm.py b/pgd/pgd_search/search/SearchForm.py
index cfaffd6..622fb49 100644
--- a/pgd/pgd_search/search/SearchForm.py
+++ b/pgd/pgd_search/search/SearchForm.py
@@ -47,6 +47,8 @@ class SearchFormBase(forms.Form):
threshold = forms.ChoiceField(choices=[(25,25),(90,90)], required=False)
resolutionMin = forms.FloatField(required=False, min_value=0, initial=0, widget=forms.TextInput(attrs={'size':3}))
resolutionMax = forms.FloatField(required=False, min_value=0, initial=1.5, widget=forms.TextInput(attrs={'size':3}))
+ rfactorMin = forms.FloatField(required=False, min_value=0, initial=0, widget=forms.TextInput(attrs={'size':3}))
+ rfactorMax = forms.FloatField(required=False, min_value=0, initial=0.30, widget=forms.TextInput(attrs={'size':3}))
proteins = forms.ModelMultipleChoiceField(queryset=Protein.objects.all().order_by('code'), required=False, widget=forms.SelectMultiple(attrs={'class':'field'}))
proteins_i = forms.IntegerField(required=False, widget=forms.HiddenInput(attrs={'class':'include'}))
residues = forms.ChoiceField(choices=[(i,i) for i in range(1, searchSettings.segmentSize+1)], initial=5)
diff --git a/pgd/pgd_search/search/views.py b/pgd/pgd_search/search/views.py
index 65c0fcf..6e8f81b 100644
--- a/pgd/pgd_search/search/views.py
+++ b/pgd/pgd_search/search/views.py
@@ -164,6 +164,8 @@ def processSearchForm(form):
search.segmentLength = int(data['residues'])
search.resolution_min = float(data['resolutionMin'])
search.resolution_max = float(data['resolutionMax'])
+ search.rfactor_min = float(data['rfactorMin'])
+ search.rfactor_max = float(data['rfactorMax'])
search.threshold = int(data['threshold'])
#save search object so its residue parameters can be added
@@ -221,6 +223,8 @@ def processSearchObject(search):
'residues' :search.segmentLength,
'resolutionMin' :search.resolution_min,
'resolutionMax' :search.resolution_max,
+ 'rfactorMin' :search.rfactor_min,
+ 'rfactorMax' :search.rfactor_max,
'threshold' :search.threshold
}
diff --git a/pgd/pgd_search/templates/help.html b/pgd/pgd_search/templates/help.html
index 7cec4ce..c5097ac 100644
--- a/pgd/pgd_search/templates/help.html
+++ b/pgd/pgd_search/templates/help.html
@@ -56,6 +56,8 @@ Residues: How many residues are in the motif you want to search for?
Resolution: What resolution of crystal structures is searched?
+R-factor: What R-factors of crystal structures are searched?
+
Threshold: This is the maximum sequence identity between any pair of proteins in the PGD (Hobohm et al., 1992)
diff --git a/pgd/pgd_search/templates/search.html b/pgd/pgd_search/templates/search.html
index ddf666e..46c34b0 100644
--- a/pgd/pgd_search/templates/search.html
+++ b/pgd/pgd_search/templates/search.html
@@ -370,6 +370,10 @@