Commit 1d9fdf2a authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

Merge branch 'master' into 'contributor-page'

Master

See merge request !36
parents 65c97f0a 3462dd28
Pipeline #77875 failed with stage
in 43 minutes and 59 seconds
......@@ -34,7 +34,12 @@ class Command(AppCommand):
help = "Load Cavities from global csv file and delete all Cavities not present in the csv"
def __init__(
self, stdout=None, stderr=None, no_color=False, force_color=False, task=None,
self,
stdout=None,
stderr=None,
no_color=False,
force_color=False,
task=None,
):
super(Command, self).__init__(
stdout=stdout, stderr=stderr, no_color=no_color, force_color=force_color
......@@ -113,5 +118,16 @@ class Command(AppCommand):
)
if delete:
pdb.delete()
pdbs = PDB.objects.filter(chain__cavity=None)
for pdb in pdbs:
if pdb.no_cavities():
clean = 1
self.stdout.write(
self.style.WARNING("WARNING {} has no cavities".format(pdb.code))
)
if delete:
pdb.delete()
if not clean:
self.stdout.write(self.style.SUCCESS("No PDB to remove"))
......@@ -90,6 +90,16 @@ class PDB(models.Model):
else:
return False
def no_cavities(self):
chains = self.chain_set.all()
cavity_num = 0
for chain in chains:
cavity_num += chain.cavity_set.count()
if cavity_num:
return False
else:
return True
def __unicode__(self):
partners = ""
onprot = ""
......
......@@ -516,8 +516,8 @@ class TestGetDoiInfo(TestCase):
self.assertEqual(resp["biblio_year"], 2008)
self.assertEqual(
resp["authors_list"],
"Dephoure N., Zhou C., Villen J., Beausoleil S. A., "
"Bakalarski C. E., Elledge S. J., Gygi S. P.",
"Dephoure Noah, Zhou Chunshui, Villén Judit, Beausoleil Sean A., "
"Bakalarski Corey E., Elledge Stephen J., Gygi Steven P.",
)
......
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