String name = "Name of study" + i; String id = "study" + i; studiesTmp.add(catalogManager.getStudyManager().create(projectId, id, id, name, Study.Type.FAMILY, null, "Description of" + " " + id, null, null, null, null, null, null, null, null, userSession.getValue()).first().getFqn());
@Before public void setUp() throws IOException, CatalogException, URISyntaxException { catalogManager = catalogManagerExternalResource.getCatalogManager(); catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); project = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first(); study = catalogManager.getStudyManager().create(project.getId(), "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser).first(); folder = catalogManager.getFileManager().createFolder(study.getId(), Paths.get("data/vcf/").toString(), null, true, null, QueryOptions.empty(), sessionIdUser).first(); Path vcfPath = catalogManagerExternalResource.getOpencgaHome().resolve(VCF_FILE_NAME); Files.copy(this.getClass().getClassLoader().getResourceAsStream("biofiles/" + VCF_FILE_NAME), vcfPath, StandardCopyOption.REPLACE_EXISTING); vcfFileUri = vcfPath.toUri(); Path bamPath = catalogManagerExternalResource.getOpencgaHome().resolve(BAM_FILE_NAME); Files.copy(this.getClass().getClassLoader().getResourceAsStream("biofiles/" + BAM_FILE_NAME), bamPath, StandardCopyOption.REPLACE_EXISTING); bamFileUri = bamPath.toUri(); }
Query query = new Query(ProjectDBAdaptor.QueryParams.USER_ID.key(), "user"); String projectId = catalogManager.getProjectManager().get(query, null, sessionIdUser).first().getId(); catalogManager.getStudyManager().create(projectId, "study_1", null, "study_1", Study.Type.CASE_CONTROL, "creationDate", "description", new Status(), null, null, null, null, null, null, null, sessionIdUser); catalogManager.getStudyManager().create(projectId, "study_2", null, "study_2", Study.Type.CASE_CONTROL, "creationDate", "description", new Status(), null, null, null, null, null, null, null, sessionIdUser); catalogManager.getStudyManager().create(projectId, "study_3", null, "study_3", Study.Type.CASE_CONTROL, "creationDate", "description", new Status(), null, null, null, null, null, null, null, sessionIdUser); String study_4 = catalogManager.getStudyManager().create(projectId, "study_4", null, "study_4", Study.Type.CASE_CONTROL, "creationDate", "description", new Status(), null, null, null, null, null, null, null, sessionIdUser).first().getId();
String s2 = catalogManager.getStudyManager().create(project2, "s2", null, "Study 2", Study.Type.CONTROL_SET, null, "", null, null, null, null, null, null, null, null, sessionIdUser2).first().getId(); catalogManager.getStudyManager().updateGroup(s2, "@members", new GroupParams("user", GroupParams.Action.ADD), sessionIdUser2); String s3 = catalogManager.getStudyManager().create(project3, "s3", null, "StudyProject3", Study.Type.CONTROL_SET, null, "", null, null, null, null, null, null, null, null, sessionIdUser3).first().getId(); catalogManager.getStudyManager().updateGroup(String.valueOf(s3), "@members", new GroupParams("user", GroupParams.Action.ADD), sessionIdUser3);
@Test public void testGetSelectedStudyUserAnonymousCanSee() throws CatalogException { StudyManager studyManager = catalogManager.getStudyManager(); try { studyManager.resolveIds(Collections.singletonList("phase3"), "*"); fail("This should throw an exception. No studies should be found for user anonymous"); } catch (CatalogException e) { } // Create another study with alias phase3 QueryResult<Study> study = catalogManager.getStudyManager().create(project2, "phase3", null, "Phase 3", Study.Type.CASE_CONTROL, null, "d", null, null, null, null, null, null, null, null, sessionIdUser2); catalogManager.getStudyManager().updateGroup("phase3", "@members", new GroupParams("*", GroupParams.Action.ADD), sessionIdUser2); List<Study> studies = studyManager.resolveIds(Collections.singletonList("phase3"), "*"); assertEquals(1, studies.size()); assertEquals(study.first().getUid(), studies.get(0).getUid()); }
studyFqn = catalogManager.getStudyManager().create(project.getFqn(), "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdOwner).first().getFqn();
@Before public void setUp() throws IOException, CatalogException { catalogManager = catalogManagerExternalResource.getCatalogManager(); catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); project = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first(); study = catalogManager.getStudyManager().create(project.getId(), "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser).first(); folder = catalogManager.getFileManager().createFolder(study.getId(), Paths.get("data/test/folder/").toString(), null, true, null, QueryOptions.empty(), sessionIdUser).first(); directory = catalogManagerExternalResource.getOpencgaHome().resolve("catalog_scan_test_folder").toAbsolutePath(); if (directory.toFile().exists()) { IOUtils.deleteDirectory(directory); } Files.createDirectory(directory); }
@Test public void testGetOnlyStudyUserAnonymousCanSee() throws CatalogException { StudyManager studyManager = catalogManager.getStudyManager(); try { studyManager.resolveIds(Collections.emptyList(), "*"); fail("This should throw an exception. No studies should be found for user anonymous"); } catch (CatalogException e) { } // Create another study with alias phase3 QueryResult<Study> study = catalogManager.getStudyManager().create(String.valueOf(project2), "phase3", null, "Phase 3", Study.Type .CASE_CONTROL, null, "d", null, null, null, null, null, null, null, null, sessionIdUser2); try { studyManager.resolveIds(Collections.emptyList(), "*"); fail("This should throw an exception. No studies should be found for user anonymous"); } catch (CatalogException e) { } catalogManager.getStudyManager().updateGroup("phase3", "@members", new GroupParams("*", GroupParams.Action.ADD), sessionIdUser2); List<Study> studies = studyManager.resolveIds(Collections.emptyList(), "*"); assertEquals(1, studies.size()); assertEquals(study.first().getUid(), studies.get(0).getUid()); }
@BeforeClass public static void beforeClass() throws IOException, CatalogException, URISyntaxException { Configuration configuration = Configuration.load(CatalogSampleAnnotationsLoaderTest.class.getClassLoader() .getClass().getResource("/configuration-test.yml").openStream()); configuration.getAdmin().setAlgorithm("HS256"); catalogManager = new CatalogManager(configuration); catalogManager.deleteCatalogDB(true); catalogManager.installCatalogDB("dummy", "admin"); loader = new CatalogSampleAnnotationsLoader(catalogManager); String pedFileName = "20130606_g1k.ped"; URL pedFileURL = CatalogSampleAnnotationsLoader.class.getClassLoader().getResource(pedFileName); pedigree = loader.readPedigree(pedFileURL.getPath()); userId = "user1"; catalogManager.getUserManager().create(userId, userId, "asdasd@asd.asd", userId, "", -1L, Account.FULL, QueryOptions.empty(), null); sessionId = catalogManager.getUserManager().login(userId, userId); Project project = catalogManager.getProjectManager().create("def", "default", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionId).getResult().get(0); Study study = catalogManager.getStudyManager().create(project.getFqn(), "def", null, "default", Study.Type.FAMILY, null, "", null, null, null, null, null, null, null, null, sessionId).getResult().get(0); studyId = study.getFqn(); pedFile = catalogManager.getFileManager().create(studyId, File.Type.FILE, File.Format.PED, File.Bioformat .OTHER_PED, "data/" + pedFileName, null, "", null, 0, -1, null, (long) -1, null, null, true, null, null, sessionId) .getResult().get(0); new FileUtils(catalogManager).upload(pedFileURL.toURI(), pedFile, null, sessionId, false, false, false, true, 10000000); pedFile = catalogManager.getFileManager().get(studyId, pedFile.getPath(), null, sessionId).getResult().get(0); }
String newStudy = catalogManager.getStudyManager().create(project2, "alias", null, "name", Study.Type.CASE_CONTROL, "", "", null, null, null, myStudy.toUri(), null, null, null, null, sessionIdUser2).first().getFqn();
@Test public void createStudyFailMoreThanOneProject() throws CatalogException { catalogManager.getProjectManager().incrementRelease(project1, sessionIdUser); catalogManager.getProjectManager().create("1000G2", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser); // Create a new study without providing the project. It should raise an error because the user owns more than one project thrown.expect(CatalogException.class); thrown.expectMessage("More than one project found"); catalogManager.getStudyManager().create(null, "phasexx", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser); }
public void setUpCatalogManager(CatalogManager catalogManager) throws IOException, CatalogException { catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); String projectId = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first().getId(); catalogManager.getStudyManager().create(projectId, "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser); }
private void setUpCatalogManager(CatalogManager catalogManager) throws IOException, CatalogException { catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); String projectId = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first().getId(); catalogManager.getStudyManager().create(projectId, "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser); }
public void setUpCatalogManager(CatalogManager catalogManager) throws IOException, CatalogException { catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); String projectId = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first().getId(); catalogManager.getStudyManager().create(projectId, "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser); }
sessionId = catalog.getUserManager().login("user", "1234"); catalog.getProjectManager().create("p1", "p1", "", null, "hsapiens", "Homo Sapiens", null, "GRCh38", null, sessionId); catalog.getStudyManager().create("p1", "s1", null, "s1", Study.Type.CONTROL_SET, null, null, null, null, null, null, null, null, null, null, sessionId); catalog.getStudyManager().create("p1", "s2", null, "s2", Study.Type.CONTROL_SET, null, null, null, null, null, null, null, null, null, null, sessionId); catalog.getStudyManager().create("p1", "s3", null, "s3", Study.Type.CONTROL_SET, null, null, null, null, null, null, null, null, null, null, sessionId); file1 = createFile("data/file1.vcf"); file2 = createFile("data/file2.vcf"); catalog.getStudyManager().create("p2", "p2s2", null, "s1", Study.Type.CONTROL_SET, null, null, null, null, null, null, null, null, null, null, sessionId);
Study study = catalogManager.getStudyManager().create(projectId, "std", "std", "std", Study.Type.CONTROL_SET, null, "", null, null, null, null, null, null, null, null, userSessionId).getResult().get(0); studyUid = study.getUid();
projectId = catalogManager.getProjectManager().create("p1", "p1", "Project 1", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionId).first().getId(); Study study = catalogManager.getStudyManager().create(projectId, "s1", null, "s1", Study.Type.CASE_CONTROL, null, "Study " + "1", null, null, null, null, Collections.singletonMap(File.Bioformat.VARIANT, new DataStore("mongodb", DB_NAME)), null, null, null, sessionId).first();
projectId = catalogManager.getProjectManager().create(projectAlias, projectAlias, "Project 1", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionId).first().getId(); Study study = catalogManager.getStudyManager().create(projectId, "s1", "s1", "s1", Study.Type.CASE_CONTROL, null, "Study 1", null, null, null, null, Collections.singletonMap(File.Bioformat.VARIANT, new DataStore(getStorageEngine(), dbName)), null, Collections.singletonMap(VariantStorageEngine.Options.AGGREGATED_TYPE.key(), getAggregation()), null, sessionId) .first(); QueryOptions.empty(), sessionId).first().getId(); outputPath = "data/index/"; studyId2 = catalogManager.getStudyManager().create(projectId, "s2", "s2", "s2", Study.Type.CASE_CONTROL, null, "Study " + "2", null, null, null, null, Collections.singletonMap(File.Bioformat.VARIANT, new DataStore(getStorageEngine(), dbName)), null, Collections.singletonMap(VariantStorageEngine.Options.AGGREGATED_TYPE.key(), getAggregation()), null, sessionId).first().getId(); outputId2 = catalogManager.getFileManager().createFolder(studyId2, Paths.get("data", "index").toString(), null,
public void setUpCatalogManager(CatalogManager catalogManager) throws IOException, CatalogException { catalogManager.getUserManager().create("user", "User Name", "mail@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); catalogManager.getUserManager().create("user2", "User2 Name", "mail2@ebi.ac.uk", PASSWORD, "", null, Account.FULL, null, null); catalogManager.getUserManager().create("user3", "User3 Name", "user.2@e.mail", PASSWORD, "ACME", null, Account.FULL, null, null); sessionIdUser = catalogManager.getUserManager().login("user", PASSWORD); sessionIdUser2 = catalogManager.getUserManager().login("user2", PASSWORD); sessionIdUser3 = catalogManager.getUserManager().login("user3", PASSWORD); project1 = catalogManager.getProjectManager().create("1000G", "Project about some genomes", "", "ACME", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser).first().getId(); project2 = catalogManager.getProjectManager().create("pmp", "Project Management Project", "life art intelligent system", "myorg", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser2).first().getId(); project3 = catalogManager.getProjectManager().create("p1", "project 1", "", "", "Homo sapiens", null, null, "GRCh38", new QueryOptions(), sessionIdUser3).first().getId(); studyId = catalogManager.getStudyManager().create(project1, "phase1", null, "Phase 1", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser).first().getFqn(); studyId2 = catalogManager.getStudyManager().create(project1, "phase3", null, "Phase 3", Study.Type.CASE_CONTROL, null, "d", null, null, null, null, null, null, null, null, sessionIdUser).first().getFqn(); studyId3 = catalogManager.getStudyManager().create(project2, "s1", null, "Study 1", Study.Type.CONTROL_SET, null, "", null, null, null, null, null, null, null, null, sessionIdUser2).first().getFqn(); }
@Test public void testGetTreeViewMoreThanOneFile() throws CatalogException { // Create a new study so more than one file will be found under the root /. However, it should be able to consider the study given // properly catalogManager.getStudyManager().create(project1, "phase2", null, "Phase 2", Study.Type.TRIO, null, "Done", null, null, null, null, null, null, null, null, sessionIdUser).first().getUid(); QueryResult<FileTree> fileTree = catalogManager.getFileManager().getTree("/", studyFqn, new Query(), new QueryOptions(), 5, sessionIdUser); assertEquals(7, fileTree.getNumResults()); fileTree = catalogManager.getFileManager().getTree(".", "user@1000G:phase2", new Query(), new QueryOptions(), 5, sessionIdUser); assertEquals(1, fileTree.getNumResults()); }