-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-3.2.x' into TASK-5278
- Loading branch information
Showing
5 changed files
with
310 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +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: | ||
build: | ||
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop | ||
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: "Test analysis" | ||
uses: ./.github/workflows/test-analysis.yml | ||
needs: build | ||
secrets: inherit | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
147 changes: 147 additions & 0 deletions
147
biodata-models/src/main/java/org/opencb/biodata/models/core/Snp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* <!-- | ||
* ~ Copyright 2015-2017 OpenCB | ||
* ~ | ||
* ~ 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 org.opencb.biodata.models.core; | ||
|
||
import java.util.List; | ||
|
||
public class Snp { | ||
private String id; | ||
private String chromosome; | ||
private int position; | ||
private String reference; | ||
private List<String> alternates; | ||
private String type; | ||
private String source; | ||
private String version; | ||
private SnpAnnotation annotation; | ||
|
||
public Snp() { | ||
} | ||
|
||
public Snp(String id, String chromosome, int position, String reference, List<String> alternates, String type, | ||
String source, String version, SnpAnnotation annotation) { | ||
this.id = id; | ||
this.chromosome = chromosome; | ||
this.position = position; | ||
this.reference = reference; | ||
this.alternates = alternates; | ||
this.type = type; | ||
this.source = source; | ||
this.version = version; | ||
this.annotation = annotation; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("Snp{"); | ||
sb.append("id='").append(id).append('\''); | ||
sb.append(", chromosome='").append(chromosome).append('\''); | ||
sb.append(", position=").append(position); | ||
sb.append(", reference='").append(reference).append('\''); | ||
sb.append(", alternates=").append(alternates); | ||
sb.append(", type='").append(type).append('\''); | ||
sb.append(", source='").append(source).append('\''); | ||
sb.append(", version='").append(version).append('\''); | ||
sb.append(", annotation=").append(annotation); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public Snp setId(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public String getChromosome() { | ||
return chromosome; | ||
} | ||
|
||
public Snp setChromosome(String chromosome) { | ||
this.chromosome = chromosome; | ||
return this; | ||
} | ||
|
||
public int getPosition() { | ||
return position; | ||
} | ||
|
||
public Snp setPosition(int position) { | ||
this.position = position; | ||
return this; | ||
} | ||
|
||
public String getReference() { | ||
return reference; | ||
} | ||
|
||
public Snp setReference(String reference) { | ||
this.reference = reference; | ||
return this; | ||
} | ||
|
||
public List<String> getAlternates() { | ||
return alternates; | ||
} | ||
|
||
public Snp setAlternates(List<String> alternates) { | ||
this.alternates = alternates; | ||
return this; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public Snp setType(String type) { | ||
this.type = type; | ||
return this; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public Snp setSource(String source) { | ||
this.source = source; | ||
return this; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public Snp setVersion(String version) { | ||
this.version = version; | ||
return this; | ||
} | ||
|
||
public SnpAnnotation getAnnotation() { | ||
return annotation; | ||
} | ||
|
||
public Snp setAnnotation(SnpAnnotation annotation) { | ||
this.annotation = annotation; | ||
return this; | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
biodata-models/src/main/java/org/opencb/biodata/models/core/SnpAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* <!-- | ||
* ~ Copyright 2015-2017 OpenCB | ||
* ~ | ||
* ~ 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 org.opencb.biodata.models.core; | ||
|
||
import org.opencb.biodata.models.variant.avro.PopulationFrequency; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class SnpAnnotation { | ||
|
||
private List<String> flags; | ||
private String gene; | ||
private List<PopulationFrequency> populationFrequencies; | ||
private Map<String, Object> additionalAttributes; | ||
|
||
public SnpAnnotation() { | ||
} | ||
|
||
public SnpAnnotation(List<String> flags, String gene, List<PopulationFrequency> populationFrequencies, Map<String, Object> additionalAttributes) { | ||
this.flags = flags; | ||
this.gene = gene; | ||
this.populationFrequencies = populationFrequencies; | ||
this.additionalAttributes = additionalAttributes; | ||
} | ||
|
||
public List<String> getFlags() { | ||
return flags; | ||
} | ||
|
||
public SnpAnnotation setFlags(List<String> flags) { | ||
this.flags = flags; | ||
return this; | ||
} | ||
|
||
public String getGene() { | ||
return gene; | ||
} | ||
|
||
public SnpAnnotation setGene(String gene) { | ||
this.gene = gene; | ||
return this; | ||
} | ||
|
||
public List<PopulationFrequency> getPopulationFrequencies() { | ||
return populationFrequencies; | ||
} | ||
|
||
public SnpAnnotation setPopulationFrequencies(List<PopulationFrequency> populationFrequencies) { | ||
this.populationFrequencies = populationFrequencies; | ||
return this; | ||
} | ||
|
||
public Map<String, Object> getAdditionalAttributes() { | ||
return additionalAttributes; | ||
} | ||
|
||
public SnpAnnotation setAdditionalAttributes(Map<String, Object> additionalAttributes) { | ||
this.additionalAttributes = additionalAttributes; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters