def setUp(self):

        data_rows = []

        # Generate the Run object(s)
        run = Run()
        run.name = "python upload"
        run.data_rows = data_rows
        run.properties["RunFieldName"] = "Run Field Value"

        # Generate the Batch object(s)
        batch = Batch()
        batch.runs = [run]
        batch.properties["PropertyName"] = "Property Value"

        self.service = MockSaveBatch()
        self.expected_kwargs = {
            "expected_args": [self.service.get_server_url()],
            "data":
            '{"assayId": 12345, "batches": [{"batchProtocolId": null, "comment": null, "created": null, "createdBy": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}',
            "headers": {
                "Content-Type": "application/json"
            },
            "timeout": 300,
        }

        self.args = [mock_server_context(self.service), assay_id, batch]
    def setUp(self):

        data_rows = []

        # Generate the Run object(s)
        run = Run()
        run.name = 'python upload'
        run.data_rows = data_rows
        run.properties['RunFieldName'] = 'Run Field Value'

        # Generate the Batch object(s)
        batch = Batch()
        batch.runs = [run]
        batch.properties['PropertyName'] = 'Property Value'

        self.service = MockSaveBatch()
        self.expected_kwargs = {
            'expected_args': [self.service.get_server_url()],
            'data':
            '{"assayId": 12345, "batches": [{"batchProtocolId": 0, "comment": null, "created": null, "createdBy": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"comment": null, "created": null, "createdBy": null, "dataInputs": [], "dataRows": [], "experiments": [], "filePathRoot": null, "materialInputs": [], "materialOutputs": [], "modified": null, "modifiedBy": null, "name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}',
            'headers': {
                'Content-type': 'application/json',
                'Accept': 'text/plain'
            },
            'timeout': 300
        }

        self.args = [mock_server_context(self.service), assay_id, batch]
    def setUp(self):

        dataRows = []

        # Generate the Run object(s)
        runTest = Run()
        runTest.name = 'python upload'
        runTest.data_rows = dataRows
        runTest.properties['RunFieldName'] = 'Run Field Value'

        # Generate the Batch object(s)
        batch = Batch()
        batch.runs = [runTest]
        # batch.name = 'python batch'
        batch.properties['PropertyName'] = 'Property Value'

        self.configs = configs.copy()
        self.service = MockSaveBatch(**self.configs)
        self.expected_kwargs = {
            'expected_args': [self.service.get_server_url()]
            , 'data': '{"assayId": 12345, "batches": [{"batchProtocolId": 0, "comment": null, "created": null, "createdBy": null, "lsid": null, "modified": null, "modifiedBy": null, "name": null, "properties": {"PropertyName": "Property Value"}, "runs": [{"comment": null, "created": null, "createdBy": null, "dataInputs": [], "dataRows": [], "experiments": [], "filePathRoot": null, "lsid": null, "materialInputs": [], "materialOutputs": [], "modified": null, "modifiedBy": null, "name": "python upload", "properties": {"RunFieldName": "Run Field Value"}}]}]}'
            , 'headers': {'Content-type': 'application/json', 'Accept': 'text/plain'}
        }

        self.args = [
            server_context, assay_id, batch
        ]
from labkey.api_wrapper import APIWrapper
from labkey.experiment import Batch, Run

labkey_server = "localhost:8080"
project_name = "ModulesAssayTest"  # Project folder name
context_path = "labkey"
api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False)

assay_id = 3315  # provide one from your server

###################
# Save an Assay batch
###################

# Generate the Run object(s)
run_test = Run()
run_test.name = "python upload"
run_test.data_rows = [
    {
        # ColumnName: Value
        "SampleId": "Monkey 1",
        "TimePoint": "2008/11/02 11:22:33",
        "DoubleData": 4.5,
        "HiddenData": "another data point",
    },
    {
        "SampleId": "Monkey 2",
        "TimePoint": "2008/11/02 14:00:01",
        "DoubleData": 3.1,
        "HiddenData": "fozzy bear",
    },
Пример #5
0
from labkey.utils import create_server_context
from labkey.experiment import Batch, Run, load_batch, save_batch

labkey_server = 'localhost:8080'
project_name = 'ModulesAssayTest'  # Project folder name
context_path = 'labkey'
server_context = create_server_context(labkey_server, project_name, context_path, use_ssl=False)

assay_id = 3315  # provide one from your server

###################
# Save an Assay batch
###################

# Generate the Run object(s)
runTest = Run()
runTest.name = 'python upload'
runTest.data_rows = [{
    # ColumnName: Value
    'SampleId': 'Monkey 1',
    'TimePoint': '2008/11/02 11:22:33',
    'DoubleData': 4.5,
    'HiddenData': 'another data point'
}, {
    'SampleId': 'Monkey 2',
    'TimePoint': '2008/11/02 14:00:01',
    'DoubleData': 3.1,
    'HiddenData': 'fozzy bear'
}, {
    'SampleId': 'Monkey 3',
    'TimePoint': '2008/11/02 14:00:01',
        "HiddenData": "another data point"
    }, {
        "SampleId": "Monkey 2",
        "TimePoint": "2008/11/02 14:00:01",
        "DoubleData": 3.1,
        "HiddenData": "fozzy bear"
    }, {
        "SampleId": "Monkey 3",
        "TimePoint": "2008/11/02 14:00:01",
        "DoubleData": 1.5,
        "HiddenData": "jimbo"
    }
]

# Generate the Run object(s)
runTest = Run()
runTest.name = 'python upload'
runTest.data_rows = dataRows
runTest.properties['RunFieldName'] = 'Run Field Value'

# Generate the Batch object(s)
batch = Batch()
batch.runs = [runTest]
batch.name = 'python batch'
batch.properties['PropertyName'] = 'Property Value'

# Execute save api
RESULT = save_batch(server_context, assay_id, batch)
# RESULT = save_batches(server_context, assay_id, [batch1, batch2])
print(RESULT.id)
Пример #7
0
    {
        "SampleId": "Monkey 2",
        "TimePoint": "2008/11/02 14:00:01",
        "DoubleData": 3.1,
        "HiddenData": "fozzy bear"
    },
    {
        "SampleId": "Monkey 3",
        "TimePoint": "2008/11/02 14:00:01",
        "DoubleData": 1.5,
        "HiddenData": "jimbo"
    }
]

# Generate the Run object(s)
runTest = Run()
runTest.name = 'python upload'
runTest.data_rows = dataRows
runTest.properties['RunFieldName'] = 'Run Field Value'

# Generate the Batch object(s)
batch = Batch()
batch.runs = [runTest]
batch.name = 'python batch'
batch.properties['PropertyName'] = 'Property Value'

# Execute save api
RESULT = save_batch(server_context, assay_id, batch)
# RESULT = save_batches(server_context, assay_id, [batch1, batch2])
print(RESULT.id)
#
from labkey.api_wrapper import APIWrapper
from labkey.experiment import Batch, Run

labkey_server = "localhost:8080"
project_name = "assays"  # Project folder name
context_path = "labkey"
api = APIWrapper(labkey_server, project_name, context_path, use_ssl=False)
assay_id = 310  # provide one from your server

###################
# Save an Assay batch
###################

# Generate the Run object(s)
run_test = Run()
run_test.name = "python upload"
run_test.data_rows = [
    {
        # ColumnName: Value
        "ParticipantId": "1234",
        "VisitId": 111,
        "WellLocation": "A1",
    },
    {
        "ParticipantId": "5678",
        "VisitId": 222,
        "WellLocation": "B11"
    },
    {
        "ParticipantId": "9123",
labkey_server = 'localhost:8080'
project_name = 'assays'  # Project folder name
context_path = 'labkey'
server_context = create_server_context(labkey_server,
                                       project_name,
                                       context_path,
                                       use_ssl=False)

assay_id = 310  # provide one from your server

###################
# Save an Assay batch
###################

# Generate the Run object(s)
runTest = Run()
runTest.name = 'python upload'
runTest.data_rows = [
    {
        # ColumnName: Value
        'ParticipantId': '1234',
        'VisitId': 111,
        'WellLocation': 'A1'
    },
    {
        'ParticipantId': '5678',
        'VisitId': 222,
        'WellLocation': 'B11'
    },
    {
        'ParticipantId': '9123',