Skip to content
Repository for the GA4GH inlined phenopacket schema
Java Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper Add missing maven-wrapper.jar to .gitignore Mar 22, 2018
docs Merge branch 'master' of https://github.com/phenopackets/phenopacket-… Aug 22, 2019
src Add note about enumerated types to interpretation.rst, karyotypicsex.… Aug 22, 2019
.gitattributes Change * text=auto to * text=lf Mar 22, 2018
.gitignore Add requirements.txt, setup.py and src/test/python/phenopacket_test.py May 24, 2019
.travis.yml Update travis.yml to use openjdk11 Aug 7, 2019
CONTRIBUTING.rst Add issue pages link to CONTRIBUTING.rst May 16, 2019
DISCLAIMER.rst Issue #195 - Add security review disclaimer Aug 6, 2019
LICENSE Initial commit Mar 19, 2018
MAINTAINERS.rst Change for #154 - Add MAINTAINERS.rst May 31, 2019
README.rst Remove useless security disclaimer section from README.rst Aug 14, 2019
mvnw Executable mvnw Mar 22, 2018
mvnw.cmd Add Takari Maven wrapper to enable builds in environments without mav… Mar 22, 2018
pom.xml
requirements.txt Add requirements.txt, setup.py and src/test/python/phenopacket_test.py May 24, 2019
setup.py Add requirements.txt, setup.py and src/test/python/phenopacket_test.py May 24, 2019

README.rst

Phenopacket schema

Build Status Maven Central Documentation

This has been produced as part of the GA4GH Clinical Phenotype Data Capture Workstream and it merges the existing GA4GH metadata-schemas work with a more focused model from the phenopacket-reference-implementation.

This is a re-defined version of the original phenopacket with a more individual-centric approach. This new approach was taken in order to simplify the code required to represent and manipulate the data and also better represent this sort of data as it is in day to day use.

Documentation

The core documentation can be found at Documentation

The documentation in this README is primarily for the users of the phenopackets-schema java library.

Scope and Purpose

The goal of the phenopacket-schema is to define the phenotypic description of a patient/sample in the context of rare disease or cancer genomic diagnosis. It aims to provide sufficient and shareable information of the data outside of the EHR (Electronic Health Record) with the aim of enabling capturing of sufficient structured data at the point of care by a clinician or clinical geneticist for sharing with other labs or computational analysis of the data in clinical or research environments.

The schema aims to define a common, limited set of data types which may be composed into more specialised types for data sharing between resources using an agreed upon common schema (as defined in base.proto).

This common schema has been used to define the 'Phenopacket' which is a catch-all collection of data types, specifically focused on representing rare-disease or cancer samples for both initial data capture and analysis. The phenopacket is designed to be both human and machine-readable, and to inter-operate with the HL7 Fast Healthcare Interoperability Resources Specification (aka FHIR®).

Currently this is very much work in progress and breaking changes will occur. Once we have settled on something stable we will draft a 1.0.0-RELEASE and thereafter stick to semantic versioning semantics.

Email list

There is a low-volume mailing list for announcements about phenopackets at phenopackets@groups.io. More information about this list is available at https://groups.io/g/phenopackets.

Usage

The Phenopacket schema is defined using Protobuf which is "a language-neutral, platform-neutral extensible mechanism for serializing structured data". There are two ways to use this library, firstly using the Phenopacket as an exchange mechanism, secondly as a schema of basic types on which to build more specialist messages, yet allow for easy interoperability with other resources using the phenopackets schema.

Java people can incorporate phenopackets-api into their code by importing the jar using maven:

<dependency>
    <groupId>org.phenopackets</groupId>
    <artifactId>phenopacket-schema</artifactId>
    <version>${phenopacket-schema.version}</version>
</dependency>

The following sections describe how to achieve these two things.

Exchanging Phenopackets directly

Examples on how these can be used can be found in the test directory. There are no explicit relationships defined between fields in the phenopacket (apart from the Pedigree), so it is vital that resources exchanging phenopackets agree on what is valid and what the fields mean in relation to other fields in the phenopacket. For example the Phenopacket.genes field may be agreed upon as representing the genes for a gene panel in one context, or a set of candidate genes or perhaps a diagnosed causative gene.

JSON/YAML formats

A Phenopacket can be transformed between the native binary format and JSON using the JsonFormat class from the protobuf-java-util library. This contains simple utility methods to perform these transformations. Usage is shown here:

// Transform a Phenopacket into JSON
Phenopacket original = TestExamples.rareDiseasePhenopacket();

String asJson = JsonFormat.printer().print(original);
System.out.println(asJson);

// Convert the JSON back to a Phenopacket
Phenopacket.Builder phenoPacketBuilder = Phenopacket.newBuilder();
JsonFormat.parser().merge(jsonString, phenoPacketBuilder);
Phenopacket fromJson = phenoPacketBuilder.build();

// Convert the JSON into YAML (using Jackson)
JsonNode jsonNodeTree = new ObjectMapper().readTree(jsonString);
String yamlPhenopacket = new YAMLMapper().writeValueAsString(jsonNodeTree);

// Convert the YAML back into JSON (using Jackson)
JsonNode jsonNodeTree = new YAMLMapper().readTree(yamlString);
String jsonPhenopacket = new ObjectMapper().writeValueAsString(jsonNodeTree);

// And finally back into a Java object
Phenopacket.Builder phenoPacketBuilder2 = Phenopacket.newBuilder();
JsonFormat.parser().merge(jsonPhenopacket, phenoPacketBuilder2);
Phenopacket fromJson2 = phenoPacketBuilder2.build();

Building new messages from the schema

There is an example of how to do this included in the mme.proto file. Here the Matchmaker Exchange (MME) API has been implemented using the phenopackets schema, defining custom messages as required, but re-using messages from base.proto where applicable. Using the above example, perhaps the Phenopacket.genes is a problem as you wish to record not only the gene panels ordered, but also the candidate genes discovered in two separate fields. In this case, a new bespoke message could be created, using the Gene as a building block.

Building

The project can be built using the awesome Takari maven wrapper which requires no local maven installation. The only requirement for the build is to have a working java installation and network access.

To do this cd to the project root and run the wrapper scripts:

$ ./mvnw clean install

or

$ ./mvnw.cmd clean install

Sign artefacts for release

There is a release-sign-artifacts profile which can be triggered with the command

$ ./mvnw clean install -DperformRelease=true

Java, Python and C++ artefacts

Building the project will automatically compile Java, Python and C++ artefacts. The Java jar file can be directly used in any Java project. For Python or C++ the build artefacts can be found at

target/generated-sources/protobuf/python

and

target/generated-sources/protobuf/cpp

Other languages will need to compile the files in src/main/proto to their desired language. The protobuf developer site has examples on how to do this, e.g GO or C#. Protobuf also supports a host of other languages.

You can’t perform that action at this time.