Commit 6c263443 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add draft model code to retrieve uniprot info from Protein

parent 2ded0768
......@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.db import models
from django.forms import ModelForm
from .ws import get_pubmed_info, get_epo_info
from .ws import get_pubmed_info, get_epo_info, get_uniprot_info
class Bibliography(models.Model):
......@@ -68,6 +68,12 @@ class Protein(models.Model):
organism = models.ForeignKey('Taxonomy')
molecular_functions = models.ManyToManyField(MolecularFunction)
def save(self, *args, **kwargs):
info = get_epo_info(self.id_source)
self.recommended_name_long = info['recommended_name']
self.organism = info['organism']
super(Protein, self).save(*args, **kwargs)
class Domain(models.Model):
pfam_acc = models.CharField('Pfam Accession', max_length=10, unique=True)
pfam_id = models.CharField('Pfam Family Identifier', max_length=20)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment