IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
vor 4 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #
  2. # Copyright (C) Stanislaw Adaszewski, 2020
  3. # License: GPLv3
  4. #
  5. from icosagon import Data
  6. import torch
  7. import pytest
  8. def test_data_01():
  9. d = Data()
  10. d.add_node_type('Gene', 1000)
  11. d.add_node_type('Drug', 100)
  12. dummy_0 = torch.zeros((100, 1000))
  13. dummy_1 = torch.zeros((1000, 100))
  14. dummy_2 = torch.zeros((100, 100))
  15. dummy_3 = torch.zeros((1000, 1000))
  16. fam = d.add_relation_family('Drug-Gene', 1, 0, True)
  17. fam.add_relation_type('Target', 1, 0, dummy_0)
  18. fam = d.add_relation_family('Gene-Gene', 0, 0, True)
  19. fam.add_relation_type('Interaction', 0, 0, dummy_3)
  20. fam = d.add_relation_family('Drug-Drug', 1, 1, True)
  21. fam.add_relation_type('Side Effect: Nausea', 1, 1, dummy_2)
  22. fam.add_relation_type('Side Effect: Infertility', 1, 1, dummy_2)
  23. fam.add_relation_type('Side Effect: Death', 1, 1, dummy_2)
  24. print(d)
  25. def test_data_02():
  26. d = Data()
  27. d.add_node_type('Gene', 1000)
  28. d.add_node_type('Drug', 100)
  29. dummy_0 = torch.zeros((100, 1000))
  30. dummy_1 = torch.zeros((1000, 100))
  31. dummy_2 = torch.zeros((100, 100))
  32. dummy_3 = torch.zeros((1000, 1000))
  33. fam = d.add_relation_family('Drug-Gene', 1, 0, True)
  34. with pytest.raises(ValueError):
  35. fam.add_relation_type('Target', 1, 0, dummy_1)
  36. fam = d.add_relation_family('Gene-Gene', 0, 0, True)
  37. with pytest.raises(ValueError):
  38. fam.add_relation_type('Interaction', 0, 0, dummy_2)
  39. fam = d.add_relation_family('Drug-Drug', 1, 1, True)
  40. with pytest.raises(ValueError):
  41. fam.add_relation_type('Side Effect: Nausea', 1, 1, dummy_3)
  42. with pytest.raises(ValueError):
  43. fam.add_relation_type('Side Effect: Infertility', 1, 1, dummy_3)
  44. with pytest.raises(ValueError):
  45. fam.add_relation_type('Side Effect: Death', 1, 1, dummy_3)
  46. print(d)
  47. def test_data_03():
  48. d = Data()
  49. d.add_node_type('Gene', 1000)
  50. d.add_node_type('Drug', 100)
  51. fam = d.add_relation_family('Drug-Gene', 1, 0, True)
  52. with pytest.raises(ValueError):
  53. fam.add_relation_type('Target', 1, 0, None)
  54. print(d)