From 28364b23acd5423795d408ce4cbf378aa3a3bbc2 Mon Sep 17 00:00:00 2001 From: imedina Date: Fri, 4 Jun 2021 02:18:19 +0100 Subject: [PATCH] lib: several fixes in variant annotation and HGVS --- .../lib/variant/annotation/ConsequenceTypeCalculator.java | 4 ++-- .../annotation/ConsequenceTypeDeletionCalculator.java | 4 ++-- .../cellbase/lib/variant/hgvs/HgvsProteinCalculator.java | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeCalculator.java b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeCalculator.java index a8baf16d6d..1c27aae115 100644 --- a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeCalculator.java +++ b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeCalculator.java @@ -168,7 +168,7 @@ protected void solveNegativeTranscript(List consequenceTypeList protected char[] getReverseComplementaryCodon(String transcriptSequence, int modifiedCodonStart) { char[] reverseCodon = (new StringBuilder(transcriptSequence.substring(transcriptSequence.length() - modifiedCodonStart - 2, // Rigth limit of the substring sums +1 because substring does not include that position - transcriptSequence.length() - modifiedCodonStart + 1)).reverse().toString()).toCharArray(); + transcriptSequence.length() - modifiedCodonStart + 1)).reverse().toString().toUpperCase()).toCharArray(); reverseCodon[0] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(reverseCodon[0]); reverseCodon[1] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(reverseCodon[1]); reverseCodon[2] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(reverseCodon[2]); @@ -341,7 +341,7 @@ protected int updateNegativeInsertionCodonArrays(String reverseTranscriptSequenc .getResults().get(0).getSequence().charAt(0)); } else { modifiedCodonArray[modifiedCodonPosition] = VariantAnnotationUtils.COMPLEMENTARY_NT.get( - reverseTranscriptSequence.charAt(reverseTranscriptSequencePosition)); + reverseTranscriptSequence.toUpperCase().charAt(reverseTranscriptSequencePosition)); } reverseTranscriptSequencePosition++; diff --git a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeDeletionCalculator.java b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeDeletionCalculator.java index 734474bfee..2af8bd84a7 100644 --- a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeDeletionCalculator.java +++ b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/annotation/ConsequenceTypeDeletionCalculator.java @@ -409,12 +409,12 @@ protected void solveStopCodonNegativeVariant(String transcriptSequence, int cdna : 0, // Be careful reaching the end of the transcript sequence // Rigth limit of the substring -2 because substring does not include that position transcriptSequence.length() - cdnaVariantEnd)).reverse().toString(); - char[] referenceCodon1Array = reverseCodon1.toCharArray(); + char[] referenceCodon1Array = reverseCodon1.toUpperCase().toCharArray(); referenceCodon1Array[0] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon1Array[0]); referenceCodon1Array[1] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon1Array[1]); referenceCodon1Array[2] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon1Array[2]); String referenceCodon1 = String.valueOf(referenceCodon1Array); - char[] referenceCodon2Array = reverseCodon2.toCharArray(); + char[] referenceCodon2Array = reverseCodon2.toUpperCase().toCharArray(); referenceCodon2Array[0] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon2Array[0]); referenceCodon2Array[1] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon2Array[1]); referenceCodon2Array[2] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(referenceCodon2Array[2]); diff --git a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/hgvs/HgvsProteinCalculator.java b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/hgvs/HgvsProteinCalculator.java index 9a2bca65f1..1f3e35d034 100644 --- a/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/hgvs/HgvsProteinCalculator.java +++ b/cellbase-lib/src/main/java/org/opencb/cellbase/lib/variant/hgvs/HgvsProteinCalculator.java @@ -54,7 +54,7 @@ public class HgvsProteinCalculator { private static final String UNIPROT_LABEL = "uniprotkb/swissprot"; protected BuildingComponents buildingComponents = null; - public static final int MAX_NUMBER_AMINOACIDS_DISPLAYED = 10; + public static final int MAX_NUMBER_AMINOACIDS_DISPLAYED = 20; /** * Constructor. @@ -422,7 +422,8 @@ private HgvsProtein hgvsInsertionFormatter(int aminoacidPosition, String alterna // Example: check 11:6390701:-:CTGGCGCTGGCG if (aminoacidPosition - 1 < transcript.getProteinSequence().length()) { String aaAfterInsertion = transcript.getProteinSequence().substring(aminoacidPosition - 1, aminoacidPosition); - while (codedAminoacids.get(0).equals(aaAfterInsertion)) { + while (codedAminoacids.get(0).equals(aaAfterInsertion) + && aminoacidPosition + 1 < transcript.getProteinSequence().length()) { aminoacidPosition++; aminoacids.remove(0); codedAminoacids.remove(0);