Skip to content

Commit

Permalink
lib: several fixes in variant annotation and HGVS
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Jun 4, 2021
1 parent 3fb0e30 commit 28364b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected void solveNegativeTranscript(List<ConsequenceType> 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]);
Expand Down Expand Up @@ -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++;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 28364b2

Please sign in to comment.