Skip to content
This repository has been archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Release beta 11
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed Mar 6, 2019
2 parents 8adc424 + 7612bbe commit f95b7fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="hca-metadata-api",
version="1.0b10",
version="1.0b11",
license='MIT',
install_requires=[
'dataclasses >= 0.6'
Expand Down
8 changes: 8 additions & 0 deletions src/humancellatlas/data/metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ class Project(Entity):
project_description: Optional[str] # optional up to core/project/5.2.2/project_core
publications: Set[ProjectPublication]
contributors: Set[ProjectContact]
insdc_project_accessions: Set[str]
geo_series_accessions: Set[str]
array_express_accessions: Set[str]
insdc_study_accessions: Set[str]

def __init__(self, json: JSON) -> None:
super().__init__(json)
Expand All @@ -155,6 +159,10 @@ def __init__(self, json: JSON) -> None:
self.publications = set(ProjectPublication.from_json(publication)
for publication in content.get('publications', []))
self.contributors = {ProjectContact.from_json(contributor) for contributor in content['contributors']}
self.insdc_project_accessions = set(content.get('insdc_project_accessions', []))
self.geo_series_accessions = set(content.get('geo_series_accessions', []))
self.array_express_accessions = set(content.get('array_express_accessions', []))
self.insdc_study_accessions = set(content.get('insdc_study_accessions', []))

@property
def laboratory_names(self) -> set:
Expand Down
24 changes: 23 additions & 1 deletion test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ def test_ontology_label_field(self):
project_roles={None, 'principal investigator', 'Human Cell Atlas wrangler'},
library_construction_methods={"10X v2 sequencing"})

def test_accessions_fields(self):
self._test_bundle(uuid='fa5be5eb-2d64-49f5-8ed8-bd627ac9bc7a',
version='2019-02-14T192438.034764Z',
deployment='staging',
diseases={'H syndrome'},
project_roles={'principal investigator'},
age_range=AgeRange(630720000.0, 630720000.0),
library_construction_methods={'10X v2 sequencing'},
insdc_project_accessions={'SRP000000'},
geo_series_accessions={'GSE00000'},
array_express_accessions={'E-AAAA-00'},
insdc_study_accessions={'PRJNA000000'})

def _test_bundle(self, uuid, deployment=None, replica='aws', version=None, **assertion_kwargs):
client = dss_client(deployment)
version, manifest, metadata_files = download_bundle_metadata(client, replica, uuid, version)
Expand All @@ -224,7 +237,11 @@ def _assert_bundle(self, uuid, version, manifest, metadata_files,
project_roles=frozenset({None}),
storage_methods=frozenset({None}),
preservation_methods=frozenset({None}),
library_construction_methods=frozenset()):
library_construction_methods=frozenset(),
insdc_project_accessions=frozenset(),
geo_series_accessions=frozenset(),
array_express_accessions=frozenset(),
insdc_study_accessions=frozenset()):
bundle = Bundle(uuid, version, manifest, metadata_files)
biomaterials = bundle.biomaterials.values()
actual_diseases = set(chain(*(bm.diseases for bm in biomaterials
Expand All @@ -251,6 +268,11 @@ def _assert_bundle(self, uuid, version, manifest, metadata_files,
# noinspection PyDeprecation
self.assertEqual(project.project_short_name, project.project_shortname)

self.assertEqual(insdc_project_accessions, project.insdc_project_accessions)
self.assertEqual(geo_series_accessions, project.geo_series_accessions)
self.assertEqual(array_express_accessions, project.array_express_accessions)
self.assertEqual(insdc_study_accessions, project.insdc_study_accessions)

root_entities = bundle.root_entities().values()
root_entity_types = {type(e) for e in root_entities}
self.assertIn(DonorOrganism, root_entity_types)
Expand Down

0 comments on commit f95b7fc

Please sign in to comment.