Submitting Metadata

3. Submitting Metadata

    3.1 Creating Objects

        3.1.1 Submission project

        3.1.2 Analysis

        3.1.3 Data Access Committee

        3.1.4 Dataset

        3.1.5 Experiment

        3.1.6 Policy

        3.1.7 Run

        3.1.8 Sample

        3.1.9 Study

    3.2 Editing Objects

    3.3 Deleting Objects

    3.4 Validating and submitting metadata

        3.4.1 Validating /Submitting an entire submission project

        3.4.2 Validating /Submitting a subset of objects of a submission project

        3.4.3 Validating /Submitting just one item


3. Submitting metadata

In a similar way as the catalog service, the submission service has a set of instructions that are basically identical for all objects. New objects can be defined using: XML files, which must follow SRA 1.5 schema. The latest version of these schemas can be found here.

In every call, it is necessary to add the header:

 -H "Content-type: application/xml"

JSON format (see JSON messages format).

In every call, it is necessary to add the header:

 -H "Content-type: application/json"


3.1 Creating Objects


3.1.1 Submission project

All new EGA objects must fall under a submission project. This means that after the generation of a new project, the id project must be included every time a new object is added. In order to register a new submission project we must use the following endpoint:

curl -X POST path/submissions -d '{JSON Object, see Submission }'  


3.1.2 Analysis

Using JSON:

curl -X POST path/submissions/{submissionId}/analyses -d '{Json Object, see Analysis}'

Using XML:

curl -X POST path/submissions/{submissionId}/analyses/xml -d 'Analysis XML to be included. Analysis_BAM.xml example'


3.1.3 Data Access Committee

Using JSON:

curl -X POST path/submissions/{submissionId}/dacs -d '{Json Object, see DAC}'

Using XML:

curl -X POST path/submissions/{submissionId}/dacs/xml -d 'XML to be included. dac.xml example'


3.1.4 Dataset

Using JSON:

curl -X POST path/submissions/{submissionId}/datasets -d '{Json Object, see Dataset}'

Using XML:

curl -X POST path/submissions/{submissionId}/datasets/xml -d 'XML to be included. dataset.xml example'


3.1.5 Experiment

Using JSON:

curl -X POST path/submissions/{submissionId}/experiments -d '{Json Object, see Experiment}'

Using XML:

curl -H POST path/submissions/{submissionId}/experiments/xml -d 'XML to be included.  experiment.xml example.'
More examples in our webpage.


3.1.6 Policy

Using JSON:

curl -X POST path/submissions/{submissionId}/policies -d '{Json Object, see Policy}'

Using XML:

curl -X POST path/submissions/{submissionId}/policies/xml -d 'XML to be included.  policy.xml example'


3.1.7 Run

Using JSON:

curl -X POST path/submissions/{submissionId}/runs -d '{Json Object, see Run}'
Using XML:
curl -X POST path/submissions/{submissionId}/runs/sequencing/xml -d 'XML to be included. run.xml example'


3.1.8 Sample

Using JSON:

curl -X POST path/submissions/{submissionId}/samples -d '{Json Object, see Sample}'

Using XML:

curl -X POST path/submissions/{submissionId}/samples/xml -d 'XML to be included. sample.xml example '


3.1.9 Study

Using JSON:

curl -X POST path/submissions/{submissionId}/studies -d '{Json Object, see Study}'

Using XML:

curl -X POST path/submissions/{submissionId}/studies/xml -d 'XML to be included. study.xml example '


3.2 Editing Objects

EGA objects can be edited once have been created or validated (edition of submitted objects is not supported yet). To edit the object the edited XML/JSON must be provided. Don't forget to add the corresponding header:

-H "Content-type: application/xml" for XML input data.
-H "Content-type: application/json" for JSON input data.

Edit a sample using XML as input data:

curl -X PUT path/samples/xml -d 'Edited XML'

When using XML format, there is no need to reference the object in the call; the system will automatically update all objects that match with the ALIAS used. IMPORTANT! Be very careful when editing object. If the alias is not unique, all objects with the same alias will be updated.

Edit a sample using JSON as input data:

curl -X PUT path/samples/{sampleId}?action=EDIT -d '{Edited JSON object}'
Notice that when using JSON, you must explicitly specify the object Id in the URL and you must add '?action=EDIT' at the end.


3.3 Deleting Objects

Only objects in status DRAFT, VALIDATED or VALIDATED_WITH_ERRORS can be deleted. Below there are some examples.

Delete a sample:

curl -X DELETE path/samples/{sampleId}

Delete a run:

curl -X DELETE path/run/{runId}


3.4 Validating and submitting Metadata

You can find the most common server http responses here


3.4.1 Validating/Submitting an entire submission project

When all objects of a given submission project have been completed, the entire project can be validated. Only the submission project must be used for this:

VALIDATE

curl -X PUT path/submissions/{submissionId}?action=VALIDATE
NOTE: As stated before, “{submissionId}” must be an identifier of an already existent submission.

As explained before, validation can be done at any time and as many times as needed, since it does not make any change on the objects. On the contrary, when the action SUBMIT is used, the objects are submitted, assigned unique IDs and cannot be deleted (without manual intervention from our Helpdesk). Therefore, be careful, and make sure your objects are finished before using SUBMIT submission action.

SUBMIT

curl -X PUT path/submissions/{submissionId}?action=SUBMIT


3.4.2 Validating/Submitting a subset of objects of a submission project

You can add a json object as a paramter to the call to specify which objects of the submission project you want to validate/submit. This can be very useful if you don't want to validate/submit all objects of that submission but you don't want to do it one by one either.

SUBMIT

curl -X PUT path/submissions/{submissionId}?action=SUBMIT -d '{JSON Object, see Submission }'

Example:

curl -X PUT path/submissions/{submissionId}?action=SUBMIT -d '{
	"submissionSubset" : {
	“dacIds” : [“dac_id_01”],
	“policyIds” : [“policy_id_01”, “policy_id_02”]
}
}'


3.4.3 Validating/Submitting only one item

Objects can be validated and submitted also one by one. The syntax is quite easy and uses the same method described in the previous section. Find below an example for analysis objects, that can be extrapolated for the rest of objects. The EGA CRG id of the objects must be used in the call:

VALIDATE

curl -X PUT path/analyses/{analysisId}?action=VALIDATE

SUBMIT

curl -X PUT path/analyses/{analysisId}?action=SUBMIT
NOTE: Remember, “{analysisId}” must be the EGA CRG identifier of an already existent analysis (in this example).