Unverified Commit 74bd7b6a authored by M. Haseeb's avatar M. Haseeb Committed by GitHub

Merge pull request #35 from enasequence/ENA-4067

ENA-4067
parents e6cfdbb0 71ba8865
......@@ -11,7 +11,7 @@ plugins {
apply plugin: 'io.spring.dependency-management'
group = 'uk.ac.ebi.ena.webin-cli'
version = '3.2.2'
version = '3.3.0'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
......@@ -75,10 +75,10 @@ task printWebinTestCredentials {
}
dependencies {
implementation( 'uk.ac.ebi.ena.webin-cli:webin-cli-validator:1.0.9.1' )
implementation( 'uk.ac.ebi.ena.webin-cli:webin-cli-validator:1.1.0' )
implementation( 'uk.ac.ebi.ena.sequence:sequencetools:2.0.86' )
implementation( 'uk.ac.ebi.ena.txmbtools:txmbtools:1.0.3' )
implementation( 'uk.ac.ebi.ena:readtools:1.6.1' )
implementation( 'uk.ac.ebi.ena:readtools:1.8.0' )
implementation( 'org.springframework.boot:spring-boot-starter' )
implementation( 'org.springframework.boot:spring-boot-starter-web' ) {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
......
......@@ -100,6 +100,34 @@ public abstract class SequenceToolsXmlWriter<M extends Manifest, R extends Valid
for (Element e : createXmlFileElements(manifest, inputDir, uploadDir)) filesE.addContent(e);
Element analysisAttributesE = new Element("ANALYSIS_ATTRIBUTES");
if (manifest.getSubmissionTool() != null && !manifest.getSubmissionTool().isEmpty()) {
Element submissionToolAnalysisAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL");
Element submissionToolAnalysisAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionTool());
Element submissionToolAnalysisAttributeE = new Element("ANALYSIS_ATTRIBUTE");
submissionToolAnalysisAttributeE.addContent(submissionToolAnalysisAttributeTagE);
submissionToolAnalysisAttributeE.addContent(submissionToolAnalysisAttributeValueE);
analysisAttributesE.addContent(submissionToolAnalysisAttributeE);
}
if (manifest.getSubmissionToolVersion() != null && !manifest.getSubmissionToolVersion().isEmpty()) {
Element submissionToolVersionAnalysisAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL_VERSION");
Element submissionToolVersionAnalysisAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionToolVersion());
Element submissionToolVersionAnalysisAttributeE = new Element("ANALYSIS_ATTRIBUTE");
submissionToolVersionAnalysisAttributeE.addContent(submissionToolVersionAnalysisAttributeTagE);
submissionToolVersionAnalysisAttributeE.addContent(submissionToolVersionAnalysisAttributeValueE);
analysisAttributesE.addContent(submissionToolVersionAnalysisAttributeE);
}
if (analysisAttributesE.getContentSize() > 0) {
analysisE.addContent(analysisAttributesE);
}
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat());
StringWriter stringWriter = new StringWriter();
......
......@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Map;
import uk.ac.ebi.ena.webin.cli.WebinCliMessage;
import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.*;
import uk.ac.ebi.ena.webin.cli.manifest.processor.*;
import uk.ac.ebi.ena.webin.cli.validator.file.SubmissionFile;
......@@ -129,7 +130,9 @@ GenomeManifestReader extends ManifestReader<GenomeManifest> {
.file().optional().name( Field.UNLOCALISED_LIST ).desc( Description.UNLOCALISED_LIST ).processor( getUnlocalisedListProcessors() ).and()
.meta().optional().name( Field.TPA ).desc( Description.TPA ).processor( CVFieldProcessor.CV_BOOLEAN ).and()
.meta().optional().name( Field.AUTHORS ).desc( Description.AUTHORS ).processor(new AuthorProcessor()).and()
.meta().optional().name( Field.ADDRESS ).desc( Description.ADDRESS )
.meta().optional().name( Field.ADDRESS ).desc( Description.ADDRESS ).and()
.meta().optional().name(Fields.SUBMISSION_TOOL).desc(Descriptions.SUBMISSION_TOOL).and()
.meta().optional().name(Fields.SUBMISSION_TOOL_VERSION).desc(Descriptions.SUBMISSION_TOOL_VERSION)
.build()
,
// File groups.
......@@ -242,6 +245,9 @@ GenomeManifestReader extends ManifestReader<GenomeManifest> {
manifest.setTpa( getAndValidateBoolean( getManifestReaderResult().getField( Field.TPA ) ) );
}
manifest.setSubmissionTool(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL));
manifest.setSubmissionToolVersion(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL_VERSION));
SubmissionFiles<GenomeManifest.FileType> submissionFiles = manifest.files();
getFiles( getInputDir(), getManifestReaderResult(), Field.FASTA ).forEach(fastaFile -> submissionFiles.add( new SubmissionFile( GenomeManifest.FileType.FASTA, fastaFile ) ) );
......
......@@ -108,7 +108,10 @@ ReadsManifestReader extends ManifestReader<ReadsManifest> {
.file().optional().name(Field.BAM).desc(Description.BAM).processor(getBamProcessors()).and()
.file().optional().name(Field.CRAM).desc(Description.CRAM).processor(getCramProcessors()).and()
.meta().optional().hidden().name(Field.QUALITY_SCORE).desc(Description.QUALITY_SCORE).processor(new CVFieldProcessor(CV_QUALITY_SCORE)).and()
.meta().optional().hidden().name(Field.__HORIZON).desc(Description.__HORIZON).build()
.meta().optional().hidden().name(Field.__HORIZON).desc(Description.__HORIZON).and()
.meta().optional().name(Fields.SUBMISSION_TOOL).desc(Descriptions.SUBMISSION_TOOL).and()
.meta().optional().name(Fields.SUBMISSION_TOOL_VERSION).desc(Descriptions.SUBMISSION_TOOL_VERSION)
.build()
,
// File groups.
new ManifestFileCount.Builder()
......@@ -193,6 +196,9 @@ ReadsManifestReader extends ManifestReader<ReadsManifest> {
if (getManifestReaderResult().getCount(Field.__HORIZON) > 0)
manifest.setPairingHorizon(getAndValidatePositiveInteger(getManifestReaderResult().getField(Field.__HORIZON)));
manifest.setSubmissionTool(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL));
manifest.setSubmissionToolVersion(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL_VERSION));
processInstrumentAndPlatform();
SubmissionFiles<ReadsManifest.FileType> submissionFiles = manifest.files();
......
......@@ -153,6 +153,34 @@ public class ReadsXmlWriter implements XmlWriter<ReadsManifest, ReadsValidationR
instrumentModelE.setText(instrument);
platformRefE.addContent(instrumentModelE);
Element expAttributesE = new Element("EXPERIMENT_ATTRIBUTES");
if (manifest.getSubmissionTool() != null && !manifest.getSubmissionTool().isEmpty()) {
Element submissionToolExpAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL");
Element submissionToolExpAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionTool());
Element submissionToolExpAttributeE = new Element("EXPERIMENT_ATTRIBUTE");
submissionToolExpAttributeE.addContent(submissionToolExpAttributeTagE);
submissionToolExpAttributeE.addContent(submissionToolExpAttributeValueE);
expAttributesE.addContent(submissionToolExpAttributeE);
}
if (manifest.getSubmissionToolVersion() != null && !manifest.getSubmissionToolVersion().isEmpty()) {
Element submissionToolVersionExpAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL_VERSION");
Element submissionToolVersionExpAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionToolVersion());
Element submissionToolVersionExpAttributeE = new Element("EXPERIMENT_ATTRIBUTE");
submissionToolVersionExpAttributeE.addContent(submissionToolVersionExpAttributeTagE);
submissionToolVersionExpAttributeE.addContent(submissionToolVersionExpAttributeValueE);
expAttributesE.addContent(submissionToolVersionExpAttributeE);
}
if (expAttributesE.getContentSize() > 0) {
experimentE.addContent(expAttributesE);
}
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat());
StringWriter stringWriter = new StringWriter();
......@@ -207,6 +235,34 @@ public class ReadsXmlWriter implements XmlWriter<ReadsManifest, ReadsValidationR
.forEach(
file -> filesE.addContent(createFileElement(inputDir, uploadDir, file, "fastq")));
Element runAttributesE = new Element("RUN_ATTRIBUTES");
if (manifest.getSubmissionTool() != null && !manifest.getSubmissionTool().isEmpty()) {
Element submissionToolRunAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL");
Element submissionToolRunAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionTool());
Element submissionToolRunAttributeE = new Element("RUN_ATTRIBUTE");
submissionToolRunAttributeE.addContent(submissionToolRunAttributeTagE);
submissionToolRunAttributeE.addContent(submissionToolRunAttributeValueE);
runAttributesE.addContent(submissionToolRunAttributeE);
}
if (manifest.getSubmissionToolVersion() != null && !manifest.getSubmissionToolVersion().isEmpty()) {
Element submissionToolVersionRunAttributeTagE = new Element("TAG").setText("SUBMISSION_TOOL_VERSION");
Element submissionToolVersionRunAttributeValueE = new Element("VALUE").setText(manifest.getSubmissionToolVersion());
Element submissionToolVersionRunAttributeE = new Element("RUN_ATTRIBUTE");
submissionToolVersionRunAttributeE.addContent(submissionToolVersionRunAttributeTagE);
submissionToolVersionRunAttributeE.addContent(submissionToolVersionRunAttributeValueE);
runAttributesE.addContent(submissionToolVersionRunAttributeE);
}
if (runAttributesE.getContentSize() > 0) {
runE.addContent(runAttributesE);
}
XMLOutputter xmlOutput = new XMLOutputter();
xmlOutput.setFormat(Format.getPrettyFormat());
StringWriter stringWriter = new StringWriter();
......
......@@ -13,6 +13,7 @@ package uk.ac.ebi.ena.webin.cli.context.sequence;
import java.util.Map;
import uk.ac.ebi.ena.webin.cli.WebinCliMessage;
import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.*;
import uk.ac.ebi.ena.webin.cli.manifest.processor.*;
import uk.ac.ebi.ena.webin.cli.validator.file.SubmissionFile;
......@@ -67,7 +68,9 @@ SequenceManifestReader extends ManifestReader<SequenceManifest>
.file().optional().name( Field.TAB ).desc( Description.TAB ).processor( getTabProcessors() ).and()
.file().optional().name( Field.FLATFILE ).desc( Description.FLATFILE ).processor( getFlatfileProcessors() ).and()
.meta().optional().name( Field.AUTHORS ).desc( Description.AUTHORS ).processor(new AuthorProcessor()).and()
.meta().optional().name( Field.ADDRESS ).desc( Description.ADDRESS )
.meta().optional().name( Field.ADDRESS ).desc( Description.ADDRESS ).and()
.meta().optional().name(Fields.SUBMISSION_TOOL).desc(Descriptions.SUBMISSION_TOOL).and()
.meta().optional().name(Fields.SUBMISSION_TOOL_VERSION).desc(Descriptions.SUBMISSION_TOOL_VERSION)
.build()
,
// File groups.
......@@ -119,6 +122,9 @@ SequenceManifestReader extends ManifestReader<SequenceManifest>
manifest.setName(getManifestReaderResult().getValue( Field.NAME ));
manifest.setDescription(getManifestReaderResult().getValue( Field.DESCRIPTION ));
manifest.setSubmissionTool(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL));
manifest.setSubmissionToolVersion(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL_VERSION));
SubmissionFiles<SequenceManifest.FileType> submissionFiles = manifest.files();
getFiles( getInputDir(), getManifestReaderResult(), Field.TAB ).forEach(fastaFile-> submissionFiles.add( new SubmissionFile( SequenceManifest.FileType.TAB,fastaFile ) ) );
......
......@@ -13,6 +13,7 @@ package uk.ac.ebi.ena.webin.cli.context.transcriptome;
import java.util.Map;
import uk.ac.ebi.ena.webin.cli.WebinCliMessage;
import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.*;
import uk.ac.ebi.ena.webin.cli.manifest.processor.*;
import uk.ac.ebi.ena.webin.cli.validator.file.SubmissionFile;
......@@ -90,7 +91,9 @@ TranscriptomeManifestReader extends ManifestReader<TranscriptomeManifest>
.meta().optional().name( Field.TPA ).desc( Description.TPA ).processor( CVFieldProcessor.CV_BOOLEAN ).and()
.meta().optional().name( Field.AUTHORS ).desc( Description.AUTHORS ).processor(new AuthorProcessor()).and()
.meta().optional().name( Field.ADDRESS ).desc( Description.ADDRESS ).and()
.meta().required().name( Field.ASSEMBLY_TYPE ).desc( Description.ASSEMBLY_TYPE ).processor( new CVFieldProcessor( CV_ASSEMBLY_TYPE ) )
.meta().required().name( Field.ASSEMBLY_TYPE ).desc( Description.ASSEMBLY_TYPE ).processor( new CVFieldProcessor( CV_ASSEMBLY_TYPE ) ).and()
.meta().optional().name(Fields.SUBMISSION_TOOL).desc(Descriptions.SUBMISSION_TOOL).and()
.meta().optional().name(Fields.SUBMISSION_TOOL_VERSION).desc(Descriptions.SUBMISSION_TOOL_VERSION)
.build()
,
// File groups.
......@@ -161,6 +164,9 @@ TranscriptomeManifestReader extends ManifestReader<TranscriptomeManifest>
manifest.setTpa( getAndValidateBoolean( getManifestReaderResult().getField(Field.TPA ) ) );
}
manifest.setSubmissionTool(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL));
manifest.setSubmissionToolVersion(getManifestReaderResult().getValue(Fields.SUBMISSION_TOOL_VERSION));
SubmissionFiles<TranscriptomeManifest.FileType> submissionFiles = manifest.files();
getFiles( getInputDir(), getManifestReaderResult(), Field.FASTA ).forEach(file-> submissionFiles.add( new SubmissionFile( TranscriptomeManifest.FileType.FASTA, file ) ) );
......
......@@ -41,10 +41,14 @@ ManifestReader<M extends Manifest> {
public interface Fields {
String INFO = "INFO";
String SUBMISSION_TOOL = "SUBMISSION_TOOL";
String SUBMISSION_TOOL_VERSION = "SUBMISSION_TOOL_VERSION";
}
public interface Descriptions {
String INFO = "Info file";
String SUBMISSION_TOOL = "Name of third-party or developed tool used to submit to ENA";
String SUBMISSION_TOOL_VERSION = "Version number of the third-party or developed tool used to submit to ENA";
}
private final List<ManifestFieldDefinition> infoFields = new ManifestFieldDefinition.Builder()
......
......@@ -162,6 +162,12 @@ public class WebinCliTest {
"│ADDRESS │Optional │For submission brokers only. Submitter's │\n" +
"│ │ │address │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL │Optional │Name of third-party or developed tool used to│\n" +
"│ │ │submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL_VERS│Optional │Version number of the third-party or │\n" +
"│ION │ │developed tool used to submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FASTA │0-1 files │Fasta file │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FLATFILE │0-1 files │Flat file │\n" +
......@@ -250,6 +256,12 @@ public class WebinCliTest {
"│ADDRESS │Optional │For submission brokers only. Submitter's │\n" +
"│ │ │address │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL │Optional │Name of third-party or developed tool used to│\n" +
"│ │ │submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL_VERS│Optional │Version number of the third-party or │\n" +
"│ION │ │developed tool used to submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FASTA │0-1 files │Fasta file │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FLATFILE │0-1 files │Flat file │\n" +
......@@ -297,6 +309,12 @@ public class WebinCliTest {
"│ADDRESS │Optional │For submission brokers only. Submitter's │\n" +
"│ │ │address │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL │Optional │Name of third-party or developed tool used to│\n" +
"│ │ │submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL_VERS│Optional │Version number of the third-party or │\n" +
"│ION │ │developed tool used to submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│TAB │0-1 files │Tabulated file │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FLATFILE │0-1 files │Flat file │\n" +
......@@ -488,6 +506,12 @@ public class WebinCliTest {
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│INSERT_SIZE │Optional │Insert size for paired reads │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL │Optional │Name of third-party or developed tool used to│\n" +
"│ │ │submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│SUBMISSION_TOOL_VERS│Optional │Version number of the third-party or │\n" +
"│ION │ │developed tool used to submit to ENA │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│FASTQ │0-2 files │Fastq file │\n" +
"├────────────────────┼───────────┼─────────────────────────────────────────────┤\n" +
"│BAM │0-1 files │BAM file │\n" +
......
/*
* Copyright 2018-2019 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package uk.ac.ebi.ena.webin.cli.context.genome;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import uk.ac.ebi.ena.webin.cli.ManifestBuilder;
import uk.ac.ebi.ena.webin.cli.ReportTester;
import uk.ac.ebi.ena.webin.cli.TempFileBuilder;
import uk.ac.ebi.ena.webin.cli.WebinCliException;
import uk.ac.ebi.ena.webin.cli.WebinCliExecutor;
import uk.ac.ebi.ena.webin.cli.WebinCliExecutorBuilder;
import uk.ac.ebi.ena.webin.cli.WebinCliMessage;
import uk.ac.ebi.ena.webin.cli.WebinCliParameters;
import uk.ac.ebi.ena.webin.cli.WebinCliTestUtils;
import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.ManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.processor.MetadataProcessorFactory;
import uk.ac.ebi.ena.webin.cli.validator.manifest.GenomeManifest;
import uk.ac.ebi.ena.webin.cli.validator.manifest.ReadsManifest;
import uk.ac.ebi.ena.webin.cli.validator.response.ReadsValidationResponse;
import java.io.File;
import java.nio.file.Paths;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static uk.ac.ebi.ena.webin.cli.WebinCliTestUtils.getResourceDir;
import static uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader.Field;
public class
GenomeManifestReaderTest {
private static GenomeManifestReader createManifestReader() {
WebinCliParameters parameters = WebinCliTestUtils.getTestWebinCliParameters();
return new GenomeManifestReader(ManifestReader.DEFAULT_PARAMETERS, new MetadataProcessorFactory(parameters));
}
@Before
public void
before() {
Locale.setDefault(Locale.UK);
}
@Test
public void
testValidManifest() {
GenomeManifestReader manifestReader = createManifestReader();
GenomeManifest manifest = manifestReader.getManifest();
Assert.assertNull(manifest.getStudy());
Assert.assertNull(manifest.getSample());
Assert.assertNull(manifest.getPlatform());
Assert.assertNull(manifest.getName());
assertThat(manifest.files().files()).size().isZero();
Assert.assertNull(manifest.getDescription());
Assert.assertNull(manifest.getSubmissionTool());
Assert.assertNull(manifest.getSubmissionToolVersion());
manifestReader.readManifest(Paths.get("."),
new ManifestBuilder()
.field(Field.PLATFORM, " illumina")
.field(Field.NAME, " SOME-FANCY-NAME")
.field(Field.DESCRIPTION, " description")
.file("FASTA", TempFileBuilder.empty("fasta"))
.field(ManifestReader.Fields.SUBMISSION_TOOL, "ST-001")
.field(ManifestReader.Fields.SUBMISSION_TOOL_VERSION, "STV-001")
.build());
Assert.assertEquals("illumina", manifest.getPlatform());
Assert.assertEquals("SOME-FANCY-NAME", manifest.getName());
assertThat(manifest.files().files()).size().isOne();
Assert.assertEquals("description", manifest.getDescription());
Assert.assertEquals("ST-001", manifest.getSubmissionTool());
Assert.assertEquals("STV-001", manifest.getSubmissionToolVersion());
}
}
......@@ -66,6 +66,9 @@ public class GenomeXmlTest {
@Test
public void testRunAndAnalysisRef() {
GenomeManifest manifest = getDefaultManifest();
manifest.setSubmissionTool("ST-001");
manifest.setSubmissionToolVersion("STV-001");
manifest.addAnalysis(
new Analysis("ANALYSIS_ID1", "ANALYSIS_ID1_ALIAS"),
new Analysis("ANALYSIS_ID2", "ANALYSIS_ID2_ALIAS"));
......@@ -96,6 +99,16 @@ public class GenomeXmlTest {
+ " </SEQUENCE_ASSEMBLY>\n"
+ " </ANALYSIS_TYPE>\n"
+ " <FILES />\n"
+ " <ANALYSIS_ATTRIBUTES>\n"
+ " <ANALYSIS_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL</TAG>\n"
+ " <VALUE>ST-001</VALUE>\n"
+ " </ANALYSIS_ATTRIBUTE>\n"
+ " <ANALYSIS_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL_VERSION</TAG>\n"
+ " <VALUE>STV-001</VALUE>\n"
+ " </ANALYSIS_ATTRIBUTE>\n"
+ " </ANALYSIS_ATTRIBUTES>\n"
+ " </ANALYSIS>\n"
+ "</ANALYSIS_SET>\n");
}
......
......@@ -100,6 +100,8 @@ ReadsManifestReaderTest {
Assert.assertNull(manifest.getName());
assertThat(manifest.files().files()).size().isZero();
Assert.assertNull(manifest.getDescription());
Assert.assertNull(manifest.getSubmissionTool());
Assert.assertNull(manifest.getSubmissionToolVersion());
manifestReader.readManifest(Paths.get("."),
new ManifestBuilder()
......@@ -114,6 +116,8 @@ ReadsManifestReaderTest {
.field(Field.NAME, " SOME-FANCY-NAME")
.field(Field.DESCRIPTION, " description")
.file("BAM", TempFileBuilder.empty("bam"))
.field(ManifestReader.Fields.SUBMISSION_TOOL, "ST-001")
.field(ManifestReader.Fields.SUBMISSION_TOOL_VERSION, "STV-001")
.build());
Assert.assertEquals("ILLUMINA", manifest.getPlatform());
......@@ -127,6 +131,8 @@ ReadsManifestReaderTest {
Assert.assertEquals("SOME-FANCY-NAME", manifest.getName());
assertThat(manifest.files().files()).size().isOne();
Assert.assertEquals("description", manifest.getDescription());
Assert.assertEquals("ST-001", manifest.getSubmissionTool());
Assert.assertEquals("STV-001", manifest.getSubmissionToolVersion());
}
@Test
......
......@@ -72,6 +72,8 @@ public class ReadsXmlTest {
manifest.setLibraryStrategy("CLONEEND");
manifest.setLibrarySource("OTHER");
manifest.setLibrarySelection("Inverse rRNA selection");
manifest.setSubmissionTool("ST-001");
manifest.setSubmissionToolVersion("STV-001");
SubmissionBundle sb = prepareSubmissionBundle(manifest);
......@@ -102,10 +104,55 @@ public class ReadsXmlTest {
+ " <INSTRUMENT_MODEL>unspecified</INSTRUMENT_MODEL>\n"
+ " </ILLUMINA>\n"
+ " </PLATFORM>\n"
+ " <EXPERIMENT_ATTRIBUTES>\n"
+ " <EXPERIMENT_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL</TAG>\n"
+ " <VALUE>ST-001</VALUE>\n"
+ " </EXPERIMENT_ATTRIBUTE>\n"
+ " <EXPERIMENT_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL_VERSION</TAG>\n"
+ " <VALUE>STV-001</VALUE>\n"
+ " </EXPERIMENT_ATTRIBUTE>\n"
+ " </EXPERIMENT_ATTRIBUTES>\n"
+ " </EXPERIMENT>\n"
+ "</EXPERIMENT_SET>");
}
@Test
public void testRun() {
ReadsManifest manifest = getDefaultManifest();
manifest.setPlatform("ILLUMINA");
manifest.setInstrument("unspecified");
manifest.setSubmissionTool("ST-001");
manifest.setSubmissionToolVersion("STV-001");
SubmissionBundle sb = prepareSubmissionBundle(manifest);
String runXml = sb.getXMLFile(SubmissionBundle.SubmissionXMLFileType.RUN).getXml();
XmlTester.assertXml(
runXml,
"<RUN_SET>\n"
+ " <RUN>\n"
+ " <TITLE>Raw reads: test_reads</TITLE>\n"
+ " <EXPERIMENT_REF refname=\"webin-reads-test_reads\"/>\n"
+ " <DATA_BLOCK>\n"
+ " <FILES/>\n"
+ " </DATA_BLOCK>\n"
+ " <RUN_ATTRIBUTES>\n"
+ " <RUN_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL</TAG>\n"
+ " <VALUE>ST-001</VALUE>\n"
+ " </RUN_ATTRIBUTE>\n"
+ " <RUN_ATTRIBUTE>\n"
+ " <TAG>SUBMISSION_TOOL_VERSION</TAG>\n"
+ " <VALUE>STV-001</VALUE>\n"
+ " </RUN_ATTRIBUTE>\n"
+ " </RUN_ATTRIBUTES>\n"
+ " </RUN>\n"
+ "</RUN_SET>");
}
@Test
public void testRunWithCramFile() {
ReadsManifest manifest = getDefaultManifest();
......
/*
* Copyright 2018-2019 EMBL - European Bioinformatics Institute
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package uk.ac.ebi.ena.webin.cli.context.sequence;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import uk.ac.ebi.ena.webin.cli.ManifestBuilder;
import uk.ac.ebi.ena.webin.cli.ReportTester;
import uk.ac.ebi.ena.webin.cli.TempFileBuilder;
import uk.ac.ebi.ena.webin.cli.WebinCliException;
import uk.ac.ebi.ena.webin.cli.WebinCliExecutor;
import uk.ac.ebi.ena.webin.cli.WebinCliExecutorBuilder;
import uk.ac.ebi.ena.webin.cli.WebinCliMessage;
import uk.ac.ebi.ena.webin.cli.WebinCliParameters;
import uk.ac.ebi.ena.webin.cli.WebinCliTestUtils;
import uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.ManifestReader;
import uk.ac.ebi.ena.webin.cli.manifest.processor.MetadataProcessorFactory;
import uk.ac.ebi.ena.webin.cli.validator.manifest.ReadsManifest;
import uk.ac.ebi.ena.webin.cli.validator.manifest.SequenceManifest;
import uk.ac.ebi.ena.webin.cli.validator.response.ReadsValidationResponse;
import java.io.File;
import java.nio.file.Paths;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static uk.ac.ebi.ena.webin.cli.WebinCliTestUtils.getResourceDir;
import static uk.ac.ebi.ena.webin.cli.context.reads.ReadsManifestReader.Field;
public class
SequenceManifestReaderTest {
private static SequenceManifestReader createManifestReader() {
WebinCliParameters parameters = WebinCliTestUtils.getTestWebinCliParameters();
return new SequenceManifestReader(ManifestReader.DEFAULT_PARAMETERS, new MetadataProcessorFactory(parameters));
}
@Before
public void
before() {
Locale.setDefault(Locale.UK);
}
@Test
public void
testValidManifest() {
SequenceManifestReader manifestReader = createManifestReader();
SequenceManifest manifest = manifestReader.getManifest();
Assert.assertNull(manifest.getStudy());
Assert.assertNull(manifest.getSample());
Assert.assertNull(manifest.getName());
assertThat(manifest.files().files()).size().isZero();
Assert.assertNull(manifest.getDescription());
Assert.assertNull(manifest.getSubmissionTool());
Assert.assertNull(manifest.getSubmissionToolVersion());
manifestReader.readManifest(Paths.get("."),
new ManifestBuilder()
.field(Field.NAME, " SOME-FANCY-NAME")
.field(Field.DESCRIPTION, " description")
.file("FLATFILE", TempFileBuilder.empty("csv"))
.field(ManifestReader.Fields.SUBMISSION_TOOL, "ST-001")
.field(ManifestReader.Fields.SUBMISSION_TOOL_VERSION, "STV-001")
.build());