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

TASK-7097 - Port Patch 3.3.0 -> 4.0.0 Xetabase 2.3.0 -> 3.0.0 #281

Merged
merged 25 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8998ff8
formats: add COSMIC parser based-on CellBase parser, #TASK-5913, #TAS…
jtarraga Mar 21, 2024
3d544a1
Merge branch 'develop' into TASK-5318
jtarraga Jun 4, 2024
af57a14
formats: add checks to the COSMIC parser: valid format file and assem…
jtarraga Jun 6, 2024
2c32667
formatS: Remove unused fields from VariantAnnotationUtils. #TASK-5913…
j-coll Jun 25, 2024
2e39636
models: set public constructors, #TASK-5913, #TASK-5318
jtarraga Jun 26, 2024
afd596f
Merge branch 'TASK-5318' of https://github.com/opencb/biodata into TA…
jtarraga Jun 26, 2024
41570a2
Merge branch 'release-3.2.x' into TASK-5318
jtarraga Jul 22, 2024
09fd3c3
Prepare next release 3.2.2-SNAPSHOT
juanfeSanahuja Sep 13, 2024
85ea39e
SDLC: Prepare release 2.3.0 de Xetabase #TASK-6879
juanfeSanahuja Sep 16, 2024
f04f854
SDLC: Prepare release 2.3.0 of Xetabase #TASK-6879
juanfeSanahuja Sep 16, 2024
1b10c43
Merge branch 'TASK-6879' of https://github.com/opencb/biodata into TA…
juanfeSanahuja Sep 16, 2024
ce681b0
pom:update internal dependencies #TASK-6879
juanfeSanahuja Sep 17, 2024
73e85d6
cicd scripts fix new branch and version references #TASK-6879
juanfeSanahuja Sep 17, 2024
6a20e30
cicd scripts fix new branch and version references #TASK-6879
juanfeSanahuja Sep 17, 2024
d77f216
Merge pull request #277 from opencb/TASK-6879
juanfeSanahuja Sep 19, 2024
eb352be
Merge branch 'release-3.x.x' into TASK-5318
jtarraga Sep 20, 2024
80903ca
Merge pull request #262 from opencb/TASK-5318
jtarraga Sep 26, 2024
5b5c880
Prepare release in hotfix branch release-5.2.x
juanfeSanahuja Sep 26, 2024
4954e09
Update jcl
juanfeSanahuja Oct 8, 2024
c084a63
Prepare release 3.2.2
juanfeSanahuja Oct 8, 2024
174cc25
Prepare release 3.3.0
juanfeSanahuja Oct 15, 2024
74d9052
Prepare release 3.3.0
juanfeSanahuja Oct 15, 2024
b230cb1
Merge branch 'release-3.x.x'
juanfeSanahuja Oct 15, 2024
d19d9e9
Prepare Port Patch 3.3.0 -> 4.0.0 Xetabase 2.3.0 -> 3.0.0 #TASK-7097
juanfeSanahuja Oct 17, 2024
208ad78
Merge branch 'develop' into TASK-7097
juanfeSanahuja Oct 17, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright 2015-2020 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.formats.variant;

import org.opencb.biodata.models.variant.avro.AlleleOrigin;

import java.util.HashMap;
import java.util.Map;

/**
* Created by fjlopez on 22/06/15.
*/
public class VariantAnnotationUtils {

private static final Map<String, AlleleOrigin> ORIGIN_STRING_TO_ALLELE_ORIGIN = new HashMap<>();
private static final Map<Character, Character> COMPLEMENTARY_NT = new HashMap<>();

static {

///////////////////////////////////////////////////////////////////////
///// ClinVar and Cosmic allele origins to SO terms ///////////////
///////////////////////////////////////////////////////////////////////
ORIGIN_STRING_TO_ALLELE_ORIGIN.put("germline", AlleleOrigin.germline_variant);
ORIGIN_STRING_TO_ALLELE_ORIGIN.put("maternal", AlleleOrigin.maternal_variant);
ORIGIN_STRING_TO_ALLELE_ORIGIN.put("de novo", AlleleOrigin.de_novo_variant);
ORIGIN_STRING_TO_ALLELE_ORIGIN.put("paternal", AlleleOrigin.paternal_variant);
ORIGIN_STRING_TO_ALLELE_ORIGIN.put("somatic", AlleleOrigin.somatic_variant);

COMPLEMENTARY_NT.put('A', 'T');
COMPLEMENTARY_NT.put('a', 't');
COMPLEMENTARY_NT.put('C', 'G');
COMPLEMENTARY_NT.put('c', 'g');
COMPLEMENTARY_NT.put('G', 'C');
COMPLEMENTARY_NT.put('g', 'c');
COMPLEMENTARY_NT.put('T', 'A');
COMPLEMENTARY_NT.put('t', 'a');
COMPLEMENTARY_NT.put('N', 'N');
COMPLEMENTARY_NT.put('n', 'n');
}

public static String reverseComplement(String string) {
return reverseComplement(string, false);
}

public static String reverseComplement(String string, boolean failOnUnknownNt) {
StringBuilder stringBuilder = new StringBuilder(string).reverse();
for (int i = 0; i < stringBuilder.length(); i++) {
char nextNt = stringBuilder.charAt(i);
// Protection against weird characters, e.g. alternate:"TBS" found in ClinVar
if (VariantAnnotationUtils.COMPLEMENTARY_NT.containsKey(nextNt)) {
stringBuilder.setCharAt(i, VariantAnnotationUtils.COMPLEMENTARY_NT.get(nextNt));
} else {
if (failOnUnknownNt) {
throw new IllegalArgumentException("Unknown nucleotide: '" + nextNt+ "'. "
+ "Unable to reverse-complement sequence '" + string + "'.");
} else {
return null;
}
}
}
return stringBuilder.toString();
}

public static AlleleOrigin parseAlleleOrigin(String alleleOrigin) {
return ORIGIN_STRING_TO_ALLELE_ORIGIN.get(alleleOrigin);
}

}
Loading
Loading