Skip to content
Snippets Groups Projects
Commit 222e2c08 authored by Hartung, Michael's avatar Hartung, Michael
Browse files

linting

Former-commit-id: fae4e0e74ca47b936d239523c2bcaf91c8653c5e [formerly d6aaec3ce324eac873f78d2bb9c82c9ff43509d6]
Former-commit-id: bd46e2bd31eceec3ffe1c83e5b1c467e2f5f8103
parent 4463591a
No related branches found
No related tags found
No related merge requests found
......@@ -317,10 +317,14 @@ class ProteinProteinInteraction(models.Model):
class ProteinDrugInteraction(models.Model):
id = models.BigAutoField(primary_key=True)
pdi_dataset = models.ForeignKey(
PDIDataset, null=True, on_delete=models.CASCADE, related_name='pdi_dataset_relation')
protein = models.ForeignKey('Protein', on_delete=models.CASCADE)
drug = models.ForeignKey('Drug', on_delete=models.CASCADE)
actions = models.CharField(max_length=255, default='[]')
PDIDataset,
null=True,
on_delete=models.CASCADE,
related_name="pdi_dataset_relation",
)
protein = models.ForeignKey("Protein", on_delete=models.CASCADE)
drug = models.ForeignKey("Drug", on_delete=models.CASCADE)
actions = models.CharField(max_length=255, default="[]")
class Meta:
unique_together = ("pdi_dataset", "protein", "drug")
......@@ -329,7 +333,12 @@ class ProteinDrugInteraction(models.Model):
return f"{self.pdi_dataset}-{self.protein}-{self.drug}"
def __eq__(self, other):
return self.pdi_dataset_id == other.pdi_dataset_id and self.protein_id == other.protein_id and self.drug_id == other.drug_id and self.actions == other.actions
return (
self.pdi_dataset_id == other.pdi_dataset_id
and self.protein_id == other.protein_id
and self.drug_id == other.drug_id
and self.actions == other.actions
)
def __ne__(self, other):
return not self.__eq__(other)
......
......@@ -2,20 +2,31 @@
import json
from rest_framework import serializers
from drugstone import models
from drugstone.models import Protein, Task, Drug, ProteinDrugInteraction, \
Tissue, ProteinProteinInteraction, Network, ProteinDisorderAssociation, Disorder, DrugDisorderIndication
from drugstone.models import (
Protein,
Task,
Drug,
ProteinDrugInteraction,
Tissue,
ProteinProteinInteraction,
Network,
ProteinDisorderAssociation,
Disorder,
DrugDisorderIndication,
)
class PDIDatasetSerializer(serializers.ModelSerializer):
class Meta:
model = models.PDIDataset
fields = '__all__'
fields = "__all__"
class PPIDatasetSerializer(serializers.ModelSerializer):
class Meta:
model = models.PPIDataset
fields = '__all__'
fields = "__all__"
class PDisDatasetSerializer(serializers.ModelSerializer):
class Meta:
......@@ -176,7 +187,7 @@ class ProteinDrugInteractionSerializer(serializers.ModelSerializer):
class Meta:
model = ProteinDrugInteraction
fields = ['dataset', 'protein', 'drug', 'actions']
fields = ["dataset", "protein", "drug", "actions"]
class ProteinDisorderAssociationSerializer(serializers.ModelSerializer):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment