From 4abcfc9e2f78bb99ce678ac8e7685fb87d9e7dc4 Mon Sep 17 00:00:00 2001 From: Bryan Bartley Date: Wed, 27 Apr 2022 07:56:37 -0700 Subject: [PATCH] Fix #138 --- paml/data.py | 2 +- paml/sample_maps.py | 4 +- test/test_samplemap.py | 4 +- test/testfiles/sample_map_test.nt | 89 +++++++++++++------------------ 4 files changed, 42 insertions(+), 57 deletions(-) diff --git a/paml/data.py b/paml/data.py index 159b8f76..3990ef38 100644 --- a/paml/data.py +++ b/paml/data.py @@ -67,7 +67,7 @@ def is_in_mask(entry, row_col_pairs): is_in_mask(coordinate_to_row_col(x), row_col_pairs) for x in contents_array.data ], - coords={Strings.ALIQUOT: contents_array} + coords=[(Strings.ALIQUOT, contents_array.data)] ) return json.dumps(mask_array.to_dict()) SampleArray.mask = sample_array_mask diff --git a/paml/sample_maps.py b/paml/sample_maps.py index ef36e9ae..a150d11f 100644 --- a/paml/sample_maps.py +++ b/paml/sample_maps.py @@ -44,7 +44,7 @@ def many_to_one_sample_map_get_map(self): source_to_target_arrays = { source.identity : xr.DataArray([""]*len(aliquots), dims=(target.identity), - coords={target.identity: aliquots}) + coords=[(target.identity, aliquots)]) for source in sources } @@ -68,7 +68,7 @@ def one_to_many_sample_map_get_map(self): source_to_target_arrays = { target.identity : xr.DataArray([""]*len(aliquots), dims=(source.identity), - coords={source.identity: aliquots}) + coords=[(source.identity, aliquots)]) for target in targets } diff --git a/test/test_samplemap.py b/test/test_samplemap.py index 19e7ee9a..9e545554 100644 --- a/test/test_samplemap.py +++ b/test/test_samplemap.py @@ -115,8 +115,8 @@ def test_create_protocol(self): for reagent in reagents] for id in aliquot_ids], dims=("aliquot", "contents"), - coords={"aliquot": aliquot_ids, - "contents": [r.identity for r in reagents]}).to_dict())) + coords=[("aliquot", aliquot_ids), + ("contents", [r.identity for r in reagents])]).to_dict())) # 3. sample_array_parameter = create_source.pin_parameter("sample_array") [old_input] = [x for x in create_source.inputs if x.name == "sample_array"] diff --git a/test/testfiles/sample_map_test.nt b/test/testfiles/sample_map_test.nt index a3b42d9c..5aa4a8b5 100644 --- a/test/testfiles/sample_map_test.nt +++ b/test/testfiles/sample_map_test.nt @@ -73,43 +73,6 @@ . "2000-01-01T00:00:03"^^ . "2000-01-01T00:00:02"^^ . - . - "LiteralReference1" . - . - . - . - . - "ParameterValue1" . - . - . - . - "LiteralReference1" . - . - . - . - . - "ParameterValue2" . - . - . - . - "LiteralReference1" . - . - . - . - . - "ParameterValue3" . - . - . - "true"^^ . - . - . - . - "execute_2" . - . - . - . - "2000-01-01T00:00:05"^^ . - "2000-01-01T00:00:04"^^ . "true"^^ . "true"^^ . "OutputPin1" . @@ -215,9 +178,15 @@ "true"^^ . "true"^^ . "InputPin3" . - "dispenseVelocity" . + "amount" . . . + "true"^^ . + "true"^^ . + "InputPin4" . + "dispenseVelocity" . + . + . . . "{\"dims\": [\"source_array\", \"source_aliquot\", \"target_array\", \"target_aliquot\"], \"attrs\": {}, \"data\": [[[[10.0, 10.0, 10.0, 10.0]], [[10.0, 10.0, 10.0, 10.0]], [[10.0, 10.0, 10.0, 10.0]], [[10.0, 10.0, 10.0, 10.0]]]], \"coords\": {\"source_array\": {\"dims\": [\"source_array\"], \"attrs\": {}, \"data\": [\"source\"]}, \"source_aliquot\": {\"dims\": [\"source_aliquot\"], \"attrs\": {}, \"data\": [0, 1, 2, 3]}, \"target_array\": {\"dims\": [\"target_array\"], \"attrs\": {}, \"data\": [\"target\"]}, \"target_aliquot\": {\"dims\": [\"target_aliquot\"], \"attrs\": {}, \"data\": [0, 1, 2, 3]}}, \"name\": null}" . @@ -239,6 +208,7 @@ . . . + . . "CallBehaviorAction3" . . @@ -307,7 +277,7 @@ . . . - "{\"dims\": [\"aliquot\"], \"attrs\": {}, \"data\": [\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\", \"A7\", \"A8\", \"A9\", \"A10\", \"A11\", \"A12\", \"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B6\", \"B7\", \"B8\", \"B9\", \"B10\", \"B11\", \"B12\", \"C1\", \"C2\", \"C3\", \"C4\", \"C5\", \"C6\", \"C7\", \"C8\", \"C9\", \"C10\", \"C11\", \"C12\", \"D1\", \"D2\", \"D3\", \"D4\", \"D5\", \"D6\", \"D7\", \"D8\", \"D9\", \"D10\", \"D11\", \"D12\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\", \"E7\", \"E8\", \"E9\", \"E10\", \"E11\", \"E12\", \"F1\", \"F2\", \"F3\", \"F4\", \"F5\", \"F6\", \"F7\", \"F8\", \"F9\", \"F10\", \"F11\", \"F12\", \"G1\", \"G2\", \"G3\", \"G4\", \"G5\", \"G6\", \"G7\", \"G8\", \"G9\", \"G10\", \"G11\", \"G12\", \"H1\", \"H2\", \"H3\", \"H4\", \"H5\", \"H6\", \"H7\", \"H8\", \"H9\", \"H10\", \"H11\", \"H12\"], \"coords\": {}, \"name\": null}" . + "{\"dims\": [\"aliquot\"], \"attrs\": {}, \"data\": [\"A1\", \"B1\", \"C1\", \"D1\", \"E1\", \"F1\", \"G1\", \"H1\", \"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\", \"A3\", \"B3\", \"C3\", \"D3\", \"E3\", \"F3\", \"G3\", \"H3\", \"A4\", \"B4\", \"C4\", \"D4\", \"E4\", \"F4\", \"G4\", \"H4\", \"A5\", \"B5\", \"C5\", \"D5\", \"E5\", \"F5\", \"G5\", \"H5\", \"A6\", \"B6\", \"C6\", \"D6\", \"E6\", \"F6\", \"G6\", \"H6\", \"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\", \"A8\", \"B8\", \"C8\", \"D8\", \"E8\", \"F8\", \"G8\", \"H8\", \"A9\", \"B9\", \"C9\", \"D9\", \"E9\", \"F9\", \"G9\", \"H9\", \"A10\", \"B10\", \"C10\", \"D10\", \"E10\", \"F10\", \"G10\", \"H10\", \"A11\", \"B11\", \"C11\", \"D11\", \"E11\", \"F11\", \"G11\", \"H11\", \"A12\", \"B12\", \"C12\", \"D12\", \"E12\", \"F12\", \"G12\", \"H12\"], \"coords\": {}, \"name\": null}" . "SampleArray1" . "samples" . . @@ -323,7 +293,7 @@ . . . - "{\"dims\": [\"aliquot\"], \"attrs\": {}, \"data\": [\"A1\", \"A2\", \"A3\", \"A4\", \"A5\", \"A6\", \"A7\", \"A8\", \"A9\", \"A10\", \"A11\", \"A12\", \"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B6\", \"B7\", \"B8\", \"B9\", \"B10\", \"B11\", \"B12\", \"C1\", \"C2\", \"C3\", \"C4\", \"C5\", \"C6\", \"C7\", \"C8\", \"C9\", \"C10\", \"C11\", \"C12\", \"D1\", \"D2\", \"D3\", \"D4\", \"D5\", \"D6\", \"D7\", \"D8\", \"D9\", \"D10\", \"D11\", \"D12\", \"E1\", \"E2\", \"E3\", \"E4\", \"E5\", \"E6\", \"E7\", \"E8\", \"E9\", \"E10\", \"E11\", \"E12\", \"F1\", \"F2\", \"F3\", \"F4\", \"F5\", \"F6\", \"F7\", \"F8\", \"F9\", \"F10\", \"F11\", \"F12\", \"G1\", \"G2\", \"G3\", \"G4\", \"G5\", \"G6\", \"G7\", \"G8\", \"G9\", \"G10\", \"G11\", \"G12\", \"H1\", \"H2\", \"H3\", \"H4\", \"H5\", \"H6\", \"H7\", \"H8\", \"H9\", \"H10\", \"H11\", \"H12\"], \"coords\": {}, \"name\": null}" . + "{\"dims\": [\"aliquot\"], \"attrs\": {}, \"data\": [\"A1\", \"B1\", \"C1\", \"D1\", \"E1\", \"F1\", \"G1\", \"H1\", \"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\", \"A3\", \"B3\", \"C3\", \"D3\", \"E3\", \"F3\", \"G3\", \"H3\", \"A4\", \"B4\", \"C4\", \"D4\", \"E4\", \"F4\", \"G4\", \"H4\", \"A5\", \"B5\", \"C5\", \"D5\", \"E5\", \"F5\", \"G5\", \"H5\", \"A6\", \"B6\", \"C6\", \"D6\", \"E6\", \"F6\", \"G6\", \"H6\", \"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\", \"A8\", \"B8\", \"C8\", \"D8\", \"E8\", \"F8\", \"G8\", \"H8\", \"A9\", \"B9\", \"C9\", \"D9\", \"E9\", \"F9\", \"G9\", \"H9\", \"A10\", \"B10\", \"C10\", \"D10\", \"E10\", \"F10\", \"G10\", \"H10\", \"A11\", \"B11\", \"C11\", \"D11\", \"E11\", \"F11\", \"G11\", \"H11\", \"A12\", \"B12\", \"C12\", \"D12\", \"E12\", \"F12\", \"G12\", \"H12\"], \"coords\": {}, \"name\": null}" . "SampleArray1" . "samples" . . @@ -397,21 +367,12 @@ "CallBehaviorExecution2" . . . - . - . - . - . - . - "CallBehaviorExecution3" . - . - . "true"^^ . . . . . . - . . . . @@ -424,7 +385,7 @@ . . . - "2000-01-01T00:00:06"^^ . + "2000-01-01T00:00:04"^^ . . "2000-01-01T00:00:00"^^ . "1"^^ . @@ -500,7 +461,7 @@ "LiteralInteger1" . . . - "0"^^ . + "1"^^ . "LiteralInteger2" . . . @@ -511,7 +472,7 @@ . . "Parameter1" . - "dispenseVelocity" . + "amount" . . . "3"^^ . @@ -519,10 +480,34 @@ "OrderedPropertyValue4" . . . + "1"^^ . + "LiteralInteger1" . + . + . + "0"^^ . + "LiteralInteger2" . + . + . + . + "true"^^ . + "true"^^ . + . + . + . + "Parameter1" . + "dispenseVelocity" . + . + . + "4"^^ . + . + "OrderedPropertyValue5" . + . + . . . . . + . "Move volumes from a collection of source samples to a collection of destination samples following a plan of value given for each location" . "TransferByMap" . .