-
Notifications
You must be signed in to change notification settings - Fork 8
feat(genome): add GFF3 annotation support for genome submissions (TTENA-207) #162
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
base: master
Are you sure you want to change the base?
Changes from all commits
880b015
08c8035
71e2068
76ff3c0
0dcf804
110c565
09cb52b
76cbf71
bbd44d7
430e59d
a0455e6
7b7c290
3fa99fb
a480498
ebb93d9
86c1818
6785bd9
ad69c16
cb5532d
33ff05e
1f538cf
e36e27a
95c1341
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for this validator just like Gff3Validator above: Following existing practice, this should be placed in gff3tools unless there is a good reason or everybody agrees that there is no harm in keeping them here in webin-cli.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed that we could move Gff3Validator to gff3tools, but I think SequenceSubmissionValidator should be in webin-cli because it is a generic logic to perform both submissionValidator.validate() and gff3Validation.validate()
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The engine-orchestration core (build ValidationEngine + CompositeSequenceProvider, read GFF3, collect errors/warnings) has no ENA-specific data or credentials in it, so it's a fair candidate to eventually live in gff3tools as a public convenience API, mirroring what sequencetools/readtools/txmbtools already do with SubmissionValidator/ReadsValidator/TxmbValidator. That said, I'd treat it as a follow-up rather than part of this PR, it means a gff3tools release plus a dependency bump here, and the report-writing/SubmissionFile adaptation needs to stay in webin-cli regardless (gff3tools shouldn't depend on webin-cli-validator types). I'm opening gff3tools PR to extract that piece. For SequenceSubmissionValidator, it should stay in webin-cli. Its whole job is composing SubmissionValidator (sequencetools) + Gff3Validator for a webin-cli submission context; there's no ENA-internal logic in it that would justify moving it, and gff3tools shouldn't need to know about webin-cli's Manifest/Validator interfaces. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* | ||
| * Copyright 2018-2023 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; | ||
|
|
||
| import java.util.List; | ||
| import uk.ac.ebi.embl.api.validation.submission.SubmissionValidator; | ||
| import uk.ac.ebi.ena.webin.cli.context.genome.Gff3Validator; | ||
| import uk.ac.ebi.ena.webin.cli.validator.api.ValidationResponse; | ||
| import uk.ac.ebi.ena.webin.cli.validator.api.Validator; | ||
| import uk.ac.ebi.ena.webin.cli.validator.file.SubmissionFile; | ||
| import uk.ac.ebi.ena.webin.cli.validator.manifest.Manifest; | ||
|
|
||
| /** | ||
| * Composite validator for genome, transcriptome, and sequence submissions. Runs the sequencetools | ||
| * {@link SubmissionValidator} first, then performs client-side GFF3 validation when the manifest | ||
| * declares a GFF3 file. | ||
| * | ||
| * <p>Instantiated reflectively by {@link uk.ac.ebi.ena.webin.cli.WebinCliContext}, so a public | ||
| * no-arg constructor is required. | ||
| */ | ||
| public class SequenceSubmissionValidator implements Validator<Manifest<?>, ValidationResponse> { | ||
|
|
||
| private static final String GFF3_TYPE = "GFF3"; | ||
| private static final String FASTA_TYPE = "FASTA"; | ||
| private static final String FLATFILE_TYPE = "FLATFILE"; | ||
|
|
||
| private final SubmissionValidator submissionValidator; | ||
| private final Gff3Validator gff3Validator; | ||
|
|
||
| public SequenceSubmissionValidator() { | ||
| this(new SubmissionValidator(), new Gff3Validator()); | ||
| } | ||
|
|
||
| SequenceSubmissionValidator( | ||
| SubmissionValidator submissionValidator, Gff3Validator gff3Validator) { | ||
| this.submissionValidator = submissionValidator; | ||
| this.gff3Validator = gff3Validator; | ||
| } | ||
|
|
||
| @Override | ||
| public ValidationResponse validate(Manifest<?> manifest) { | ||
| List<? extends SubmissionFile<?>> gff3Files = manifest.filesWithTypeName(GFF3_TYPE); | ||
| List<? extends SubmissionFile<?>> fastaFiles = manifest.filesWithTypeName(FASTA_TYPE); | ||
| boolean gff3Only = | ||
| !gff3Files.isEmpty() | ||
| && fastaFiles.isEmpty() | ||
| && manifest.filesWithTypeName(FLATFILE_TYPE).isEmpty(); | ||
|
|
||
| ValidationResponse response; | ||
| if (gff3Only) { | ||
| // sequencetools' SubmissionValidator requires at least one FASTA/FLATFILE sequence | ||
| // to compute contig/scaffold/chromosome counts, which a GFF3-only submission never | ||
| // has. Skip it entirely and rely on Gff3Validator below instead. | ||
| response = new ValidationResponse(ValidationResponse.status.VALIDATION_SUCCESS); | ||
| } else { | ||
| response = submissionValidator.validate(manifest); | ||
| if (response == null) { | ||
| response = new ValidationResponse(); | ||
| } | ||
| } | ||
|
|
||
| if (!gff3Files.isEmpty() && !gff3Validator.validate(gff3Files, fastaFiles)) { | ||
| response.setStatus(ValidationResponse.status.VALIDATION_ERROR); | ||
| } | ||
|
|
||
| return response; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not need a version number update for this change?