diff --git a/peppy/_version.py b/peppy/_version.py index 6e2b9eaa..509f3b38 100644 --- a/peppy/_version.py +++ b/peppy/_version.py @@ -1 +1 @@ -__version__ = "0.40.6" +__version__ = "0.40.7" diff --git a/peppy/project.py b/peppy/project.py index b7b58e0b..a05c05b1 100644 --- a/peppy/project.py +++ b/peppy/project.py @@ -809,7 +809,7 @@ def attr_merge(self): if len(this_sample_rows) == 0: _LOGGER.debug( "No merge rows for sample '%s', skipping", - sample[SAMPLE_NAME_ATTR], + sample[self.st_index], ) continue _LOGGER.debug("%d rows to merge", len(this_sample_rows)) diff --git a/tests/data/example_peps-master/example_multiple_subsamples/project_config.yaml b/tests/data/example_peps-master/example_multiple_subsamples/project_config.yaml new file mode 100644 index 00000000..39c895ca --- /dev/null +++ b/tests/data/example_peps-master/example_multiple_subsamples/project_config.yaml @@ -0,0 +1,21 @@ +pep_version: "2.1.0" +sample_table: sample_table.csv +subsample_table: + - subsample_table1.csv + - subsample_table2.csv + +sample_table_index: sample_id + +sample_modifiers: + append: + local_files: LOCAL + genome: "fg" + derive: + attributes: [local_files] + sources: + LOCAL: "../data/{file_path}" + imply: + - if: + identifier: "frog1" + then: + genome: "frog_frog" diff --git a/tests/data/example_peps-master/example_multiple_subsamples/sample_table.csv b/tests/data/example_peps-master/example_multiple_subsamples/sample_table.csv new file mode 100644 index 00000000..7c06204c --- /dev/null +++ b/tests/data/example_peps-master/example_multiple_subsamples/sample_table.csv @@ -0,0 +1,5 @@ +sample_id,protocol,identifier +frog_1,anySampleType,frog1 +frog_2,anySampleType,frog2 +frog_3,anySampleType,frog3 +frog_4,anySampleType,frog4 diff --git a/tests/data/example_peps-master/example_multiple_subsamples/subsample_table1.csv b/tests/data/example_peps-master/example_multiple_subsamples/subsample_table1.csv new file mode 100644 index 00000000..f1b3c2f1 --- /dev/null +++ b/tests/data/example_peps-master/example_multiple_subsamples/subsample_table1.csv @@ -0,0 +1,6 @@ +sample_id,file_path,subsample_name +frog_1,file/a.txt,a +frog_1,file/b.txt,b +frog_1,file/c.txt,c +frog_2,file/a.txt,a +frog_2,file/b.txt,b diff --git a/tests/data/example_peps-master/example_multiple_subsamples/subsample_table2.csv b/tests/data/example_peps-master/example_multiple_subsamples/subsample_table2.csv new file mode 100644 index 00000000..5e6d2981 --- /dev/null +++ b/tests/data/example_peps-master/example_multiple_subsamples/subsample_table2.csv @@ -0,0 +1,6 @@ +sample_id,random_string,subsample_name +frog_1,x_x,x +frog_1,y_y,y +frog_1,z_z,z +frog_2,xy_yx,xy +frog_2,xx_xx,xx diff --git a/tests/test_Project.py b/tests/test_Project.py index 6d573f2b..d4112ac6 100644 --- a/tests/test_Project.py +++ b/tests/test_Project.py @@ -226,8 +226,10 @@ def test_subsample_table_works_when_no_sample_mods(self, example_pep_cfg_path): p = Project(cfg=example_pep_cfg_path) assert any([s["file"] != "multi" for s in p.samples]) - @pytest.mark.parametrize("example_pep_cfg_path", ["custom_index"], indirect=True) - def test_cutsom_sample_table_index_config(self, example_pep_cfg_path): + @pytest.mark.parametrize( + "example_pep_cfg_path", ["custom_index", "multiple_subsamples"], indirect=True + ) + def test_custom_sample_table_index_config(self, example_pep_cfg_path): """ Verify that custom sample table index is sourced from the config """ @@ -599,7 +601,7 @@ def test_unequality(self, example_pep_cfg_path, example_pep_csv_path): @pytest.mark.parametrize( "example_pep_cfg_path", - ["append", "custom_index", "imply", "subtables"], + ["append", "custom_index", "imply", "subtables", "multiple_subsamples"], indirect=True, ) @pytest.mark.parametrize("orient", ["dict", "records"])