Skip to content
Snippets Groups Projects
Commit 4fb6bd69 authored by brinn's avatar brinn
Browse files

add: query IScreeningQuery.getPlateLocationsForMaterialId(materialId) independent of the experiment

SVN: 17315
parent 528b7a49
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,41 @@ public interface IScreeningQuery extends BaseQuery
public DataIterator<WellContent> getPlateLocationsForMaterialId(long materialId,
long experimentId);
/**
* @return well locations which are connected to a given material (e.g. gene) with the specified
* id.
*/
@Select(sql = "select "
+ " pl.id as plate_id,"
+ " exp.id as exp_id,"
+ " exp.code as exp_code,"
+ " exp.perm_id as exp_perm_id,"
+ " projects.code as proj_code,"
+ " groups.code as space_code,"
+ " pl.perm_id as plate_perm_id,"
+ " pl.code as plate_code,"
+ " pl_type.code as plate_type_code,"
+ " well.id as well_id,"
+ " well.perm_id as well_perm_id,"
+ " well.code as well_code,"
+ " well_type.code as well_type_code,"
+ " well_material.id as material_content_id,"
+ " well_material.code as material_content_code,"
+ " well_material_type.code as material_content_type_code"
+ " from samples pl"
+ " join samples well on pl.id = well.samp_id_part_of"
+ " join experiments exp on pl.expe_id = exp.id"
+ " join projects on exp.proj_id = projects.id"
+ " join groups on projects.grou_id = groups.id"
+ " join sample_types pl_type on pl.saty_id = pl_type.id"
+ " join sample_types well_type on well.saty_id = well_type.id"
+ " join sample_properties well_props on well.id = well_props.samp_id"
+ " join materials well_material on well_props.mate_prop_id = well_material.id"
+ " join material_types well_material_type on well_material.maty_id = well_material_type.id"
+ " where "
+ " well_material.id = ?{1}")
public DataIterator<WellContent> getPlateLocationsForMaterialId(long materialId);
// well content with "first-level" materials (like oligos or controls)
static final String PLATE_LOCATIONS_MANY_MATERIALS_SELECT =
"select pl.id as plate_id, pl.perm_id as plate_perm_id, pl.code as plate_code, pl_type.code as plate_type_code, "
......
......@@ -51,5 +51,17 @@ public class WellContent
public String material_content_code;
public String material_content_type_code;
// a pointer to the experiment of the plate
public long exp_id;
public String exp_code;
public String exp_perm_id;
public String proj_code;
public String space_code;
}
......@@ -70,12 +70,21 @@ public class ScreeningDAOTest extends AbstractDAOWithoutContextTest
@Test
public void testGetPlateLocationsForOneMaterial()
{
// it just tests if the sql is correct
// it just tests if the sql runs
List<WellContent> locations =
EntityListingTestUtils.asList(query.getPlateLocationsForMaterialId(1, 1));
AssertJUnit.assertEquals(0, locations.size());
}
@Test
public void testGetPlateLocationsForOneMaterialAllExperiments()
{
// it just tests if the sql runs
List<WellContent> locations =
EntityListingTestUtils.asList(query.getPlateLocationsForMaterialId(1));
AssertJUnit.assertEquals(0, locations.size());
}
@Test
public void testGetPlateLocationsForManyMaterials()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment