import DISNET.objects.DisnetObject as DisnetObject import DISNET.objects.ProteinObject as ProteinObject class PPISObject(DisnetObject.DisnetObject): """Class to instance objects of type PPIS""" def __init__(self, protein1: ProteinObject.ProteinObject, protein2: ProteinObject.ProteinObject): DisnetObject.DisnetObject.__init__(self, protein1.getId() + protein2.getId() + "") self.__protein1 = protein1 self.__protein2 = protein1 def getProtein1(self) -> ProteinObject.ProteinObject: """Returns the first protein of the PPIS""" return self.__protein1 def getProtein2(self) -> ProteinObject.ProteinObject: """Returns the second protein of the PPIS""" return self.__protein2 def info(self) -> str: """Returns the information of the PPIS as a string""" return "PPISObject: [protein1: " + str(self.__protein1) + ", protein2: " + str(self.__protein2) + "]" def __eq__(self, other) -> bool: """Equals to other PPIS""" if isinstance(other, PPISObject): equalP1 = self.__protein1.getId() == other.getProtein1().getId() equalID = self.getId() == other.getId() equalP2 = self.__protein2.getId() == other.getProtein2().getId() return equalID and equalP1 and equalP2 else: return False