cellmaps-utils 0.1.0a22__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. cellmaps_utils-0.2.0/HISTORY.rst +22 -0
  2. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/PKG-INFO +20 -2
  3. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/README.rst +4 -0
  4. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/__init__.py +1 -1
  5. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/cellmaps_utilscmd.py +3 -3
  6. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/provenance.py +9 -12
  7. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/tabletool.py +84 -1
  8. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/PKG-INFO +20 -2
  9. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/SOURCES.txt +2 -0
  10. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/requires.txt +1 -1
  11. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/index.rst +4 -0
  12. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/setup.py +1 -1
  13. cellmaps_utils-0.2.0/tests/test_basecommandlinetool.py +38 -0
  14. cellmaps_utils-0.2.0/tests/test_helloworldcommand.py +35 -0
  15. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/tests/test_provenance.py +26 -0
  16. cellmaps_utils-0.1.0a22/HISTORY.rst +0 -8
  17. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/AUTHORS.rst +0 -0
  18. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/CONTRIBUTING.rst +0 -0
  19. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/LICENSE +0 -0
  20. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/MANIFEST.in +0 -0
  21. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/apmstool.py +0 -0
  22. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/basecmdtool.py +0 -0
  23. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/constants.py +0 -0
  24. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/crisprtool.py +0 -0
  25. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/exceptions.py +0 -0
  26. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/iftool.py +0 -0
  27. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/logutils.py +0 -0
  28. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils/music_utils.py +0 -0
  29. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/dependency_links.txt +0 -0
  30. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/not-zip-safe +0 -0
  31. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/cellmaps_utils.egg-info/top_level.txt +0 -0
  32. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/Makefile +0 -0
  33. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/_build/html/_static/file.png +0 -0
  34. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/_build/html/_static/minus.png +0 -0
  35. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/_build/html/_static/plus.png +0 -0
  36. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/authors.rst +0 -0
  37. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/cellmaps_utils.rst +0 -0
  38. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/conf.py +0 -0
  39. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/contributing.rst +0 -0
  40. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/devbranches.rst +0 -0
  41. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/developer.rst +0 -0
  42. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/history.rst +0 -0
  43. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/installation.rst +0 -0
  44. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/integrationtesting.rst +0 -0
  45. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/make.bat +0 -0
  46. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/modules.rst +0 -0
  47. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/newrelease.rst +0 -0
  48. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/pypircfile.rst +0 -0
  49. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/usage.rst +0 -0
  50. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/docs/versioningscheme.rst +0 -0
  51. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/setup.cfg +0 -0
  52. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/tests/__init__.py +0 -0
  53. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/tests/test_integation_provenance.py +0 -0
  54. {cellmaps_utils-0.1.0a22 → cellmaps_utils-0.2.0}/tests/test_logutils.py +0 -0
@@ -0,0 +1,22 @@
1
+ =======
2
+ History
3
+ =======
4
+
5
+ 0.2.0 (2024-02-20)
6
+ ------------------
7
+
8
+ * Bumped fairscape-cli dependency to ``0.1.14`` to support schemas
9
+
10
+ * Added support for ``schema`` to **data_dict** parameter in ``ProvenanceUtil.register_dataset()``
11
+
12
+ * Added ``--release`` flag to ``cellmaps_utilscmd.py rocratetable`` and
13
+ in output table renamed "Name of Computation" to "Name" as well as
14
+ added "Type", "Cell Line", "Treatment", "Gene set", and "Version" to
15
+ table output
16
+
17
+ * Set default logging level to ``ERROR`` for ``cellmaps_utilscmd.py`` command
18
+
19
+ 0.1.0 (2024-01-01)
20
+ ------------------
21
+
22
+ * First release on PyPI.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cellmaps_utils
3
- Version: 0.1.0a22
3
+ Version: 0.2.0
4
4
  Summary: Contains utilities needed by Cell Maps tools
5
5
  Home-page: https://github.com/idekerlab/cellmaps_utils
6
6
  Author: Cell Maps team
@@ -21,6 +21,10 @@ Description: =============================
21
21
  :target: https://cellmaps-utils.readthedocs.io/en/latest/?badge=latest
22
22
  :alt: Documentation Status
23
23
 
24
+ .. image:: https://zenodo.org/badge/599754117.svg
25
+ :target: https://zenodo.org/doi/10.5281/zenodo.10607322
26
+ :alt: Zenodo DOI badge
27
+
24
28
  Contains utilities needed by various tools in the cell maps toolkit.
25
29
 
26
30
 
@@ -116,7 +120,21 @@ Description: =============================
116
120
  History
117
121
  =======
118
122
 
119
- 0.1.0 (2023-05-01)
123
+ 0.2.0 (2024-02-20)
124
+ ------------------
125
+
126
+ * Bumped fairscape-cli dependency to ``0.1.14`` to support schemas
127
+
128
+ * Added support for ``schema`` to **data_dict** parameter in ``ProvenanceUtil.register_dataset()``
129
+
130
+ * Added ``--release`` flag to ``cellmaps_utilscmd.py rocratetable`` and
131
+ in output table renamed "Name of Computation" to "Name" as well as
132
+ added "Type", "Cell Line", "Treatment", "Gene set", and "Version" to
133
+ table output
134
+
135
+ * Set default logging level to ``ERROR`` for ``cellmaps_utilscmd.py`` command
136
+
137
+ 0.1.0 (2024-01-01)
120
138
  ------------------
121
139
 
122
140
  * First release on PyPI.
@@ -13,6 +13,10 @@ Cell Maps Pipeline Utilities
13
13
  :target: https://cellmaps-utils.readthedocs.io/en/latest/?badge=latest
14
14
  :alt: Documentation Status
15
15
 
16
+ .. image:: https://zenodo.org/badge/599754117.svg
17
+ :target: https://zenodo.org/doi/10.5281/zenodo.10607322
18
+ :alt: Zenodo DOI badge
19
+
16
20
  Contains utilities needed by various tools in the cell maps toolkit.
17
21
 
18
22
 
@@ -4,6 +4,6 @@
4
4
 
5
5
  __author__ = 'Cell Maps team'
6
6
  __email__ = 'tools@cm4ai.org'
7
- __version__ = '0.1.0a22'
7
+ __version__ = '0.2.0'
8
8
  __repo_url__ = 'https://github.com/idekerlab/cellmaps_utils'
9
9
  __description__ = 'Contains utilities needed by Cell Maps tools'
@@ -54,12 +54,12 @@ def _parse_arguments(desc, args):
54
54
  'logging.config.html#logging-config-fileformat '
55
55
  'Setting this overrides -v parameter which uses '
56
56
  ' default logger. (default None)')
57
- parser.add_argument('--verbose', '-v', action='count', default=0,
57
+ parser.add_argument('--verbose', '-v', action='count', default=1,
58
58
  help='Increases verbosity of logger to standard '
59
59
  'error for log messages in this module. Messages are '
60
60
  'output at these python logging levels '
61
- '-v = ERROR, -vv = WARNING, -vvv = INFO, '
62
- '-vvvv = DEBUG, -vvvvv = NOTSET (default no '
61
+ '-v = WARNING, -vv = INFO, '
62
+ '-vvv = DEBUG, -vvvv = NOTSET (default ERROR '
63
63
  'logging)')
64
64
  parser.add_argument('--version', action='version',
65
65
  version=('%(prog)s ' +
@@ -669,8 +669,9 @@ class ProvenanceUtil(object):
669
669
  cmd.append(entry)
670
670
  if used_dataset is not None:
671
671
  for entry in used_dataset:
672
- cmd.append('--used-dataset')
673
- cmd.append(entry)
672
+ if entry is not None:
673
+ cmd.append('--used-dataset')
674
+ cmd.append(entry)
674
675
 
675
676
  if generated is not None:
676
677
  for entry in generated:
@@ -703,11 +704,6 @@ class ProvenanceUtil(object):
703
704
  ``ro-crate-metadata.json`` file stored in **rocrate_path**
704
705
  directory.
705
706
 
706
- .. warning::
707
-
708
- `fairscape-cli <https://github.com/fairscape>`__ 0.1.5 always fails this call
709
- `See Issue #7 <https://github.com/fairscape/fairscape-cli/issues/7>`__
710
-
711
707
  :param name: Name of software
712
708
  :type name: str
713
709
  :param description: Description of software
@@ -791,14 +787,12 @@ class ProvenanceUtil(object):
791
787
  'date-published': 'Date dataset was published MM-DD-YYYY',
792
788
  'description': 'Description of dataset',
793
789
  'data-format': 'Format of data',
790
+ 'schema': Path or URL to schema file in JSON format
794
791
  'keywords': ['keyword1','keyword2']}
795
792
 
796
- .. warning::
793
+ .. versionchanged:: 0.2.0
797
794
 
798
- `fairscape-cli <https://github.com/fairscape>`__ 0.1.5 fails when
799
- skipping copy is ``True`` or if performing copy where
800
- **source_file** is already in **rocrate_path** directory.
801
- `See Issue #6 <https://github.com/fairscape/fairscape-cli/issues/6>`__
795
+ Added support for ``schema`` in **data_dict** passed in
802
796
 
803
797
 
804
798
  :param rocrate_path: Path to directory with registered rocrate
@@ -839,6 +833,9 @@ class ProvenanceUtil(object):
839
833
  else:
840
834
  cmd.extend(self._get_keywords(keywords=data_dict['keywords']))
841
835
 
836
+ if 'schema' in data_dict:
837
+ cmd.extend(['--schema', data_dict['schema']])
838
+
842
839
  if guid is None:
843
840
  guid = self._generate_guid(data_type='dataset',
844
841
  rocrate_path=rocrate_path)
@@ -23,7 +23,7 @@ class TableFromROCrates(BaseCommandLineTool):
23
23
 
24
24
  ID_COL = 'FAIRSCAPE ARK ID'
25
25
  DATE_COL = 'Date'
26
- COMPUTATION_COL = 'Name of Computation'
26
+ COMPUTATION_COL = 'Name'
27
27
  DESCRIPTION_COL = 'Description'
28
28
  KEYWORDS_COL = 'Keywords'
29
29
  DOWNLOAD_COL = 'Download RO-Crate Data Package'
@@ -31,8 +31,24 @@ class TableFromROCrates(BaseCommandLineTool):
31
31
  GENERATED_COL = 'Generated By Software'
32
32
  OUTPUT_COL = 'Output Dataset'
33
33
  RESPONSIBLE_COL = 'Responsible Lab'
34
+ TYPE_COL = 'Type'
35
+ CELL_LINE_COL = 'Cell Line'
36
+ TREATMENT_COL = 'Treatment'
37
+ GENESET_COL = 'Gene set'
38
+ VERSION_COL = 'Version'
39
+
40
+ DATA_ROCRATE = 'Data'
41
+ MODEL_ROCRATE = 'Model'
42
+ INTERMEDIATE_ROCRATE = 'Intermediate'
43
+ OTHER_ROCRATE = 'Other'
34
44
 
35
45
  COLUMNS = [ID_COL, DATE_COL,
46
+ VERSION_COL,
47
+ TYPE_COL,
48
+ CELL_LINE_COL,
49
+ TREATMENT_COL,
50
+ GENESET_COL,
51
+ GENERATED_COL,
36
52
  COMPUTATION_COL,
37
53
  DESCRIPTION_COL, KEYWORDS_COL,
38
54
  DOWNLOAD_COL,
@@ -54,10 +70,70 @@ class TableFromROCrates(BaseCommandLineTool):
54
70
  self._outdir = os.path.abspath(theargs.outdir)
55
71
  self._rocrates = theargs.rocrates
56
72
  self._date = theargs.date
73
+ self._version = theargs.release
57
74
  self._provenance_utils = provenance_utils
58
75
  self._downloadurlprefix = theargs.downloadurlprefix
59
76
  self._input_data_dict = theargs.__dict__
60
77
 
78
+ def _get_rocrate_type(self, compname):
79
+ """
80
+ Gets type of rocrate, which can be Data, Model, or Intermediate
81
+
82
+ :return:
83
+ :rtype: str
84
+ """
85
+ if compname in ['IF images', 'AP-MS', 'CRISPR']:
86
+ return TableFromROCrates.DATA_ROCRATE
87
+ if compname in ['Hierarchy']:
88
+ return TableFromROCrates.MODEL_ROCRATE
89
+ return TableFromROCrates.INTERMEDIATE_ROCRATE
90
+
91
+ def _get_cell_line(self, keywords):
92
+ """
93
+ Looks for cell line in keywords
94
+
95
+ :param keywords:
96
+ :type keywords: list
97
+ :return:
98
+ :rtype: str
99
+ """
100
+ if 'MDA-MB-468' in keywords:
101
+ return 'MDA-MB-468'
102
+ return 'Unknown'
103
+
104
+ def _get_treatment(self, keywords):
105
+ """
106
+ Gets treatment from keywords
107
+
108
+ :param keywords:
109
+ :return:
110
+ """
111
+ treatments = []
112
+ if 'untreated' in keywords:
113
+ treatments.append('untreated')
114
+ if 'vorinostat' in keywords:
115
+ treatments.append('vorinostat')
116
+ if 'paclitaxel' in keywords:
117
+ treatments.append('paclitaxel')
118
+ return ','.join(treatments)
119
+
120
+ def _get_geneset(self, keywords):
121
+ """
122
+ Gets treatment from keywords
123
+
124
+ :param keywords:
125
+ :return:
126
+ """
127
+ genesets = []
128
+
129
+ if 'chromatin' in keywords:
130
+ genesets.append('chromatin')
131
+ if 'metabolic' in keywords:
132
+ genesets.append('metabolic')
133
+ if len(genesets) == 0:
134
+ return 'Unknown'
135
+ return ','.join(genesets)
136
+
61
137
  def run(self):
62
138
  """
63
139
 
@@ -95,6 +171,11 @@ class TableFromROCrates(BaseCommandLineTool):
95
171
  logger.debug(rocrate + ': ' + 'Keywords: ' + str(prov_attrs.get_keywords()))
96
172
  row = {TableFromROCrates.ID_COL: self._provenance_utils.get_id_of_rocrate(rocrate=rocrate_dict),
97
173
  TableFromROCrates.DATE_COL: self._date,
174
+ TableFromROCrates.VERSION_COL: self._version,
175
+ TableFromROCrates.TYPE_COL: self._get_rocrate_type(comp_name),
176
+ TableFromROCrates.CELL_LINE_COL: self._get_cell_line(prov_attrs.get_keywords()),
177
+ TableFromROCrates.TREATMENT_COL: self._get_treatment(prov_attrs.get_keywords()),
178
+ TableFromROCrates.GENESET_COL: self._get_geneset(prov_attrs.get_keywords()),
98
179
  TableFromROCrates.COMPUTATION_COL: comp_name,
99
180
  TableFromROCrates.DESCRIPTION_COL: prov_attrs.get_description(),
100
181
  TableFromROCrates.KEYWORDS_COL: ','.join(prov_attrs.get_keywords()),
@@ -278,6 +359,8 @@ class TableFromROCrates(BaseCommandLineTool):
278
359
  help='Path to RO-Crates used for table generation. ')
279
360
  parser.add_argument('--date', default=date.today().strftime('%Y-%m-%d'),
280
361
  help='Date to list in table for RO-Crates')
362
+ parser.add_argument('--release', default='0.1 alpha',
363
+ help='Version of release')
281
364
  parser.add_argument('--downloadurlprefix', default='https://g-9b3b6e.9ad93.a567.data.globus.org/Data/cm4ai_0.1alpha/')
282
365
 
283
366
  return parser
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cellmaps-utils
3
- Version: 0.1.0a22
3
+ Version: 0.2.0
4
4
  Summary: Contains utilities needed by Cell Maps tools
5
5
  Home-page: https://github.com/idekerlab/cellmaps_utils
6
6
  Author: Cell Maps team
@@ -21,6 +21,10 @@ Description: =============================
21
21
  :target: https://cellmaps-utils.readthedocs.io/en/latest/?badge=latest
22
22
  :alt: Documentation Status
23
23
 
24
+ .. image:: https://zenodo.org/badge/599754117.svg
25
+ :target: https://zenodo.org/doi/10.5281/zenodo.10607322
26
+ :alt: Zenodo DOI badge
27
+
24
28
  Contains utilities needed by various tools in the cell maps toolkit.
25
29
 
26
30
 
@@ -116,7 +120,21 @@ Description: =============================
116
120
  History
117
121
  =======
118
122
 
119
- 0.1.0 (2023-05-01)
123
+ 0.2.0 (2024-02-20)
124
+ ------------------
125
+
126
+ * Bumped fairscape-cli dependency to ``0.1.14`` to support schemas
127
+
128
+ * Added support for ``schema`` to **data_dict** parameter in ``ProvenanceUtil.register_dataset()``
129
+
130
+ * Added ``--release`` flag to ``cellmaps_utilscmd.py rocratetable`` and
131
+ in output table renamed "Name of Computation" to "Name" as well as
132
+ added "Type", "Cell Line", "Treatment", "Gene set", and "Version" to
133
+ table output
134
+
135
+ * Set default logging level to ``ERROR`` for ``cellmaps_utilscmd.py`` command
136
+
137
+ 0.1.0 (2024-01-01)
120
138
  ------------------
121
139
 
122
140
  * First release on PyPI.
@@ -45,6 +45,8 @@ docs/_build/html/_static/file.png
45
45
  docs/_build/html/_static/minus.png
46
46
  docs/_build/html/_static/plus.png
47
47
  tests/__init__.py
48
+ tests/test_basecommandlinetool.py
49
+ tests/test_helloworldcommand.py
48
50
  tests/test_integation_provenance.py
49
51
  tests/test_logutils.py
50
52
  tests/test_provenance.py
@@ -1,4 +1,4 @@
1
- fairscape-cli==0.1.8
1
+ fairscape-cli==0.1.14
2
2
  scipy
3
3
  scikit-learn
4
4
  pandas
@@ -13,6 +13,10 @@ Cell Maps Utilities
13
13
  :target: https://cellmaps-utils.readthedocs.io/en/latest/?badge=latest
14
14
  :alt: Documentation Status
15
15
 
16
+ .. image:: https://zenodo.org/badge/599754117.svg
17
+ :target: https://zenodo.org/doi/10.5281/zenodo.10607322
18
+ :alt: Zenodo DOI badge
19
+
16
20
  Contains utilities needed by various tools in the cell maps toolkit.
17
21
 
18
22
  .. toctree::
@@ -28,7 +28,7 @@ with open('HISTORY.rst') as history_file:
28
28
  history = history_file.read()
29
29
 
30
30
 
31
- requirements = ['fairscape-cli==0.1.8',
31
+ requirements = ['fairscape-cli==0.1.14',
32
32
  'scipy',
33
33
  'scikit-learn',
34
34
  'pandas',
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """Tests for `BaseCommandLineTool`."""
5
+
6
+ import os
7
+ import argparse
8
+ import shutil
9
+ import tempfile
10
+ import unittest
11
+
12
+ from cellmaps_utils.exceptions import CellMapsError
13
+ from cellmaps_utils.basecmdtool import BaseCommandLineTool
14
+
15
+
16
+ class TestBaseCommandLineTool(unittest.TestCase):
17
+ """Tests for `BaseCommandLineTool`"""
18
+
19
+ def setUp(self):
20
+ """Set up test fixtures, if any."""
21
+
22
+ def tearDown(self):
23
+ """Tear down test fixtures, if any."""
24
+
25
+ def test_run(self):
26
+ cmdtool = BaseCommandLineTool()
27
+ try:
28
+ cmdtool.run()
29
+ self.fail('Expected exception')
30
+ except CellMapsError as ce:
31
+ self.assertTrue('Must be implemented by subclass' in str(ce))
32
+
33
+ def test_add_subparser(self):
34
+ try:
35
+ BaseCommandLineTool.add_subparser(None)
36
+ self.fail('Expected exception')
37
+ except CellMapsError as ce:
38
+ self.assertTrue('Must be implemented by subclass' in str(ce))
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """Tests for `HelloWorldCommand`."""
5
+
6
+ import os
7
+ import argparse
8
+ import shutil
9
+ import tempfile
10
+ import unittest
11
+ from unittest.mock import MagicMock
12
+
13
+ from cellmaps_utils.exceptions import CellMapsError
14
+ from cellmaps_utils.basecmdtool import HelloWorldCommand
15
+
16
+
17
+ class TestHelloWorldCommand(unittest.TestCase):
18
+ """Tests for `HelloWorldCommand`"""
19
+
20
+ def setUp(self):
21
+ """Set up test fixtures, if any."""
22
+
23
+ def tearDown(self):
24
+ """Tear down test fixtures, if any."""
25
+
26
+ def test_run(self):
27
+
28
+ cmdtool = HelloWorldCommand(MagicMock())
29
+ self.assertEqual(0, cmdtool.run())
30
+
31
+ def test_add_subparser(self):
32
+ subparsers = MagicMock()
33
+ subparsers.add_parser(return_value=True)
34
+ self.assertTrue(HelloWorldCommand.add_subparser(subparsers))
35
+
@@ -282,6 +282,32 @@ class TestProvenanceUtil(unittest.TestCase):
282
282
  finally:
283
283
  shutil.rmtree(temp_dir)
284
284
 
285
+ def test_register_dataset_with_schema(self):
286
+ temp_dir = tempfile.mkdtemp()
287
+ try:
288
+ subdir = os.path.join(temp_dir, 'input')
289
+ os.makedirs(subdir, mode=0o755)
290
+ src_file = os.path.join(subdir, 'xx')
291
+ with open(src_file, 'w') as f:
292
+ f.write('hi')
293
+
294
+ prov = ProvenanceUtil()
295
+ prov.register_rocrate(temp_dir, name='some 10 character name', description='10 character description')
296
+ d_id = prov.register_dataset(temp_dir,
297
+ source_file=src_file,
298
+ skip_copy=False,
299
+ data_dict={'name': 'Name of dataset',
300
+ 'author': 'Author of dataset',
301
+ 'version': 'Version of dataset',
302
+ 'date-published': 'Date dataset was published MM-DD-YYYY',
303
+ 'description': 'Description of dataset',
304
+ 'schema': 'https://foo.com',
305
+ 'data-format': 'Format of data'})
306
+ self.assertIsNotNone(d_id)
307
+
308
+ finally:
309
+ shutil.rmtree(temp_dir)
310
+
285
311
  def test_register_dataset_with_keywords(self):
286
312
 
287
313
  temp_dir = tempfile.mkdtemp()
@@ -1,8 +0,0 @@
1
- =======
2
- History
3
- =======
4
-
5
- 0.1.0 (2023-05-01)
6
- ------------------
7
-
8
- * First release on PyPI.