This repository was archived by the owner on May 22, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/com/astrazeneca/vardict/modules
test/java/com/astrazeneca/vardict/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -993,9 +993,19 @@ else if (deletionLength < instance().conf.SVMINLEN) {
993993 }
994994 }
995995
996+ /**
997+ * Validate reference allele according to VCF 4.3 specification in case if IUPAC ambiguity codes are present
998+ * in reference.
999+ * @param refallele sequence of reference bases that covers variant
1000+ * @return reference allele sequence where IUPAC ambuguity bases are changed to the one that is
1001+ * first alphabetically.
1002+ */
9961003 String validateRefallele (String refallele ) {
997- if (IUPAC_AMBIGUITY_CODES .containsKey (refallele )){
998- refallele = IUPAC_AMBIGUITY_CODES .get (refallele );
1004+ for (int i = 0 ; i < refallele .length (); i ++) {
1005+ String refBase = substr (refallele , i , 1 );
1006+ if (IUPAC_AMBIGUITY_CODES .containsKey (refBase )) {
1007+ refallele = refallele .replaceFirst (refBase , IUPAC_AMBIGUITY_CODES .get (refBase ));
1008+ }
9991009 }
10001010 return refallele ;
10011011 }
Original file line number Diff line number Diff line change @@ -139,5 +139,14 @@ public void testValidateRefAllele(){
139139 validatedAlleles .add (toVarsBuilder .validateRefallele (allele ));
140140 }
141141 assertEquals (validatedAlleles , expected );
142+
143+ List <String > alleles_complex = Arrays .asList ("ANYCGT" , "MRACT" , "CCGKBG" );
144+ List <String > expected_complex = Arrays .asList ("ANCCGT" , "AAACT" , "CCGGCG" );
145+
146+ validatedAlleles = new ArrayList <>();
147+ for (String allele : alleles_complex ) {
148+ validatedAlleles .add (toVarsBuilder .validateRefallele (allele ));
149+ }
150+ assertEquals (validatedAlleles , expected_complex );
142151 }
143152}
You can’t perform that action at this time.
0 commit comments