From 225af2ca9ccc881607cec0b6a9d24521534e28a3 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 18:05:02 +0200 Subject: [PATCH 1/8] fix addition of openbis ID if no keyword is part of yaml yet --- src/main/java/life/qbic/io/PetabParser.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/life/qbic/io/PetabParser.java b/src/main/java/life/qbic/io/PetabParser.java index e4aeb93..ce83c50 100644 --- a/src/main/java/life/qbic/io/PetabParser.java +++ b/src/main/java/life/qbic/io/PetabParser.java @@ -73,12 +73,22 @@ public void addDatasetId(String outputPath, String datasetCode) throws IOExcepti Path path = Paths.get(Objects.requireNonNull(findYaml(new File(outputPath))).getPath()); Charset charset = StandardCharsets.UTF_8; - final String keyWord = "openBISId"; + final String idKeyWord = "openBISId"; - String idInLine = keyWord+":(.*)?(\\r\\n|[\\r\\n])"; + final String endOfLine = ":(.*)?(\\r\\n|[\\r\\n])"; + final String idInLine = idKeyWord+endOfLine; String content = Files.readString(path, charset); - content = content.replaceAll(idInLine, keyWord+": "+datasetCode+"\n"); + // existing property found, fill/replace with relevant dataset code + if(content.contains(idKeyWord)) { + content = content.replaceAll(idInLine, idKeyWord+": "+datasetCode+"\n"); + // no existing property found, create it above the dateOfExperiment property + } else { + String dateKeyword = "dateOfExperiment"; + String dateLine = dateKeyword+endOfLine; + String newLines = idKeyWord+": "+datasetCode+"\n "+dateKeyword+":\n"; + content = content.replaceAll(dateLine, newLines); + } Files.write(path, content.getBytes(charset)); } From b63c22ed7d4f02162d7caba8f9a455abbf267ab8 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 18:05:23 +0200 Subject: [PATCH 2/8] clean up print --- src/main/java/life/qbic/model/download/SEEKConnector.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/life/qbic/model/download/SEEKConnector.java b/src/main/java/life/qbic/model/download/SEEKConnector.java index 152dc5a..dd35eea 100644 --- a/src/main/java/life/qbic/model/download/SEEKConnector.java +++ b/src/main/java/life/qbic/model/download/SEEKConnector.java @@ -137,8 +137,6 @@ public String addAssay(ISAAssay assay) .send(buildAuthorizedPOSTRequest(endpoint, assay.toJson()), BodyHandlers.ofString()); - System.err.println(assay.toJson()); - if(response.statusCode()!=200) { throw new RuntimeException("Failed : HTTP error code : " + response.statusCode()); } From 7de18ad745df9f6e6cbece048fba998bfb36cd5b Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 18:05:58 +0200 Subject: [PATCH 3/8] prepare for addition of link sample to store SEEK links --- .../qbic/model/download/OpenbisConnector.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/main/java/life/qbic/model/download/OpenbisConnector.java b/src/main/java/life/qbic/model/download/OpenbisConnector.java index 2cf951c..3dd134e 100644 --- a/src/main/java/life/qbic/model/download/OpenbisConnector.java +++ b/src/main/java/life/qbic/model/download/OpenbisConnector.java @@ -19,6 +19,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.update.ExperimentUpdate; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.Sample; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.SampleType; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.create.SampleCreation; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFetchOptions; import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SampleIdentifier; @@ -536,15 +537,51 @@ public SampleTypesAndMaterials getSampleTypesWithMaterials() { public void createSeekLinks(SeekStructurePostRegistrationInformation postRegInformation) { Optional> experimentInfo = postRegInformation.getExperimentIDWithEndpoint(); + //TODO link sample type not implemented? + final String SAMPLE_TYPE = "EXTERNAL_LINK"; + + SampleTypeSearchCriteria criteria = new SampleTypeSearchCriteria(); + criteria.withCode().thatEquals(SAMPLE_TYPE); + SampleTypeFetchOptions typeOptions = new SampleTypeFetchOptions(); + typeOptions.withPropertyAssignments().withPropertyType(); + typeOptions.withPropertyAssignments().withEntityType(); + if(openBIS.searchSampleTypes(criteria, typeOptions).getObjects().size() == 0) { + System.out.printf( + "This is where links would be put into openBIS, but EXTERNAL_LINK sample was " + + "not yet added to openBIS instance.%n"); + return; + } + if(experimentInfo.isPresent()) { ExperimentIdentifier id = new ExperimentIdentifier(experimentInfo.get().getLeft()); String endpoint = experimentInfo.get().getRight(); - Map props = new HashMap<>(); - props.put(EXPERIMENT_LINK_PROPERTY, endpoint); - updateExperimentProperties(id, props, false); + SampleCreation sample = createNewLinkSample(endpoint); + sample.setExperimentId(id); + openBIS.createSamples(Arrays.asList(sample)); + } + Map sampleInfos = postRegInformation.getSampleIDsWithEndpoints(); + for(String sampleID : sampleInfos.keySet()) { + SampleIdentifier id = new SampleIdentifier(sampleID); + String endpoint = sampleInfos.get(sampleID); + SampleCreation sample = createNewLinkSample(endpoint); + sample.setParentIds(Arrays.asList(id)); + openBIS.createSamples(Arrays.asList(sample)); } } + private SampleCreation createNewLinkSample(String endpoint) { + final String SAMPLE_TYPE = "EXTERNAL_LINK"; + SampleCreation sample = new SampleCreation(); + sample.setTypeId(new EntityTypePermId(SAMPLE_TYPE, EntityKind.SAMPLE)); + + Map properties = new HashMap<>(); + properties.put("LINK_TYPE", "SEEK"); + properties.put("URL", endpoint); + + sample.setProperties(properties); + return sample; + } + public void updateSeekLinks(SeekStructurePostRegistrationInformation postRegistrationInformation) { } From f8ec586b76f42be6976a8cc4e8078e28bdd1e3f0 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 18:06:24 +0200 Subject: [PATCH 4/8] allow uploading petab to sample objects --- .../commandline/UploadPetabResultCommand.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/main/java/life/qbic/io/commandline/UploadPetabResultCommand.java b/src/main/java/life/qbic/io/commandline/UploadPetabResultCommand.java index 55ec1fa..1e7d5b8 100644 --- a/src/main/java/life/qbic/io/commandline/UploadPetabResultCommand.java +++ b/src/main/java/life/qbic/io/commandline/UploadPetabResultCommand.java @@ -17,7 +17,7 @@ * The Upload PEtab command can be used to upload a PEtab Dataset to openBIS and connect it to its * source files if these are stored in the same openBIS instance and referenced in the PEtabs meta- * data. - * To upload a PEtab dataset, the path to the PEtab folder and the experiment ID to which it should + * To upload a PEtab dataset, the path to the PEtab folder and the object ID to which it should * be attached need to be provided. * The dataset type of the new dataset in openBIS can be specified using the --type option, * otherwise the type "UNKNOWN" will be used. @@ -38,10 +38,10 @@ public class UploadPetabResultCommand implements Runnable { @Parameters(arity = "1", paramLabel = "PEtab folder", description = "The path to the PEtab folder " + "to upload") private String dataPath; - @Parameters(arity = "1", paramLabel = "experiment ID", description = "The full identifier of the " - + "+experiment the data should be attached to. " - + "The identifier must be of the format: /space/project/experiment") - private String experimentID; + @Parameters(arity = "1", paramLabel = "object ID", description = "The full identifier of the " + + "experiment or sample the data should be attached to. The identifier must be of the format: " + + "/space/project/experiment for experiments or /space/sample for samples") + private String objectID; @Option(arity = "1", paramLabel = "dataset type", description = "The openBIS dataset type code the " + "data should be stored as. UNKNOWN if no type is chosen.", names = {"-t", "--type"}) private String datasetType = "UNKNOWN"; @@ -55,7 +55,8 @@ public class UploadPetabResultCommand implements Runnable { public void run() { App.readConfig(); - OpenBIS authentication = App.loginToOpenBIS(auth.getOpenbisPassword(), auth.getOpenbisUser(), auth.getOpenbisAS(), auth.getOpenbisDSS()); + OpenBIS authentication = App.loginToOpenBIS(auth.getOpenbisPassword(), auth.getOpenbisUser(), + auth.getOpenbisAS(), auth.getOpenbisDSS()); openbis = new OpenbisConnector(authentication); if(!pathValid(dataPath)) { @@ -66,8 +67,13 @@ public void run() { System.out.printf("%s is not a directory. Please specify the PETab directory root%n", dataPath); return; } - if(!experimentExists(experimentID)) { - System.out.printf("Experiment %s could not be found%n", experimentID); + boolean attachToSample = false; + boolean attachToExperiment = openbis.experimentExists(objectID); + if(openbis.sampleExists(objectID)) { + attachToSample = true; + } + if(!attachToSample && !attachToExperiment) { + System.out.printf("%s could not be found in openBIS.%n", objectID); return; } System.out.println("Looking for reference datasets in metaInformation.yaml..."); @@ -85,19 +91,21 @@ public void run() { } } System.out.println("Uploading dataset..."); - DataSetPermId result = openbis.registerDatasetForExperiment(Path.of(dataPath), experimentID, - datasetType, parents); - System.out.printf("Dataset %s was successfully created%n", result.getPermId()); + if(attachToExperiment) { + DataSetPermId result = openbis.registerDatasetForExperiment(Path.of(dataPath), objectID, + datasetType, parents); + System.out.printf("Dataset %s was successfully attached to experiment%n", result.getPermId()); + } else { + DataSetPermId result = openbis.registerDatasetForSample(Path.of(dataPath), objectID, + datasetType, parents); + System.out.printf("Dataset %s was successfully attached to sample%n", result.getPermId()); + } } private boolean datasetsExist(List datasetCodes) { return openbis.findDataSets(datasetCodes).size() == datasetCodes.size(); } - private boolean experimentExists(String experimentID) { - return openbis.experimentExists(experimentID); - } - private boolean pathValid(String dataPath) { return new File(dataPath).exists(); } From c9447ab0113967482e9a9f01a5241484bbf09599 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 18:06:30 +0200 Subject: [PATCH 5/8] spacing --- .../life/qbic/io/commandline/UploadDatasetCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/life/qbic/io/commandline/UploadDatasetCommand.java b/src/main/java/life/qbic/io/commandline/UploadDatasetCommand.java index 3cabf78..dc4532c 100644 --- a/src/main/java/life/qbic/io/commandline/UploadDatasetCommand.java +++ b/src/main/java/life/qbic/io/commandline/UploadDatasetCommand.java @@ -25,13 +25,15 @@ * otherwise the type "UNKNOWN" will be used. */ @Command(name = "upload-data", - description = "uploads a dataset and attaches it to an experiment and (optionally) other datasets") + description = "uploads a dataset and attaches it to an experiment or sample and (optionally) " + + "other datasets") public class UploadDatasetCommand implements Runnable { @Parameters(arity = "1", paramLabel = "file/folder", description = "The path to the file or folder to upload") private String dataPath; - @Parameters(arity = "1", paramLabel = "object ID", description = "The full identifier of the experiment or sample the data should be attached to. " - + "The identifier must be of the format: /space/project/experiment for experiments or /space/sample for samples") + @Parameters(arity = "1", paramLabel = "object ID", description = "The full identifier of the " + + "experiment or sample the data should be attached to. The identifier must be of the format: " + + "/space/project/experiment for experiments or /space/sample for samples") private String objectID; @Option(arity = "1..*", paramLabel = "", description = "Optional list of dataset codes to act" + " as parents for the upload. E.g. when this dataset has been generated using these datasets as input.", names = {"-pa", "--parents"}) From 4e48a4b72409404378ce3ad306c485c656a58f0d Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 19:44:57 +0200 Subject: [PATCH 6/8] test and finish update method --- README.md | 25 +++++++++ .../TransferDataToSeekCommand.java | 52 +++++++++---------- .../qbic/model/download/SEEKConnector.java | 36 +++++++++---- 3 files changed, 77 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 3f2642b..be9a4f8 100644 --- a/README.md +++ b/README.md @@ -279,4 +279,29 @@ least one sample attribute is different in openBIS and SEEK 4. assets attached to the experiment or samples will be created, if they are missing from this assay 5. no existing sample or assets are deleted from SEEK, even if they are missing from openBIS +**Example command:** + +`java -jar target/openbis-scripts-1.0.0-jar-with-dependencies.jar openbis-to-seek /MYSPACE/PROJECTY/00_P_INFO_691 mystudy -d -config config.txt --openbis-pw --seek-pw` + +**Example output:** + + Transfer openBIS -> SEEK started. + Provided openBIS object: /MYSPACE/PROJECTY/00_P_INFO_691 + Provided SEEK study title: mystudy + No SEEK project title provided, will search config file. + Transfer datasets to SEEK? true + Update existing nodes if found? true + Connecting to openBIS... + Searching for specified object in openBIS... + Search successful. + Connecting to SEEK... + Collecting information from openBIS... + Translating openBIS property codes to SEEK names... + Creating SEEK structure... + Trying to find existing corresponding assay in SEEK... + Found assay with id 64 + Updating nodes... + Mismatch found in Gender attribute of /MYSPACE/PROJECTY/00_P_INFO_691. Sample will be updated. + http://localhost:3000/assays/64 was successfully updated. + ## Caveats and Future Options diff --git a/src/main/java/life/qbic/io/commandline/TransferDataToSeekCommand.java b/src/main/java/life/qbic/io/commandline/TransferDataToSeekCommand.java index a36c056..5fbd964 100644 --- a/src/main/java/life/qbic/io/commandline/TransferDataToSeekCommand.java +++ b/src/main/java/life/qbic/io/commandline/TransferDataToSeekCommand.java @@ -21,6 +21,7 @@ import life.qbic.model.OpenbisExperimentWithDescendants; import life.qbic.model.OpenbisSeekTranslator; import life.qbic.model.download.SEEKConnector.SeekStructurePostRegistrationInformation; +import life.qbic.model.isa.NodeType; import life.qbic.model.isa.SeekStructure; import life.qbic.model.download.OpenbisConnector; import life.qbic.model.download.SEEKConnector; @@ -88,7 +89,7 @@ public void run() { System.out.printf("No SEEK project title provided, will search config file.%n"); } System.out.printf("Transfer datasets to SEEK? %s%n", transferData); - System.out.printf("Update existing assay if found? %s%n", !noUpdate); + System.out.printf("Update existing nodes if found? %s%n", !noUpdate); if(blacklistFile!=null && !blacklistFile.isBlank()) { System.out.printf("File with datasets codes that won't be transferred: %s%n", blacklistFile); } @@ -100,28 +101,20 @@ public void run() { this.openbis = new OpenbisConnector(authentication); - boolean isSample = false; - boolean isDataSet = false; - System.out.println("Searching for specified object in openBIS..."); boolean isExperiment = experimentExists(objectID); - - if (isExperiment && (studyTitle == null || studyTitle.isBlank())) { - System.out.printf( - "No SEEK study title was provided. This is mandatory if an openBIS experiment is to be transferred%n"); - return; - } + NodeType nodeType = NodeType.ASSAY; if (!isExperiment && sampleExists(objectID)) { - isSample = true; + nodeType = NodeType.SAMPLE; } - if (!isExperiment && !isSample && datasetsExist(Arrays.asList(objectID))) { - isDataSet = true; + if (!isExperiment && !nodeType.equals(NodeType.SAMPLE) && datasetsExist(Arrays.asList(objectID))) { + nodeType = NodeType.ASSET; } - if (!isSample && !isExperiment && !isDataSet) { + if (nodeType.equals(NodeType.ASSAY) && !isExperiment) { System.out.printf( "%s could not be found in openBIS. Make sure you either specify an experiment, sample or dataset%n", objectID); @@ -150,16 +143,20 @@ public void run() { OpenbisExperimentWithDescendants structure; try { System.out.println("Collecting information from openBIS..."); - if (isExperiment) { - structure = openbis.getExperimentWithDescendants(objectID); - postRegInfo = handleExperimentTransfer(structure); - } else if (isSample) { - structure = openbis.getExperimentAndDataFromSample(objectID); - postRegInfo = handleExperimentTransfer(structure); - } else { - structure = openbis.getExperimentStructureFromDataset(objectID); - postRegInfo = handleExperimentTransfer(structure); + switch (nodeType) { + case ASSAY: + structure = openbis.getExperimentWithDescendants(objectID); + break; + case SAMPLE: + structure = openbis.getExperimentAndDataFromSample(objectID); + break; + case ASSET: + structure = openbis.getExperimentStructureFromDataset(objectID); + break; + default: + throw new RuntimeException("Handling of node type " + nodeType + " is not supported."); } + postRegInfo = handleExperimentTransfer(structure, nodeType); } catch (URISyntaxException | IOException | InterruptedException e) { throw new RuntimeException(e); } @@ -171,7 +168,7 @@ public void run() { } private SeekStructurePostRegistrationInformation handleExperimentTransfer( - OpenbisExperimentWithDescendants experiment) + OpenbisExperimentWithDescendants experiment, NodeType nodeType) throws URISyntaxException, IOException, InterruptedException { Set blacklist = parseBlackList(blacklistFile); System.out.println("Translating openBIS property codes to SEEK names..."); @@ -302,8 +299,9 @@ private Set parseBlackList(String blacklistFile) { } } - private SeekStructurePostRegistrationInformation updateAssayStructure(SeekStructure nodeWithChildren, - String assayID) throws URISyntaxException, IOException, InterruptedException { + private SeekStructurePostRegistrationInformation updateAssayStructure( + SeekStructure nodeWithChildren, String assayID) throws URISyntaxException, + IOException, InterruptedException { SeekStructurePostRegistrationInformation postRegInfo = seek.updateAssayNode(nodeWithChildren, assayID); List assetsToUpload = postRegInfo.getAssetsToUpload(); @@ -381,7 +379,7 @@ private Optional getAssayIDForOpenBISExperiment(Experiment experiment) // because if a perm id is found in the wrong SEEK node, meta-information in SEEK could be // overwritten or samples/data added to the wrong assay. String permID = experiment.getPermId().getPermId(); - List assayIDs = seek.searchAssaysContainingKeyword(permID); + List assayIDs = seek.searchAssaysInStudyContainingKeyword(permID); if(assayIDs.isEmpty()) { return Optional.empty(); } diff --git a/src/main/java/life/qbic/model/download/SEEKConnector.java b/src/main/java/life/qbic/model/download/SEEKConnector.java index dd35eea..3ad017e 100644 --- a/src/main/java/life/qbic/model/download/SEEKConnector.java +++ b/src/main/java/life/qbic/model/download/SEEKConnector.java @@ -50,6 +50,7 @@ public class SEEKConnector { private byte[] credentials; private OpenbisSeekTranslator translator; private final String DEFAULT_PROJECT_ID; + private String currentStudy; private final List ASSET_TYPES = new ArrayList<>(Arrays.asList("data_files", "models", "sops", "documents", "publications")); @@ -75,7 +76,8 @@ public void setDefaultInvestigation(String investigationTitle) public void setDefaultStudy(String studyTitle) throws URISyntaxException, IOException, InterruptedException { - translator.setDefaultStudy(searchNodeWithTitle("studies", studyTitle)); + this.currentStudy = searchNodeWithTitle("studies", studyTitle); + translator.setDefaultStudy(currentStudy); } /** @@ -500,18 +502,24 @@ private String searchNodeWithTitle(String nodeType, String title) * @throws IOException * @throws InterruptedException */ - public List searchAssaysContainingKeyword(String searchTerm) + public List searchAssaysInStudyContainingKeyword(String searchTerm) throws URISyntaxException, IOException, InterruptedException { JsonNode result = genericSearch("assays", "*"+searchTerm+"*"); JsonNode hits = result.path("data"); - List assayIDs = new ArrayList<>(); + List assayIDsInStudy = new ArrayList<>(); for (Iterator it = hits.elements(); it.hasNext(); ) { JsonNode hit = it.next(); - assayIDs.add(hit.get("id").asText()); + String assayID = hit.get("id").asText(); + JsonNode assayData = fetchAssayData(assayID).get("data"); + JsonNode relationships = assayData.get("relationships"); + String studyID = relationships.get("study").get("data").get("id").asText(); + if(studyID.equals(currentStudy)) { + assayIDsInStudy.add(assayID); + } } - return assayIDs; + return assayIDsInStudy; } /** @@ -556,8 +564,10 @@ public List searchAssetsContainingKeyword(String searchTerm) /** * Updates information of an existing assay, its samples and attached assets. Missing samples and * assets are created, but nothing missing from the new structure is deleted from SEEK. + * * @param nodeWithChildren the translated Seek structure as it should be once the update is done - * @param assayID the assay id of the existing assay, that should be compared to the new structure + * @param assayID the assay id of the existing assay, that should be compared to the new + * structure * @return information necessary to make post registration updates in openBIS and upload missing * data to newly created assets. In the case of the update use case, only newly created objects * will be contained in the return object. @@ -585,9 +595,9 @@ public SeekStructurePostRegistrationInformation updateAssayNode(SeekStructure no boolean oldEmpty = oldValue == null || oldValue.toString().isEmpty(); boolean newEmpty = newValue == null || newValue.toString().isEmpty(); - if ((!oldEmpty && !newEmpty) && !newValue.equals(oldValue)) { - System.out.printf("Mismatch found in attributes of %s. Sample will be updated.%n", - openBisID); + if ((!oldEmpty && !newEmpty) && !newValue.toString().equals(oldValue.toString())) { + System.out.printf("Mismatch found in %s attribute of %s. Sample will be updated.%n", + key, openBisID); newSample.setAssayIDs(List.of(assayID)); updateSample(newSample, existingSample.getSeekID()); } @@ -840,6 +850,7 @@ public SeekStructurePostRegistrationInformation createNode(SeekStructure nodeWit Pair assayIDPair = nodeWithChildren.getAssayWithOpenBISReference().get(); + System.out.println("Creating assay..."); String assayID = addAssay(assayIDPair.getKey()); String assayEndpoint = apiURL+"/assays/"+assayID; Pair experimentIDWithEndpoint = @@ -850,6 +861,9 @@ public SeekStructurePostRegistrationInformation createNode(SeekStructure nodeWit Map sampleIDsWithEndpoints = new HashMap<>(); Map samplesWithReferences = nodeWithChildren.getSamplesWithOpenBISReference(); + if(!samplesWithReferences.isEmpty()) { + System.out.println("Creating samples..."); + } for(ISASample sample : samplesWithReferences.keySet()) { sample.setAssayIDs(Collections.singletonList(assayID)); String sampleEndpoint = createSample(sample); @@ -858,6 +872,10 @@ public SeekStructurePostRegistrationInformation createNode(SeekStructure nodeWit Map isaToFileMap = nodeWithChildren.getISAFileToDatasetFiles(); + if(!isaToFileMap.isEmpty()) { + System.out.println("Creating assets..."); + } + List assetsToUpload = createAssetsForAssays(isaToFileMap, Collections.singletonList(assayID)); From e1c5c3d51ceb6bc12b3013092ea80531c5c4f81e Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 19:45:50 +0200 Subject: [PATCH 7/8] add node type enum --- src/main/java/life/qbic/model/isa/NodeType.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/java/life/qbic/model/isa/NodeType.java diff --git a/src/main/java/life/qbic/model/isa/NodeType.java b/src/main/java/life/qbic/model/isa/NodeType.java new file mode 100644 index 0000000..e426dd3 --- /dev/null +++ b/src/main/java/life/qbic/model/isa/NodeType.java @@ -0,0 +1,5 @@ +package life.qbic.model.isa; + +public enum NodeType { + ASSAY, SAMPLE, ASSET +} From e6b5e2ddb3ee878dad6f48397a23c80ea810c14d Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 21 Oct 2024 20:00:49 +0200 Subject: [PATCH 8/8] explain EXTERNAL_LINK sample type --- README.md | 10 ++++++++++ .../life/qbic/model/download/OpenbisConnector.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be9a4f8..4cb945b 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,16 @@ The data itself can be transferred and stored in SEEK using the '-d' flag. To completely exclude some dataset information from being transferred, a file ('--blacklist') containing dataset codes (from openBIS) can be specified. //TODO do this for samples/sample types +In order to store links to the newly created SEEK objects in the source openBIS instance, the +following sample type is needed: + + Sample Type Code: EXTERNAL_LINK + Property: LINK_TYPE (VARCHAR) + Property: URL (VARCHAR) + +EXTERNAL_LINK samples are added to transferred experiments and samples and point to their respective +counterparts in SEEK. If the sample type is not available, this will be logged. + ### Updating nodes in SEEK based on updates in openBIS Updating nodes in SEEK uses the same general command, parameters and options. Unless otherwise diff --git a/src/main/java/life/qbic/model/download/OpenbisConnector.java b/src/main/java/life/qbic/model/download/OpenbisConnector.java index 3dd134e..a622259 100644 --- a/src/main/java/life/qbic/model/download/OpenbisConnector.java +++ b/src/main/java/life/qbic/model/download/OpenbisConnector.java @@ -545,7 +545,7 @@ public void createSeekLinks(SeekStructurePostRegistrationInformation postRegInfo SampleTypeFetchOptions typeOptions = new SampleTypeFetchOptions(); typeOptions.withPropertyAssignments().withPropertyType(); typeOptions.withPropertyAssignments().withEntityType(); - if(openBIS.searchSampleTypes(criteria, typeOptions).getObjects().size() == 0) { + if(openBIS.searchSampleTypes(criteria, typeOptions).getObjects().isEmpty()) { System.out.printf( "This is where links would be put into openBIS, but EXTERNAL_LINK sample was " + "not yet added to openBIS instance.%n");