Skip to content

Commit

Permalink
Fixes to:
Browse files Browse the repository at this point in the history
1. Experiment alias use in RUN
2. Webin service URL - use test and not dev
3. BioSamples mandatory attributes
  • Loading branch information
dipayan1985 committed Nov 7, 2024
1 parent 00e36f9 commit 2ef1916
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ private BioSample createAndUpdateChildSampleWithRelationship(
final BioSample bioSample = new BioSample.Builder(sample.getName() != null ? sample.getName() : "child_sample")
.withRelease(Instant.now())
.withAttributes(
Collections.singletonList(Attribute.build("organism", parentSampleOrganism)))
List.of(Attribute.build("organism", parentSampleOrganism),
Attribute.build("collection date", "not provided"),
Attribute.build("geographic location (country and/or sea)", "not provided")))
.build();
try {
final EntityModel<BioSample> persistedSampleEntity = this.createSampleInBioSamples(bioSample, webinToken);
Expand Down Expand Up @@ -147,7 +149,9 @@ private BioSample createSourceBioSample(final List<Study> studies, final String

final BioSample sourceSample = new BioSample.Builder(source.getName())
.withRelease(Instant.now())
.withAttributes(Collections.singleton(organismAttribute.get()))
.withAttributes(List.of(organismAttribute.get(),
Attribute.build("collection date", "not provided"),
Attribute.build("geographic location (country and/or sea)", "not provided")))
.build();
final EntityModel<BioSample> persistedParentSampleEntity = this.createSampleInBioSamples(sourceSample,
webinToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String performSubmissionToEna(
webinElement, studies, randomSubmissionIdentifier);

final Map<String, String> typeToBioSamplesAccessionMap = getBiosamples(studies);
final Map<Integer, String> experimentSequenceMap =
final Map<String, String> experimentSequenceMap =
this.webinExperimentXmlCreator.createENAExperimentSetElement(
typeToBioSamplesAccessionMap, webinElement, studies, randomSubmissionIdentifier);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
Expand All @@ -16,7 +15,7 @@
public class WebinExperimentXmlCreator {
public static final String OTHER_MATERIAL_LIBRARY_NAME_DETERMINES_EXPERIMENT = "Library Name";

public Map<Integer, String> createENAExperimentSetElement(
public Map<String, String> createENAExperimentSetElement(
final Map<String, String> typeToBioSamplesAccessionMap,
final Element webinElement,
final List<Study> studies,
Expand Down Expand Up @@ -110,15 +109,14 @@ private AtomicReference<Map<String, List<Parameter>>> populateProtocolToParamete
return protocolToParameterMap;
}

private Map<Integer, String> mapExperiments(
private Map<String, String> mapExperiments(
final List<Study> studies,
final Element root,
final Map<String, List<Parameter>> protocolToParameterMap,
final Map<String, String> bioSampleAccessions,
final String randomSubmissionIdentifier) {
final Map<String, List<ParameterValue>> protocolToParameterValuesMap = new HashMap<>();
final Map<Integer, String> experimentSequence = new HashMap<>();
final AtomicInteger sequenceCounter = new AtomicInteger(0);
final Map<String, String> experimentSequence = new HashMap<>();

studies.forEach(
study ->
Expand All @@ -133,11 +131,11 @@ private Map<Integer, String> mapExperiments(
otherMaterial -> {
final Element experimentElement = root.addElement("EXPERIMENT");
final String otherMaterialId = otherMaterial.getId();
final String experimentId =
otherMaterialId + "-" + randomSubmissionIdentifier;

experimentSequence.put(
sequenceCounter.incrementAndGet(), otherMaterialId);
experimentElement.addAttribute(
"alias", otherMaterialId + "-" + randomSubmissionIdentifier);
experimentSequence.put(otherMaterialId, experimentId);
experimentElement.addAttribute("alias", experimentId);
experimentElement
.addElement("TITLE")
.addText(otherMaterial.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class WebinHttpSubmissionService {
final RestTemplate restTemplate = new RestTemplate();
private static final String webinSubmissionUrl =
"https://wwwdev.ebi.ac.uk/ena/dev/submit/webin-v2/submit";
"https://wwwdev.ebi.ac.uk/ena/submit/webin-v2/submit";

public String performWebinSubmission(
final String submissionAccountId, final String webinXml, final String webinPassword) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ public class WebinRunXmlCreator {
public void createENARunSetElement(
final Element webinElement,
final List<Study> studies,
final Map<Integer, String> experimentSequenceMap,
final Map<String, String> experimentSequenceMap,
final String randomSubmissionIdentifier) {
final String lastExperimentId =
experimentSequenceMap.get(
Collections.max(experimentSequenceMap.entrySet(), Map.Entry.comparingByValue())
.getKey());
final String lastExperimentKeyInRawFile =
Collections.max(experimentSequenceMap.entrySet(), Map.Entry.comparingByKey()).getKey();
final String lastExperimentIdGenerated =
Collections.max(experimentSequenceMap.entrySet(), Map.Entry.comparingByKey()).getValue();

final Element runSetElement = webinElement.addElement("RUN_SET");

studies.forEach(
Expand All @@ -37,7 +38,7 @@ public void createENARunSetElement(
runElement.addElement("TITLE").addText(assayId);
runElement
.addElement("EXPERIMENT_REF")
.addAttribute("refname", lastExperimentId);
.addAttribute("refname", lastExperimentIdGenerated);

final AtomicReference<Output> dataFileOutput = new AtomicReference<>();
assay
Expand All @@ -48,7 +49,7 @@ public void createENARunSetElement(
.getInputs()
.forEach(
input -> {
if (input.getId().equals(lastExperimentId)) {
if (input.getId().equals(lastExperimentKeyInRawFile)) {
dataFileOutput.set(
processSequence.getOutputs().get(0));
}
Expand Down

0 comments on commit 2ef1916

Please sign in to comment.