Skip to content

Commit

Permalink
Merge branch 'uniparc_light_vd_v2' into TRM-30823-REDUNDANT-FASTA_TST
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardoGonzales committed Sep 24, 2024
2 parents 149a8cf + 5e991c9 commit 01539d9
Show file tree
Hide file tree
Showing 40 changed files with 379 additions and 124 deletions.
2 changes: 1 addition & 1 deletion controlled-vocabulary/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.uniprot</groupId>
<artifactId>core-parent</artifactId>
<version>1.0.33-SNAPSHOT</version>
<version>1.0.35-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.uniprot</groupId>
<artifactId>core-parent</artifactId>
<version>1.0.33-SNAPSHOT</version>
<version>1.0.35-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core-domain-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>core-parent</artifactId>
<groupId>org.uniprot</groupId>
<version>1.0.33-SNAPSHOT</version>
<version>1.0.35-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.uniprot</groupId>
<artifactId>core-parent</artifactId>
<version>1.0.33-SNAPSHOT</version>
<version>1.0.35-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.io.Serializable;
import java.util.List;

import org.uniprot.core.Location;

/**
* @author jluo
* @date: 22 May 2019
Expand All @@ -16,5 +14,5 @@ public interface SequenceFeature extends Serializable {

String getSignatureDbId();

List<Location> getLocations();
List<SequenceFeatureLocation> getLocations();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.uniprot.core.uniparc;

import java.io.Serializable;

public interface SequenceFeatureLocation extends Serializable {
int getStart();

int getEnd();

String getAlignment();
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.uniprot.core.uniparc;

import javax.annotation.Nonnull;

import org.uniprot.core.util.EnumDisplay;

import javax.annotation.Nonnull;

public enum SignatureDbType implements EnumDisplay {
CDD("CDD"),
GENE3D("Gene3D"),
Expand All @@ -16,7 +16,8 @@ public enum SignatureDbType implements EnumDisplay {
SFLD("SFLD"),
SMART("SMART"),
SUPFAM("SUPFAM"),
NCBIFAM("NCBIfam");
NCBIFAM("NCBIfam"),
FUNFAM("FUNFAM");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface UniParcEntryLight extends Serializable {
Expand All @@ -25,6 +26,8 @@ public interface UniParcEntryLight extends Serializable {

LocalDate getMostRecentCrossRefUpdated();

Map<String, Object> getExtraAttributes();

// lazily loaded fields
Set<Organism> getOrganisms();// organism id and name pair

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import javax.annotation.Nonnull;

import org.uniprot.core.Builder;
import org.uniprot.core.Location;
import org.uniprot.core.uniparc.InterProGroup;
import org.uniprot.core.uniparc.SequenceFeature;
import org.uniprot.core.uniparc.SequenceFeatureLocation;
import org.uniprot.core.uniparc.SignatureDbType;
import org.uniprot.core.util.Utils;

Expand All @@ -20,7 +20,7 @@ public class SequenceFeatureBuilder implements Builder<SequenceFeature> {
private InterProGroup interproGroup;
private SignatureDbType dbType;
private String dbId;
private List<Location> locations = new ArrayList<>();
private List<SequenceFeatureLocation> locations = new ArrayList<>();

@Override
public @Nonnull SequenceFeature build() {
Expand All @@ -42,12 +42,12 @@ public class SequenceFeatureBuilder implements Builder<SequenceFeature> {
return this;
}

public @Nonnull SequenceFeatureBuilder locationsSet(List<Location> locations) {
public @Nonnull SequenceFeatureBuilder locationsSet(List<SequenceFeatureLocation> locations) {
this.locations = Utils.modifiableList(locations);
return this;
}

public @Nonnull SequenceFeatureBuilder locationsAdd(Location location) {
public @Nonnull SequenceFeatureBuilder locationsAdd(SequenceFeatureLocation location) {
Utils.addOrIgnoreNull(location, locations);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.util.List;
import java.util.Objects;

import org.uniprot.core.Location;
import org.uniprot.core.uniparc.InterProGroup;
import org.uniprot.core.uniparc.SequenceFeature;
import org.uniprot.core.uniparc.SequenceFeatureLocation;
import org.uniprot.core.uniparc.SignatureDbType;
import org.uniprot.core.util.Utils;

Expand All @@ -17,19 +17,19 @@
public class SequenceFeatureImpl implements SequenceFeature {

/** */
private static final long serialVersionUID = -8511912268843073779L;
private static final long serialVersionUID = 5234475851615797849L;

private InterProGroup interproGroup;
private SignatureDbType database;
private String databaseId;
private List<Location> locations;
private List<SequenceFeatureLocation> locations;

SequenceFeatureImpl() {
this.locations = Collections.emptyList();
}

SequenceFeatureImpl(
InterProGroup domain, SignatureDbType dbType, String dbId, List<Location> locations) {
InterProGroup domain, SignatureDbType dbType, String dbId, List<SequenceFeatureLocation> locations) {
super();
this.interproGroup = domain;
this.database = dbType;
Expand All @@ -53,7 +53,7 @@ public String getSignatureDbId() {
}

@Override
public List<Location> getLocations() {
public List<SequenceFeatureLocation> getLocations() {
return locations;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.uniprot.core.uniparc.impl;

import org.uniprot.core.Builder;
import org.uniprot.core.uniparc.SequenceFeatureLocation;

import javax.annotation.Nonnull;

public class SequenceFeatureLocationBuilder implements Builder<SequenceFeatureLocation> {

private int start;
private int end;
private String alignment;

@Nonnull
@Override
public SequenceFeatureLocation build() {
return new SequenceFeatureLocationImpl(start,end,alignment);
}

public @Nonnull SequenceFeatureLocationBuilder range(int start, int end) {
this.start = start;
this.end = end;
return this;
}

public @Nonnull SequenceFeatureLocationBuilder start(int start) {
this.start = start;
return this;
}

public @Nonnull SequenceFeatureLocationBuilder end(int end) {
this.end = end;
return this;
}

public @Nonnull SequenceFeatureLocationBuilder alignment(String alignment) {
this.alignment = alignment;
return this;
}

public static @Nonnull SequenceFeatureLocationBuilder from(@Nonnull SequenceFeatureLocation instance) {
return new SequenceFeatureLocationBuilder()
.start(instance.getStart())
.end(instance.getEnd())
.alignment(instance.getAlignment());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.uniprot.core.uniparc.impl;

import org.uniprot.core.Location;
import org.uniprot.core.uniparc.SequenceFeatureLocation;

import java.util.Objects;

public class SequenceFeatureLocationImpl extends Location implements SequenceFeatureLocation{

private static final long serialVersionUID = -4804406936471873484L;
private String alignment;

SequenceFeatureLocationImpl(){
super(0, 0);
}

SequenceFeatureLocationImpl(int start, int end, String alignment) {
super(start, end);
this.alignment = alignment;
}

@Override
public String getAlignment() {
return alignment;
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
SequenceFeatureLocationImpl that = (SequenceFeatureLocationImpl) o;
return Objects.equals(alignment, that.alignment);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), alignment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

import javax.annotation.Nonnull;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.*;

import static org.uniprot.core.util.Utils.putOrIgnoreNull;

public class UniParcEntryLightBuilder implements Builder<UniParcEntryLight> {
public static final String HAS_ACTIVE_CROSS_REF = "hasActiveCrossRef";
private String uniParcId;
private int crossReferenceCount;
private List<CommonOrganism> commonTaxons = new ArrayList<>();
Expand All @@ -37,12 +38,15 @@ public class UniParcEntryLightBuilder implements Builder<UniParcEntryLight> {

private Set<Proteome> proteomes = new LinkedHashSet<>();

private Map<String, Object> extraAttributes = new LinkedHashMap<>();

@Nonnull
@Override
public UniParcEntryLight build() {
return new UniParcEntryLightImpl(uniParcId, crossReferenceCount, commonTaxons, uniProtKBAccessions,
sequence, sequenceFeatures, oldestCrossRefCreated,
mostRecentCrossRefUpdated, (LinkedHashSet<Organism>) organisms, (LinkedHashSet<String>) proteinNames, (LinkedHashSet<String>) geneNames, (LinkedHashSet<Proteome>) proteomes);
mostRecentCrossRefUpdated, (LinkedHashSet<Organism>) organisms, (LinkedHashSet<String>) proteinNames,
(LinkedHashSet<String>) geneNames, (LinkedHashSet<Proteome>) proteomes, extraAttributes);
}

public @Nonnull UniParcEntryLightBuilder uniParcId(String uniParcId) {
Expand Down Expand Up @@ -140,16 +144,22 @@ public UniParcEntryLight build() {
return this;
}

public @Nonnull UniParcEntryLightBuilder extraAttributesAdd(String name, Object value) {
putOrIgnoreNull(name, value, this.extraAttributes);
return this;
}

public static @Nonnull UniParcEntryLightBuilder from(UniParcEntryLight uniParcEntryLight){
LinkedHashSet<String> uniprotKbAccessions = new LinkedHashSet<>(uniParcEntryLight.getUniProtKBAccessions());
LinkedHashSet<String> uniProtKBAccessions = new LinkedHashSet<>(uniParcEntryLight.getUniProtKBAccessions());
LinkedHashSet<Organism> organisms = new LinkedHashSet<>(uniParcEntryLight.getOrganisms());
LinkedHashSet<String> proteinNames = new LinkedHashSet<>(uniParcEntryLight.getProteinNames());
LinkedHashSet<String> geneNames = new LinkedHashSet<>(uniParcEntryLight.getGeneNames());
LinkedHashSet<Proteome> proteomes = new LinkedHashSet<>(uniParcEntryLight.getProteomes());
return new UniParcEntryLightBuilder().uniParcId(uniParcEntryLight.getUniParcId())
UniParcEntryLightBuilder builder = new UniParcEntryLightBuilder();
builder.uniParcId(uniParcEntryLight.getUniParcId())
.crossReferenceCount(uniParcEntryLight.getCrossReferenceCount())
.commonTaxonsSet(uniParcEntryLight.getCommonTaxons())
.uniProtKBAccessionsSet(uniprotKbAccessions)
.uniProtKBAccessionsSet(uniProtKBAccessions)
.sequence(uniParcEntryLight.getSequence())
.sequenceFeaturesSet(uniParcEntryLight.getSequenceFeatures())
.oldestCrossRefCreated(uniParcEntryLight.getOldestCrossRefCreated())
Expand All @@ -158,5 +168,7 @@ public UniParcEntryLight build() {
.proteinNamesSet(proteinNames)
.geneNamesSet(geneNames)
.proteomesSet(proteomes);
builder.extraAttributes = new LinkedHashMap<>(uniParcEntryLight.getExtraAttributes());
return builder;
}
}
Loading

0 comments on commit 01539d9

Please sign in to comment.