Skip to content

Commit

Permalink
Merge pull request #118 from ProteinsWebTeam/dev
Browse files Browse the repository at this point in the history
Release 97.0
  • Loading branch information
matthiasblum authored Nov 1, 2023
2 parents 2da6375 + b5d4463 commit d844f2a
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 80 deletions.
2 changes: 1 addition & 1 deletion config/interpro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ members:
panther:
filter: "panther"
label: "PANTHER"
accession: 'PTHR[0-9]{5}(:SF[0-9]{1,3})?$'
accession: 'PTHR[0-9]{5}(:SF[0-9]{1,4})?$'
options: []
options_per_family: []
pirsf:
Expand Down
2 changes: 1 addition & 1 deletion interpro/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from webfront.views import common, mail

urlpatterns = [
url(r"^api/mail/$", mail.mail_interhelp),
url(r"^api/mail/$", mail.send_email),
url(r"^api/(?P<url>.*)$", common.GeneralHandler.as_view()),
]
9 changes: 6 additions & 3 deletions webfront/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
class DeletedEntryError(Exception):
def __init__(self, accession, date, message, history):
def __init__(self, accession, database, _type, name, short_name, history, date):
self.accession = accession
self.message = message
self.date = date
self.database = database
self.type = _type
self.name = name
self.short_name = short_name
self.history = history
self.date = date


class EmptyQuerysetError(Exception):
Expand Down
18 changes: 18 additions & 0 deletions webfront/migrations/0023_rename_is_alive_entry_is_public.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2023-09-19 21:37

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('webfront', '0022_chain_sequence'),
]

operations = [
migrations.RenameField(
model_name='entry',
old_name='is_alive',
new_name='is_public',
),
]
18 changes: 18 additions & 0 deletions webfront/migrations/0024_entry_llm_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.19 on 2023-10-03 11:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('webfront', '0023_rename_is_alive_entry_is_public'),
]

operations = [
migrations.AddField(
model_name='entry',
name='llm_description',
field=models.TextField(null=True),
),
]
3 changes: 2 additions & 1 deletion webfront/models/interpro_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class Entry(models.Model):
)
go_terms = JSONField(null=True)
description = JSONField(null=True)
llm_description = models.TextField(null=True)
wikipedia = JSONField(null=True)
literature = JSONField(null=True)
hierarchy = JSONField(null=True)
cross_references = JSONField(null=True)
entry_date = models.DateTimeField(null=True)
is_featured = models.BooleanField(default=False)
overlaps_with = JSONField(default=[])
is_alive = models.BooleanField(default=False)
is_public = models.BooleanField(default=False)
deletion_date = models.DateTimeField(null=True)
counts = JSONField(null=True)
interactions = JSONField(null=True)
Expand Down
1 change: 1 addition & 0 deletions webfront/serializers/interpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def to_metadata_representation(instance, searcher, sq, counters=None):
# "other": instance.other_names,
},
"description": instance.description,
"llm_description": instance.llm_description,
"wikipedia": instance.wikipedia,
"literature": instance.literature,
"set_info": instance.set_info,
Expand Down
126 changes: 85 additions & 41 deletions webfront/tests/fixtures_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"source_database": "interpro",
"entry_date": "2001-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"member_databases": {
"smart": {
"SM00950": "Piwi domain"
Expand Down Expand Up @@ -173,7 +173,7 @@
"member_databases": {},
"entry_date": "2002-04-21T00:00:00Z",
"is_featured": false,
"is_alive": true,
"is_public": true,
"integrated": null,
"hierarchy": {
"children": [
Expand Down Expand Up @@ -284,7 +284,7 @@
"type": "domain",
"name": "Piwi domain",
"is_featured": true,
"is_alive": true,
"is_public": true,
"entry_date": "2003-04-21T00:00:00Z",
"short_name": "Piwi",
"go_terms": [
Expand Down Expand Up @@ -392,7 +392,7 @@
"name": "Piwi domain",
"entry_date": "2004-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"short_name": "Piwi",
"go_terms": [
{
Expand Down Expand Up @@ -432,7 +432,7 @@
"entry_date": "2001-04-21T00:00:00Z",
"name": "PIWI",
"is_featured": true,
"is_alive": true,
"is_public": true,
"short_name": "Piwi",
"go_terms": [],
"source_database": "profile",
Expand Down Expand Up @@ -461,7 +461,7 @@
"entry_id": "id3",
"type": "domain",
"is_featured": true,
"is_alive": true,
"is_public": true,
"entry_date": "2002-04-21T00:00:00Z",
"go_terms": [],
"source_database": "pfam",
Expand Down Expand Up @@ -491,7 +491,7 @@
"type": "domain",
"entry_date": "2002-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"go_terms": [],
"source_database": "pfam",
"member_databases": {},
Expand Down Expand Up @@ -521,7 +521,7 @@
"name": "Myelin family",
"entry_date": "2003-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"short_name": "Myelin",
"go_terms": [
{
Expand Down Expand Up @@ -563,7 +563,7 @@
"go_terms": [],
"entry_date": "2004-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"source_database": "profile",
"member_databases": null,
"integrated": null,
Expand Down Expand Up @@ -594,7 +594,7 @@
"go_terms": [],
"entry_date": "2014-04-21T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"source_database": "ncbifam",
"member_databases": null,
"integrated": null,
Expand All @@ -616,12 +616,13 @@
"model": "webfront.Entry",
"fields": {
"entry_id": null,
"accession": "IPR123456",
"type": "D",
"name": "Deleted",
"entry_date": "1994-04-21T00:00:00Z",
"deletion_date": "1994-04-21T00:00:00Z",
"is_alive": false,
"accession": "IPR000005",
"type": "domain",
"name": "HTH transcriptional regulator, AraC",
"short_name": "HTH_AraC",
"entry_date": "1999-10-08T17:07:25Z",
"deletion_date": "2010-10-28T10:51:29Z",
"is_public": true,
"source_database": "interpro",
"history": {
"names": [
Expand All @@ -630,32 +631,45 @@
"Helix-turn-helix, AraC type",
"HTH transcriptional regulator, AraC"
],
"signatures": [
{
"accession": "PS00041",
"exists": true,
"integrated_id": "IPR018062"
"short_names": [
"HTHAraC",
"HTH_AraC-typ",
"HTH_AraC"
],
"signatures": {
"prosite": {
"PS00041": "IPR018062"
},
{
"accession": "PR00032",
"exists": true,
"integrated_id": "IPR020449"
"pfam": {
"PF00165": "IPR018060"
},
{
"accession": "PF00165",
"exists": true,
"integrated_id": "IPR018060"
"prints": {
"PR00032": "IPR020449"
},
{
"accession": "PS01124",
"exists": true,
"integrated_id": "IPR018060"
"profile": {
"PS01124": "IPR018060"
},
{
"accession": "SM00342",
"exists": true,
"integrated_id": "IPR018060"
"smart": {
"SM00342": "IPR018060"
}
}
}
}
},
{
"model": "webfront.Entry",
"fields": {
"entry_id": null,
"accession": "PF20534",
"type": "domain",
"short_name": "DUF6749",
"entry_date": "2022-07-01T14:20:35Z",
"deletion_date": "2023-07-24T17:42:21Z",
"is_public": true,
"source_database": "pfam",
"history": {
"short_names": [
"DUF6749"
]
}
}
Expand All @@ -671,7 +685,7 @@
"go_terms": [],
"entry_date": "2014-03-02T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"source_database": "panther",
"member_databases": null,
"integrated": null,
Expand Down Expand Up @@ -703,7 +717,7 @@
"go_terms": [],
"entry_date": "2014-03-02T00:00:00Z",
"is_featured": true,
"is_alive": false,
"is_public": false,
"source_database": "panther",
"member_databases": null,
"integrated": "PTHR43214",
Expand Down Expand Up @@ -733,7 +747,7 @@
"go_terms": [],
"entry_date": "2004-03-02T00:00:00Z",
"is_featured": true,
"is_alive": true,
"is_public": true,
"source_database": "cathgene3d",
"member_databases": null,
"integrated": null,
Expand Down Expand Up @@ -763,7 +777,7 @@
"go_terms": [],
"entry_date": "2004-03-02T00:00:00Z",
"is_featured": true,
"is_alive": false,
"is_public": false,
"source_database": "cathgene3d",
"member_databases": null,
"integrated": "G3DSA:1.10.10.10",
Expand All @@ -780,5 +794,35 @@
"domain_architectures": 0
}
}
},
{
"model": "webfront.Entry",
"fields": {
"entry_id": null,
"accession": "PTHR10000",
"type": "family",
"name": "PHOSPHOSERINE PHOSPHATASE",
"source_database": "panther",
"llm_description": "<p>The protein family belongs to the HAD-like hydrolase superfamily and includes subfamilies such as the Cof family, CbbY/CbbZ/Gph/YieH family, SupH subfamily, the archaeal SPP-like hydrolase family, and the MPGP family. The proteins in this family function as phosphatases, catalyzing the dephosphorylation of various substrates. These include 2-phosphoglycolate, the riboflavin precursor 5-amino-6-(5-phospho-D-ribitylamino)uracil, flavin mononucleotide (FMN), pyridoxal-phosphate (PLP), and different sugar phosphates. Some proteins specifically hydrolyze mannosyl-3-phosphoglycerate (MPG) to form the osmolyte mannosylglycerate (MG), while others are involved in the biosynthesis of kanosamine and glucosylglycerate. The activity of these proteins can be inhibited by high concentrations of Ca(2+) ions and chloride ions.</p>",
"is_featured": false,
"is_public": true,
"entry_date": "2005-09-11T00:00:00Z",
"counts": {
"subfamilies": 8,
"domain_architectures": 0,
"interactions": 0,
"matches": 91777,
"pathways": 0,
"proteins": 91777,
"proteomes": 6899,
"sets": 0,
"structural_models": {
"alphafold": 79631,
"rosettafold": 0
},
"structures": 36,
"taxa": 28523
}
}
}
]
38 changes: 37 additions & 1 deletion webfront/tests/test_mail.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import time

from django.test import TestCase
from django.test import Client
from rest_framework import status


class TestMail(TestCase):
def test_mail(self):
def test_mail(self, sleep=60):
self.client = Client()
response = self.client.post(
"/api/mail/",
Expand All @@ -14,4 +17,37 @@ def test_mail(self):
"from_email": "swaathik@ebi.ac.uk",
},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()["from"], "swaathik@ebi.ac.uk")
time.sleep(sleep)

def test_spam(self):
self.test_mail(sleep=0)
self.client = Client()
response = self.client.post(
"/api/mail/",
{
"path": "echo",
"subject": "Add annotation test from API",
"message": "Test",
"from_email": "swaathik@ebi.ac.uk",
},
)
self.assertEqual(response.status_code,
status.HTTP_429_TOO_MANY_REQUESTS)
time.sleep(60)

def test_mail_invalid_queue(self):
self.client = Client()
response = self.client.post(
"/api/mail/",
{
"path": "echo",
"subject": "Add annotation test from API",
"message": "Test",
"queue": "uniprot",
"from_email": "swaathik@ebi.ac.uk",
},
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
time.sleep(60)
Loading

0 comments on commit d844f2a

Please sign in to comment.