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

Ena 5863 updating validation scope #148

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
archivesBaseName = 'sequencetools'
group = 'uk.ac.ebi.ena.sequence'

version = '2.18.11'
version = '2.19.1'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
68 changes: 44 additions & 24 deletions src/main/java/uk/ac/ebi/embl/api/validation/ValidationScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,45 @@
*/
package uk.ac.ebi.embl.api.validation;

import java.util.Arrays;
import java.util.List;

public enum ValidationScope {
/** Putff (ENA) */
EMBL(Group.SEQUENCE),
EMBL(Group.PUTFF),
/** Putff (NCBI) */
NCBI(Group.SEQUENCE),
NCBI(Group.PUTFF, Group.NCBI),
/** Putff (NCBI master) */
NCBI_MASTER(Group.SEQUENCE),
NCBI_MASTER(Group.PUTFF, Group.NCBI),
/** Pipeline (Webin-CLI sequence scope) */
EMBL_TEMPLATE(Group.SEQUENCE),
EMBL_TEMPLATE(Group.PIPELINE),
/** Putff (patent protein) */
EPO_PEPTIDE(Group.SEQUENCE),
EPO_PEPTIDE(Group.EPO),
/** Putff (patent) */
EPO(Group.SEQUENCE),
/** TODO: remove if not used */
INSDC(Group.SEQUENCE),
/** TODO: remove if not used */
EGA(Group.SEQUENCE),
/** TODO: remove if not used */
ARRAYEXPRESS(Group.SEQUENCE),
EPO(Group.EPO),
/** Pipeline (Webin-CLI genome scope) */
ASSEMBLY_MASTER(Group.ASSEMBLY),
ASSEMBLY_MASTER(Group.ASSEMBLY, Group.PIPELINE),
/** Pipeline (Webin-CLI genome scope) */
ASSEMBLY_CONTIG(Group.ASSEMBLY),
ASSEMBLY_CONTIG(Group.ASSEMBLY, Group.PIPELINE),
/** Pipeline (Webin-CLI genome scope) */
ASSEMBLY_SCAFFOLD(Group.ASSEMBLY),
ASSEMBLY_SCAFFOLD(Group.ASSEMBLY, Group.PIPELINE),
/** Pipeline (Webin-CLI genome scope) */
ASSEMBLY_CHROMOSOME(Group.ASSEMBLY),
ASSEMBLY_CHROMOSOME(Group.ASSEMBLY, Group.PIPELINE),
/** Pipeline (Webin-CLI transcriptome scope) */
ASSEMBLY_TRANSCRIPTOME(Group.ASSEMBLY);
ASSEMBLY_TRANSCRIPTOME(Group.PIPELINE);
Copy link
Member

@raskoleinonen raskoleinonen Oct 23, 2023

Choose a reason for hiding this comment

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

I think we should have only four groups (not sure what to call them):

  • Group.PIPELINE/WEBIN /** Webin submissions processed by pipelines. */
  • Group.EPO /** EPO submissions processed by putff. */
  • Group.NCBI /** NCBI submissions processed by putff. */
  • GROUP.PUTFF/ENA /** ENA submissions processed by putff. */

We might wish to rename:

  • EMBL_TEMPLATE -> TEMPLATE
  • ASSEMBLY_TRANSCRIPTOME -> TRANSCRIPTOME


private final Group group;
private final List<Group> groups;

ValidationScope(Group group) {
this.group = group;
ValidationScope(Group... groups) {
this.groups = Arrays.asList(groups);
}

public boolean isInGroup(Group group) {
return this.group == group;
return this.groups.contains(group);
}

public Group group() {
return this.group;
public List<Group> groups() {
return this.groups;
}

public static ValidationScope get(String scope) {
Expand All @@ -77,8 +74,11 @@ public int getAssemblyLevel() {
}

public enum Group {
PIPELINE,
Copy link
Member

Choose a reason for hiding this comment

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

Suggest to add a few comments ->

/** Webin submissions processed by pipelines. */
PIPELINE

/** Non-Webin submissions processed by putff. */
PUTFF

PUTFF,
ASSEMBLY,
SEQUENCE
NCBI,
EPO
}

public static ValidationScope getScope(FileType fileType) {
Expand All @@ -87,4 +87,24 @@ public static ValidationScope getScope(FileType fileType) {
}
return ValidationScope.EMBL;
}

public static boolean isPipelineGroup(ValidationScope scope){
return scope.isInGroup(Group.PIPELINE);
}

public static boolean isPutffGroup(ValidationScope scope){
return scope.isInGroup(Group.PUTFF);
}

public static boolean isAssemblyGroup(ValidationScope scope){
return scope.isInGroup(Group.ASSEMBLY);
}

public static boolean isNcbiGroup(ValidationScope scope){
return scope.isInGroup(Group.NCBI);
}

public static boolean isEpoGroup(ValidationScope scope){
return scope.isInGroup(Group.EPO);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

@ExcludeScope(
validationScope = {
ValidationScope.ARRAYEXPRESS,
ValidationScope.ASSEMBLY_CHROMOSOME,
ValidationScope.ASSEMBLY_CONTIG,
ValidationScope.ASSEMBLY_MASTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
ValidationScope.EMBL_TEMPLATE,
ValidationScope.EPO_PEPTIDE,
ValidationScope.NCBI,
ValidationScope.ARRAYEXPRESS,
ValidationScope.EGA,
ValidationScope.INSDC,
ValidationScope.NCBI_MASTER
})
public class ReferenceCheck extends EntryValidationCheck {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@
+ "Feature qualifier \\\"{0}\\\" value \\\"{1}\\\" does not comply to the qualifier specifications. Refer to the feature documentation or ask a curator for guidance.\"")
@ExcludeScope(
validationScope = {
ValidationScope.ARRAYEXPRESS,
ValidationScope.ASSEMBLY_CHROMOSOME,
ValidationScope.ASSEMBLY_CONTIG,
ValidationScope.ASSEMBLY_MASTER,
ValidationScope.ASSEMBLY_SCAFFOLD,
ValidationScope.ASSEMBLY_TRANSCRIPTOME,
ValidationScope.EGA,
ValidationScope.EMBL,
ValidationScope.EMBL,
ValidationScope.EMBL_TEMPLATE,
ValidationScope.EPO,
ValidationScope.EPO_PEPTIDE,
ValidationScope.INSDC,
ValidationScope.NCBI_MASTER
})
public class NCBIQualifierCheck extends FeatureValidationCheck {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@
@Description("Journal has been modified from:{0} to:{1}")
@ExcludeScope(
validationScope = {
ValidationScope.ARRAYEXPRESS,
ValidationScope.ASSEMBLY_CHROMOSOME,
ValidationScope.ASSEMBLY_CONTIG,
ValidationScope.ASSEMBLY_MASTER,
ValidationScope.ASSEMBLY_SCAFFOLD,
ValidationScope.ASSEMBLY_TRANSCRIPTOME,
ValidationScope.EGA,
ValidationScope.EMBL,
ValidationScope.EMBL,
ValidationScope.EMBL_TEMPLATE,
ValidationScope.EPO,
ValidationScope.EPO_PEPTIDE,
ValidationScope.INSDC,
ValidationScope.NCBI_MASTER
})
public class JournalFix extends EntryValidationCheck {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@
@Description("\"{0}\" qualifier value \"{1}\" is invalid, a note has been added.")
@ExcludeScope(
validationScope = {
ValidationScope.ARRAYEXPRESS,
ValidationScope.ASSEMBLY_CHROMOSOME,
ValidationScope.ASSEMBLY_CONTIG,
ValidationScope.ASSEMBLY_MASTER,
ValidationScope.NCBI_MASTER,
ValidationScope.ASSEMBLY_SCAFFOLD,
ValidationScope.ASSEMBLY_TRANSCRIPTOME,
ValidationScope.EGA,
ValidationScope.EMBL,
ValidationScope.EMBL,
ValidationScope.EMBL_TEMPLATE,
ValidationScope.EPO,
ValidationScope.EPO_PEPTIDE,
ValidationScope.INSDC
})
public class CountryQualifierFix extends FeatureValidationCheck {
private static final String COUNTRY_QUALIFIER_VALUE_FIX_ID_1 = "CountryQualifierFix_1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected boolean isInValidationScopeGroup(ValidationScope.Group[] validationSco
if (groupScope == null) {
continue;
}
if (groupScope.equals(validationScope.group())) return true;
if (validationScope.groups().contains(groupScope)) return true;
}
return false;
}
Expand Down
Loading