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!
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 4 roky
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. d.add_relation_type('Target', 1, 0, dummy_0)
  17. d.add_relation_type('Interaction', 0, 0, dummy_3)
  18. d.add_relation_type('Side Effect: Nausea', 1, 1, dummy_2)
  19. d.add_relation_type('Side Effect: Infertility', 1, 1, dummy_2)
  20. d.add_relation_type('Side Effect: Death', 1, 1, dummy_2)
  21. print(d)
  22. def test_data_02():
  23. d = Data()
  24. d.add_node_type('Gene', 1000)
  25. d.add_node_type('Drug', 100)
  26. dummy_0 = torch.zeros((100, 1000))
  27. dummy_1 = torch.zeros((1000, 100))
  28. dummy_2 = torch.zeros((100, 100))
  29. dummy_3 = torch.zeros((1000, 1000))
  30. with pytest.raises(ValueError):
  31. d.add_relation_type('Target', 1, 0, dummy_1)
  32. with pytest.raises(ValueError):
  33. d.add_relation_type('Interaction', 0, 0, dummy_2)
  34. with pytest.raises(ValueError):
  35. d.add_relation_type('Side Effect: Nausea', 1, 1, dummy_3)
  36. with pytest.raises(ValueError):
  37. d.add_relation_type('Side Effect: Infertility', 1, 1, dummy_3)
  38. with pytest.raises(ValueError):
  39. d.add_relation_type('Side Effect: Death', 1, 1, dummy_3)
  40. print(d)
  41. def test_data_03():
  42. d = Data()
  43. d.add_node_type('Gene', 1000)
  44. d.add_node_type('Drug', 100)
  45. with pytest.raises(ValueError):
  46. d.add_relation_type('Target', 1, 0, None)
  47. print(d)