Skip to content

Commit

Permalink
Merge branch 'release-3.2.x' into TASK-6708
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Sep 3, 2024
2 parents ded97e0 + 867865d commit 55167e9
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 75 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pull request approve workflow
run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'

on:
pull_request_review:
types: [ submitted ]

jobs:
calculate-xetabase-branch:
name: Calculate Xetabase branch
runs-on: ubuntu-22.04
outputs:
xetabase_branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }}
steps:
- name: Clone java-common-libs
uses: actions/checkout@v4
with:
fetch-depth: '10'
- id: get_xetabase_branch
name: "Get current branch for Xetabase from target branch"
run: |
chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.base.ref }})
echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY}
echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT
test:
name: "Run all tests before merging"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399
with:
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
task: ${{ github.event.pull_request.head.ref }}
secrets: inherit
50 changes: 50 additions & 0 deletions .github/workflows/scripts/get-xetabase-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# Function to calculate the corresponding branch of Xetabase project
get_xetabase_branch() {
# Input parameter (branch name)
input_branch="$1"

# If the branch begins with 'TASK' and exists in the opencga-enterprise repository, I return it
if [[ $input_branch == TASK* ]]; then
if [ "$(git ls-remote https://github.com/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then
echo "$GIT_BRANCH";
exit 0;
fi
fi

# Check if the branch name is "develop" in that case return the same branch name
if [[ "$input_branch" == "develop" ]]; then
echo "develop"
return 0
fi

# Check if the branch name starts with "release-" and follows the patterns "release-a.b.x" or "release-a.b.c.x"
if [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.([0-9]+)\.x$ ]]; then
# Extract the MAJOR part of the branch name
MAJOR=${BASH_REMATCH[1]}
# Calculate the XETABASE_MAJOR by subtracting 3 from MAJOR
XETABASE_MAJOR=$((MAJOR - 1))
# Check if the XETABASE_MAJOR is negative
if (( XETABASE_MAJOR < 0 )); then
echo "Error: 'MAJOR' digit after subtraction results in a negative number."
return 1
fi
# Construct and echo the new branch name
echo "release-$XETABASE_MAJOR.${input_branch#release-$MAJOR.}"
return 0
fi

# If the branch name does not match any of the expected patterns
echo "Error: The branch name is not correct."
return 1
}

# Check if the script receives exactly one argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <branch-name>"
exit 1
fi

# Call the function with the input branch name
get_xetabase_branch "$1"
4 changes: 2 additions & 2 deletions biodata-formats/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<scope>test</scope>
</dependency>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.opencb.biodata.formats.variant.annotation.io;

import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.avro.VariantAvro;
Expand Down
4 changes: 2 additions & 2 deletions biodata-models/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.opencb.biodata.models.alignment;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import org.opencb.biodata.models.core.Region;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,7 @@ public ClinicalVariant(VariantAvro avro, List<ClinicalVariantEvidence> evidences

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ClinicalVariant{");
sb.append("evidences=").append(evidences);
sb.append(", comments=").append(comments);
sb.append(", filters=").append(filters);
sb.append(", recommendation='").append(recommendation).append('\'');
sb.append(", references=").append(references);
sb.append(", discussion=").append(discussion);
sb.append(", confidence=").append(confidence);
sb.append(", tags=").append(tags);
sb.append(", status=").append(status);
sb.append(", attributes=").append(attributes);
sb.append('}');
return sb.toString();
return super.toString();
}

public List<ClinicalVariantEvidence> getEvidences() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@

public class Interpretation {

private String id;
private String uuid;
private String description;
private String clinicalAnalysisId;
protected String id;
protected String uuid;
protected String name;
protected String description;
protected String clinicalAnalysisId;

/**
* Interpretation algorithm tool used to generate this interpretation.
*/
private ClinicalAnalyst analyst;
private InterpretationMethod method;
protected ClinicalAnalyst analyst;
protected InterpretationMethod method;

private List<ClinicalVariant> primaryFindings;
private List<ClinicalVariant> secondaryFindings;
protected List<ClinicalVariant> primaryFindings;
protected List<ClinicalVariant> secondaryFindings;

private List<ClinicalComment> comments;
protected List<ClinicalComment> comments;

private InterpretationStats stats;
protected InterpretationStats stats;

private boolean locked;
private Status status;
private String creationDate;
private String modificationDate;
private int version;
protected boolean locked;
protected String creationDate;
protected String modificationDate;
protected int version;

/**
* Users can add custom information in this field.
Expand All @@ -61,12 +61,23 @@ public class Interpretation {
public Interpretation() {
}

@Deprecated
public Interpretation(String id, String uuid, String description, String clinicalAnalysisId, ClinicalAnalyst analyst,
InterpretationMethod method, List<ClinicalVariant> primaryFindings, List<ClinicalVariant> secondaryFindings,
List<ClinicalComment> comments, InterpretationStats stats, Status status, String creationDate,
String modificationDate, boolean locked, int version, Map<String, Object> attributes) {
this(id, uuid, id, description, clinicalAnalysisId, analyst, method, primaryFindings, secondaryFindings,
comments, stats, locked, creationDate, modificationDate, version, attributes);
}

public Interpretation(String id, String uuid, String name, String description, String clinicalAnalysisId,
ClinicalAnalyst analyst, InterpretationMethod method, List<ClinicalVariant> primaryFindings,
List<ClinicalVariant> secondaryFindings, List<ClinicalComment> comments,
InterpretationStats stats, boolean locked, String creationDate, String modificationDate,
int version, Map<String, Object> attributes) {
this.id = id;
this.uuid = uuid;
this.name = name;
this.description = description;
this.clinicalAnalysisId = clinicalAnalysisId;
this.analyst = analyst;
Expand All @@ -75,10 +86,9 @@ public Interpretation(String id, String uuid, String description, String clinica
this.secondaryFindings = secondaryFindings;
this.comments = comments;
this.stats = stats;
this.status = status;
this.locked = locked;
this.creationDate = creationDate;
this.modificationDate = modificationDate;
this.locked = locked;
this.version = version;
this.attributes = attributes;
}
Expand All @@ -88,6 +98,7 @@ public String toString() {
final StringBuilder sb = new StringBuilder("Interpretation{");
sb.append("id='").append(id).append('\'');
sb.append(", uuid='").append(uuid).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", clinicalAnalysisId='").append(clinicalAnalysisId).append('\'');
sb.append(", analyst=").append(analyst);
Expand All @@ -96,7 +107,6 @@ public String toString() {
sb.append(", secondaryFindings=").append(secondaryFindings);
sb.append(", comments=").append(comments);
sb.append(", stats=").append(stats);
sb.append(", status=").append(status);
sb.append(", creationDate='").append(creationDate).append('\'');
sb.append(", modificationDate='").append(modificationDate).append('\'');
sb.append(", locked='").append(locked).append('\'');
Expand Down Expand Up @@ -124,6 +134,15 @@ public Interpretation setUuid(String uuid) {
return this;
}

public String getName() {
return name;
}

public Interpretation setName(String name) {
this.name = name;
return this;
}

public String getDescription() {
return description;
}
Expand Down Expand Up @@ -196,15 +215,6 @@ public Interpretation setStats(InterpretationStats stats) {
return this;
}

public Status getStatus() {
return status;
}

public Interpretation setStatus(Status status) {
this.status = status;
return this;
}

public String getCreationDate() {
return creationDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.opencb.biodata.models.clinical.pedigree;

import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.opencb.biodata.models.clinical.Disorder;
import org.opencb.biodata.models.clinical.Phenotype;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
public class Status {

protected String id;
protected String name;
protected String description;
protected String date;

public Status() {
this("", "", "", "");
this("", "", "");
}

public Status(String id, String description, String date) {
this.id = id;
this.description = description;
this.date = date;
}

@Deprecated
public Status(String id, String name, String description, String date) {
this.id = id;
this.name = name;
this.description = description;
this.date = date;
}
Expand All @@ -38,7 +43,6 @@ public Status(String id, String name, String description, String date) {
public String toString() {
final StringBuilder sb = new StringBuilder("Status{");
sb.append("id='").append(id).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append(", date='").append(date).append('\'');
sb.append('}');
Expand All @@ -53,15 +57,13 @@ public boolean equals(Object o) {
Status status = (Status) o;

if (!id.equals(status.id)) return false;
if (name != null ? !name.equals(status.name) : status.name != null) return false;
if (description != null ? !description.equals(status.description) : status.description != null) return false;
return date != null ? date.equals(status.date) : status.date == null;
}

@Override
public int hashCode() {
int result = id.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (date != null ? date.hashCode() : 0);
return result;
Expand All @@ -76,12 +78,13 @@ public Status setId(String id) {
return this;
}

@Deprecated
public String getName() {
return name;
return id;
}

@Deprecated
public Status setName(String name) {
this.name = name;
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions biodata-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
</dependency>-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

package org.opencb.biodata.tools.alignment.stats;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;

import java.io.IOException;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

package org.opencb.biodata.tools.alignment.stats;

import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;

import java.io.IOException;
import java.util.HashMap;
Expand Down
Loading

0 comments on commit 55167e9

Please sign in to comment.