Skip to content

Commit

Permalink
Merge pull request ga4gh#168 from david4096/va_created_check
Browse files Browse the repository at this point in the history
Check created time of analysis field
  • Loading branch information
sarahhunt committed Feb 12, 2016
2 parents 79a923f + b9d7b3d commit 8584f35
Show file tree
Hide file tree
Showing 9 changed files with 2,378 additions and 24 deletions.
4 changes: 2 additions & 2 deletions ctk-schemas/src/main/resources/avro/alleleAnnotations.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ record VariantAnnotation {
/** The ID of the variant annotation set this record belongs to. */
string variantAnnotationSetId;

/** The date this annotation was created in milliseconds from the epoch. */
union { null, long } created = null;
/** The :ref:`ISO 8601 <metadata_date_time>` time at which this record was created. */
union { null, string } created = null;

/**
The transcript effect annotation for the alleles of this variant. Each one
Expand Down
18 changes: 9 additions & 9 deletions ctk-schemas/src/main/resources/avro/metadata.avdl
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ record Experiment {

/**
The time at which this record was created.
Format: ISO 8601, YYYY-MM-DDTHH:MM:SS.SSS (e.g. 2015-02-10T00:03:42.123Z)
Format: :ref:`ISO 8601 <metadata_date_time>`
*/
string recordCreateTime;
string created;

/**
The time at which this record was last updated.
Format: ISO 8601, YYYY-MM-DDTHH:MM:SS.SSS (e.g. 2015-02-10T00:03:42.123Z)
Format: :ref:`ISO 8601 <metadata_date_time>`
*/
string recordUpdateTime;
string updated;

/**
The time at which this experiment was performed.
Granularity here is variable (e.g. date only).
Format: ISO 8601, YYYY-MM-DDTHH:MM:SS (e.g. 2015-02-10T00:03:42)
Format: :ref:`ISO 8601 <metadata_date_time>`
*/
union { null, string } runTime = null;

Expand Down Expand Up @@ -168,15 +168,15 @@ record Analysis {

/**
The time at which this record was created.
Format: ISO 8601, YYYY-MM-DDTHH:MM:SS.SSS (e.g. 2015-02-10T00:03:42.123Z)
Format: :ref:`ISO 8601 <metadata_date_time>`
*/
union { null, string } recordCreateTime = null;
union { null, string } created = null;

/**
The time at which this record was last updated.
Format: ISO 8601, YYYY-MM-DDTHH:MM:SS.SSS (e.g. 2015-02-10T00:03:42.123Z)
Format: :ref:`ISO 8601 <metadata_date_time>`
*/
string recordUpdateTime;
string updated;

/** The type of analysis. */
union { null, string } type = null;
Expand Down
70 changes: 70 additions & 0 deletions ctk-schemas/src/main/resources/avro/metadatamethods.avdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@namespace("org.ga4gh.methods")

protocol MetadataMethods {

import idl "metadata.avdl";
import idl "common.avdl";
import idl "methods.avdl";

/****************** /datasets/search *********************/
/**
This request maps to the body of `POST /datasets/search` as JSON.
*/
record SearchDatasetsRequest {

/**
Specifies the maximum number of results to return in a single page.
If unspecified, a system default will be used.
*/
union { null, int } pageSize = null;

/**
The continuation token, which is used to page through large result sets.
To get the next page of results, set this parameter to the value of
`nextPageToken` from the previous response.
*/
union { null, string } pageToken = null;
}

/**
This is the response from `POST /datasets/search` expressed as JSON.
*/
record SearchDatasetsResponse {
/** The list of datasets. */
array<org.ga4gh.models.Dataset> datasets = [];

/**
The continuation token, which is used to page through large result sets.
Provide this value in a subsequent request to return the next page of
results. This field will be empty if there aren't any additional results.
*/
union { null, string } nextPageToken = null;
}

/**
Gets a list of datasets accessible through the API.
TODO: Reads and variants both want to have datasets. Are they the same object?
`POST /datasets/search` must accept a JSON version of
`SearchDatasetsRequest` as the post body and will return a JSON version
of `SearchDatasetsResponse`.
*/
SearchDatasetsResponse searchDatasets(
/**
This request maps to the body of `POST /datasets/search` as JSON.
*/
SearchDatasetsRequest request) throws GAException;

/**************** /datasets/{id} *******************/
/**
Gets a `Dataset` by ID.
`GET /datasets/{id}` will return a JSON version of `Dataset`.
*/
org.ga4gh.models.Dataset getDataset(
/**
The ID of the `Dataset`.
*/
string id) throws GAException;

}
2 changes: 1 addition & 1 deletion cts-java/src/test/java/org/ga4gh/cts/api/TestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private TestData() {
* The names of the variant annotation sets used for variant annotation in the standard test data.
*/
public static final List<String> VARIANT_ANNOTATION_SET_NAMES =
Arrays.asList("WASH7P_annotation", "OR4F_annotation");
Arrays.asList("WASH7P", "OR4F");

/**
* The names of known-good read groups.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

import org.apache.avro.AvroRemoteException;
import org.ga4gh.ctk.CtkLogs;
import org.ga4gh.ctk.transport.GAWrapperException;
import org.ga4gh.ctk.transport.URLMAPPING;
import org.ga4gh.ctk.transport.protocols.Client;
import org.ga4gh.cts.api.TestData;
import org.ga4gh.cts.api.Utils;
import org.ga4gh.methods.*;
import org.ga4gh.models.VariantSet;
import org.ga4gh.models.VariantAnnotationSet;
import org.ga4gh.models.AnalysisResult;
import org.ga4gh.models.Analysis;
import org.ga4gh.models.OntologyTerm;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import java.net.HttpURLConnection;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;

import static org.assertj.core.api.Assertions.*;
import static org.ga4gh.cts.api.Utils.catchGAWrapperException;

/**
* Tests dealing with searching for VariantAnnotationSets.
Expand Down Expand Up @@ -80,7 +75,7 @@ public void checkGetVariantAnnotationSetById() throws AvroRemoteException {
*@throws AvroRemoteException if there's a communication problem or server exception ({@link GAException})
*/
@Test
public void checkVariantAnnotationAnalysis() throws AvroRemoteException {
public void checkVariantAnnotationAnalysis() throws AvroRemoteException, ParseException {

// Seek a list of VariantAnnotationSets for the compliance dataset.
final List<VariantAnnotationSet> variantAnnotationSets = Utils.getAllVariantAnnotationSets(client);
Expand All @@ -91,12 +86,17 @@ public void checkVariantAnnotationAnalysis() throws AvroRemoteException {
// Check the Analysis record within the VariantAnnotationSet matches the test data
final String name = "compliance1";
final String description = "variant annotation test data";
final String created = "2015-11-18T00:00:00.000000Z";
final String created = "2015-11-18";
// TODO make a more robust ISO8601 parser
// Date formatting can be ISO compliant but still break these
// However, the second, df2 matches python's datetime.isoformat function
DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
final String software = "SnpEff";

assertThat(vSet.getAnalysis().getName()).isEqualTo(name);
assertThat(vSet.getAnalysis().getDescription()).isEqualTo(description);
assertThat(vSet.getAnalysis().getRecordCreateTime()).isEqualTo(created);
assertThat(df2.parse(vSet.getAnalysis().getCreated())).isEqualTo(df1.parse(created));
assertThat(vSet.getAnalysis().getSoftware().get(0)).isEqualTo(software);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void checkSearchingVariantSetsReturnsSome() throws AvroRemoteException {
*/
@Test
public void checkExpectedVariantSets() throws AvroRemoteException {
final int expectedNumberOfVariantSets = 2;
final int expectedNumberOfVariantSets = 3;

final SearchVariantSetsRequest req =
SearchVariantSetsRequest.newBuilder()
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8584f35

Please sign in to comment.