In [1]:
from EGA import Session
import json
# Create a new Session
newSession = Session()

In [2]:
# Create a new submit process
newSession.submit.new('0914_2','A new submission case for final upload hopefully','0914_2')
newSession.submit.submissionId


Out[2]:
u'55f6dde90cf285a8dbc791cc'

In [3]:
# Upload the xml files
study_upload = newSession.submit.studies('xml/final/study.xml')
sample_upload = newSession.submit.samples('xml/final/sample.xml')
experiment_upload = newSession.submit.experiments('xml/final/Experiment_illumina_single.xml')
run_upload = newSession.submit.runs('xml/final/run.xml')
policy_upload = newSession.submit.policies('xml/final/Policy.xml')

In [4]:
# Validate
# It is also possible to validate one by one
validation = newSession.submit.validate()
json.loads(validation.text)


Out[4]:
{u'header': {u'apiVersion': u'v1',
  u'code': u'200',
  u'developerMessage': u'',
  u'docLink': u'https://ega.crg.eu',
  u'errorCode': u'1',
  u'errorStack': u'',
  u'service': u'submitter',
  u'userMessage': u'OK'},
 u'response': {u'numTotalResults': 1,
  u'result': [{u'alias': u'412dba16-4b97-4e5c-8ccb-c76e12e10a0d',
    u'analysisIds': None,
    u'centerName': u'TEST_SUBMISSIONS',
    u'creationTime': 1442242025934L,
    u'dacIds': None,
    u'datasetIds': None,
    u'description': u'A new submission case for final upload hopefully',
    u'ebiId': None,
    u'ebiSubmissionDetailsIds': [u'55f6ddfb0cf285a8dbc791e1'],
    u'editionTime': 1442242033568L,
    u'egaAccessionId': None,
    u'experimentIds': [u'55f6ddef0cf285a8dbc791d4',
     u'55f6ddef0cf285a8dbc791d5',
     u'55f6ddef0cf285a8dbc791d6'],
    u'id': u'55f6dde90cf285a8dbc791cc',
    u'json': None,
    u'policyIds': [u'55f6ddf10cf285a8dbc791dc'],
    u'runIds': [u'55f6ddf00cf285a8dbc791d8',
     u'55f6ddf10cf285a8dbc791d9',
     u'55f6ddf10cf285a8dbc791da'],
    u'sampleIds': [u'55f6ddec0cf285a8dbc791d0',
     u'55f6ddec0cf285a8dbc791d1',
     u'55f6ddec0cf285a8dbc791d2'],
    u'status': u'VALIDATED',
    u'studyIds': [u'55f6ddeb0cf285a8dbc791ce'],
    u'submissionProjectId': None,
    u'submissionSubset': None,
    u'submitterId': u'ega-box-85',
    u'title': u'0914_2',
    u'userId': u'5539055ee4b0780d14fa01f8',
    u'validationError': [],
    u'validationInfo': [u' Its ega submisison as PROTECT action is used',
     u' PROTECT action for the following XML: study4863918094468124052.xml sample8255667377369086523.xml experiment8913455226571646128.xml run1602358699392123129.xml   policy311627754495823647.xml    '],
    u'validationResult': True,
    u'version': 1,
    u'xml': None}],
  u'resultType': u'eu.crg.ega.microservice.dto.submitter.SubmissionData'}}

In [5]:
# Submit
# It is also possible to submit one by one
submission = newSession.submit.submit()
json.loads(submission.text)


Out[5]:
{u'header': {u'apiVersion': u'v1',
  u'code': u'200',
  u'developerMessage': u'',
  u'docLink': u'https://ega.crg.eu',
  u'errorCode': u'1',
  u'errorStack': u'',
  u'service': u'submitter',
  u'userMessage': u'OK'},
 u'response': {u'numTotalResults': 1,
  u'result': [{u'alias': u'd9ad3183-6120-496b-bb2b-6ccad0083976',
    u'analysisIds': None,
    u'centerName': u'TEST_SUBMISSIONS',
    u'creationTime': 1442242025934L,
    u'dacIds': None,
    u'datasetIds': None,
    u'description': u'A new submission case for final upload hopefully',
    u'ebiId': None,
    u'ebiSubmissionDetailsIds': [u'55f6ddfb0cf285a8dbc791e1',
     u'55f6de3b0cf285a8dbc791e3'],
    u'editionTime': 1442242033568L,
    u'egaAccessionId': u'EGA00001202084',
    u'experimentIds': [u'55f6ddef0cf285a8dbc791d4',
     u'55f6ddef0cf285a8dbc791d5',
     u'55f6ddef0cf285a8dbc791d6'],
    u'id': u'55f6dde90cf285a8dbc791cc',
    u'json': None,
    u'policyIds': [u'55f6ddf10cf285a8dbc791dc'],
    u'runIds': [u'55f6ddf00cf285a8dbc791d8',
     u'55f6ddf10cf285a8dbc791d9',
     u'55f6ddf10cf285a8dbc791da'],
    u'sampleIds': [u'55f6ddec0cf285a8dbc791d0',
     u'55f6ddec0cf285a8dbc791d1',
     u'55f6ddec0cf285a8dbc791d2'],
    u'status': u'PARTIALLY_SUBMITTED',
    u'studyIds': [u'55f6ddeb0cf285a8dbc791ce'],
    u'submissionProjectId': None,
    u'submissionSubset': None,
    u'submitterId': u'ega-box-85',
    u'title': u'0914_2',
    u'userId': u'5539055ee4b0780d14fa01f8',
    u'validationError': [],
    u'validationInfo': [u' Its ega submisison as PROTECT action is used',
     u' PROTECT action for the following XML: study6980884568800112872.xml sample2761368830406494573.xml experiment2903417997774204300.xml run2807235931412531299.xml   policy1126816800422269275.xml    '],
    u'validationResult': True,
    u'version': 1,
    u'xml': None}],
  u'resultType': u'eu.crg.ega.microservice.dto.submitter.SubmissionData'}}