Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to: #69

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ISA-JSON we are using actually contains those fields. I think we might want to revert this for the source sample.

collection date:

"category": {
"@id": "#characteristic_category/collection_date_323"
},
"value": {
"annotationValue": "01/01/2022",
"termSource": "",
"termAccession": ""
}
},

Geographic location:

"category": {
"@id": "#characteristic_category/geographic_location_(country_and/or_sea)_326"
},
"value": {
"annotationValue": "Belgium",
"termSource": "",
"termAccession": ""
}
},

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