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

Commit

Permalink
Release beta 13
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed Apr 6, 2019
2 parents 3cf7b70 + bb3c2cb commit c7bfcc5
Show file tree
Hide file tree
Showing 30 changed files with 22,593 additions and 42 deletions.
5 changes: 3 additions & 2 deletions 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.0b12",
version="1.0b13",
license='MIT',
install_requires=[
'dataclasses >= 0.6'
Expand All @@ -21,7 +21,8 @@
'coveralls'
],
"test": [
'checksumming_io == 0.0.1'
'checksumming_io == 0.0.1',
'atomicwrites == 1.3.0'
]
},
package_dir={'': 'src'},
Expand Down
32 changes: 30 additions & 2 deletions src/humancellatlas/data/metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ def accept(self, visitor: 'EntityVisitor') -> None:


class TypeLookupError(Exception):

def __init__(self, described_by: str) -> None:
super().__init__(f"No entity type for schema URL '{described_by}'")


class EntityVisitor(ABC):

@abstractmethod
def visit(self, entity: 'Entity') -> None:
raise NotImplementedError()
Expand Down Expand Up @@ -101,6 +103,7 @@ def accept(self, visitor: EntityVisitor):


class LinkError(RuntimeError):

def __init__(self, entity: LinkedEntity, other_entity: Entity, forward: bool) -> None:
super().__init__(entity.address +
' cannot ' + ('reference ' if forward else 'be referenced by ') +
Expand Down Expand Up @@ -158,7 +161,7 @@ def __init__(self, json: JSON) -> None:
self.project_description = core.get('project_description')
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.contributors = {ProjectContact.from_json(contributor) for contributor in content.get('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', []))
Expand Down Expand Up @@ -275,6 +278,15 @@ def organ_part(self):
raise AttributeError(msg)


@dataclass(init=False)
class ImagedSpecimen(Biomaterial):
slice_thickness: Union[float, int]

def __init__(self, json: JSON) -> None:
super().__init__(json)
self.slice_thickness = json['slice_thickness']


@dataclass(init=False)
class CellSuspension(Biomaterial):
estimated_cell_count: Optional[int]
Expand Down Expand Up @@ -358,13 +370,15 @@ class AnalysisProcess(Process):

@dataclass(init=False)
class DissociationProcess(Process):

def __init__(self, json: JSON) -> None:
warnings.warn(f"{type(self)} is deprecated", DeprecationWarning)
super().__init__(json)


@dataclass(init=False)
class EnrichmentProcess(Process):

def __init__(self, json: JSON) -> None:
warnings.warn(f"{type(self)} is deprecated", DeprecationWarning)
super().__init__(json)
Expand Down Expand Up @@ -481,6 +495,11 @@ class ImagingProtocol(Protocol):
pass


@dataclass(init=False)
class ImagingPreparationProtocol(Protocol):
pass


@dataclass
class ManifestEntry:
content_type: str
Expand Down Expand Up @@ -557,6 +576,11 @@ class ReferenceFile(File):
pass


@dataclass(init=False)
class ImageFile(File):
pass


@dataclass
class Link:
source_id: UUID4
Expand Down Expand Up @@ -632,7 +656,7 @@ def from_json_v5(core_cls: Type[E], file_name, key=None, **kwargs) -> MutableMap
assert file_name.endswith('.json')
schema_name, _, suffix = file_name[:-5].rpartition('_')
if schema_name and suffix.isdigit():
entity_cls = entity_types.get(schema_name)
entity_cls = entity_types[schema_name]
core_cls = core_types[entity_cls]
json_by_core_cls[core_cls].append(json)

Expand Down Expand Up @@ -667,6 +691,7 @@ def root_entities(self) -> Mapping[UUID4, LinkedEntity]:
roots = {}

class RootFinder(EntityVisitor):

def visit(self, entity: Entity) -> None:
if isinstance(entity, LinkedEntity) and not entity.parents:
roots[entity.document_id] = entity
Expand Down Expand Up @@ -700,12 +725,14 @@ def sequencing_output(self) -> List[SequenceFile]:
'cell_suspension': CellSuspension,
'cell_line': CellLine,
'organoid': Organoid,
'imaged_specimen': ImagedSpecimen,

# Files
'analysis_file': AnalysisFile,
'reference_file': ReferenceFile,
'sequence_file': SequenceFile,
'supplementary_file': SupplementaryFile,
'image_file': ImageFile,

# Protocols
'protocol': Protocol,
Expand All @@ -719,6 +746,7 @@ def sequencing_output(self) -> List[SequenceFile]:
'imaging_protocol': ImagingProtocol,
'library_preparation_protocol': LibraryPreparationProtocol,
'sequencing_protocol': SequencingProtocol,
'imaging_preparation_protocol': ImagingPreparationProtocol,

'project': Project,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
[
{
"crc32c": "1C09FCE0",
"sha1": "f1aeb2b94ce28ee524388730c9b63b7dafc895c7",
"sha256": "b3f554280c892aecfc235a64f924843b2484f73cb0cd21aacdd1d796383a6d69",
"s3_etag": "bceb1c61bab478faf3f70e0ff832b4c0",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "cell_suspension_0.json",
"size": 770,
"uuid": "84354fad-8890-41df-b808-48f9ed4e1cc3",
"version": "1"
},
{
"crc32c": "28EA16F2",
"sha1": "7cc7ac34f3c2c00befb398a63b5303d636ca4711",
"sha256": "de429783e1308851f7f5e8320d8612e7c1ad90975698fec9a481c836db2e9543",
"s3_etag": "61eb8b831af8c1fdf1105ee9cb66fb16",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "dissociation_protocol_0.json",
"size": 711,
"uuid": "30cf9805-82f5-4725-a7ad-7411c276b4a9",
"version": "1"
},
{
"crc32c": "C2C08857",
"sha1": "8f1b7481a5dc77f3a6c90530a957952102a92e35",
"sha256": "94be68544f8a5a0171fd918e070150a29fa1c8f4380ec351a302bb56b980b491",
"s3_etag": "d98de4db8b42b8def2aa2591da2f8569",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "donor_organism_0.json",
"size": 1358,
"uuid": "491a22fb-3a6c-4a8f-9c5b-f009e080d280",
"version": "1"
},
{
"crc32c": "0B85C35C",
"sha1": "dd9a81c11165c742d94b1cb8561e3789854a8ca7",
"sha256": "e215aceb61560e510592eb1f4247c501ea0d756659bd781d995df0546ecb9696",
"s3_etag": "abc3a4a3dbec4beab0e2cacf50b831c4",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "library_preparation_protocol_0.json",
"size": 1087,
"uuid": "821601f1-64e8-4427-8680-34a743b35b69",
"version": "1"
},
{
"crc32c": "DDAABBB6",
"sha1": "82c4c5273e31923bf6e12139804c3a4cf10b338d",
"sha256": "3de258c171a757d80e53a617ce1834e14710c87db0289c9b2012d0a14a3ea705",
"s3_etag": "4dc6069c891063f28a0ee155c6cd7b65",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "links.json",
"size": 1856,
"uuid": "04e79979-489e-4cd8-93c3-1d8e99d09ec8",
"version": "1"
},
{
"crc32c": "522D96A7",
"sha1": "9876adb67827ea0328566811a1304bcf49a31b02",
"sha256": "ecc1b1a2cd924933311c28e9b00f841c0beaa918f3c29722a36ff3fa6600440b",
"s3_etag": "4f939c7dae692b468e4741b56ccfbe3e",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "process_0.json",
"size": 386,
"uuid": "c4175b47-1767-48c5-b408-f9e97c01f94e",
"version": "1"
},
{
"crc32c": "51B043A0",
"sha1": "9b17c9cd8e3d7c3bc4685e24bbcba9e528792d05",
"sha256": "98d9878e05b6a56fed6d00153aa5c0664de07185994e2cf080ec1be4b4776933",
"s3_etag": "8ff1e91a29e51311d5252889599eb709",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "process_1.json",
"size": 386,
"uuid": "88b3b728-e9c6-4b1b-a030-97f6670469c2",
"version": "1"
},
{
"crc32c": "1FAD27D0",
"sha1": "b2a61619fa1922cb899d993aace4fa0f6b30a232",
"sha256": "31eab93a5c0e39c58ee16d16c0ce5331e2185cc271891fbd63e7f62a75336e4b",
"s3_etag": "a781ef10618d4bd5c11bf5bb923d4d12",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "process_2.json",
"size": 384,
"uuid": "317b3c35-e0f6-48d6-9154-80db47ff8f20",
"version": "1"
},
{
"crc32c": "68AEC241",
"sha1": "1296d3c9b98cef091f1aecd6d9df25fa7f780d5c",
"sha256": "c9cd608014bb3cfd7b0ab891cd597272f0e860f0d5e7f0eab38338d828ba2bec",
"s3_etag": "93f27be5baa191e55406b1b54af4bd1e",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "project_0.json",
"size": 6018,
"uuid": "a34d2ddc-1433-4a3c-b1de-ad3a26adca9e",
"version": "1"
},
{
"crc32c": "29B559F9",
"sha1": "0587673d7d88efa40a6f4d25d34d2eba14cf8e8b",
"sha256": "df8b88b6f32f494a53687f79724a6ebd8bbb9c5c0474b9a857d467a0bdb83c2d",
"s3_etag": "ef8edc4bf0ba07805a052cd7686b5ea7",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "sequence_file_0.json",
"size": 566,
"uuid": "6832e250-33c6-469a-b105-efa0d6f61309",
"version": "1"
},
{
"crc32c": "29B559F9",
"sha1": "0587673d7d88efa40a6f4d25d34d2eba14cf8e8b",
"sha256": "df8b88b6f32f494a53687f79724a6ebd8bbb9c5c0474b9a857d467a0bdb83c2d",
"s3_etag": "ef8edc4bf0ba07805a052cd7686b5ea7",
"content-type": "application/octet-stream",
"indexed": false,
"name": "MantonBM1_HiSeq_1_S1_L007_I1_001.fastq.gz",
"size": 566,
"uuid": "c8a4ea32-6d66-48f3-b480-9421743b9c0a",
"version": "1"
},
{
"crc32c": "5B68EDBD",
"sha1": "189a903531d1b9fe78e035945ed29bc004636526",
"sha256": "87854958090c0868f38be4ac5c7aa2324ff027b2b4803a5a2fd9a8eb01af4f21",
"s3_etag": "2c0a2cf2cc963e8f01e85cc324763c4c",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "sequencing_protocol_0.json",
"size": 864,
"uuid": "86417b00-f90f-409d-a9dd-717d077c3cf4",
"version": "1"
},
{
"crc32c": "290F5DCB",
"sha1": "3d4837dacac05df3adb29fa05874a5841b4661f7",
"sha256": "62e38c88e4038b73e52abafeb08440ccb6eb4417c1f56fd3fc7bc10a2aec32ff",
"s3_etag": "9512af43df021d47adc83a34d49046b9",
"content-type": "application/json; dcp-type=\"metadata/json\"",
"indexed": true,
"name": "specimen_from_organism_0.json",
"size": 852,
"uuid": "169096e5-f310-4c67-9a70-e139a3576e9e",
"version": "1"
}
]
Loading

0 comments on commit c7bfcc5

Please sign in to comment.