3030 * and variants in region.
3131 */
3232public class ToVarsBuilder implements Module <RealignedVariationData , AlignedVarsData > {
33+ // Left 20 and right 20 bases in reference to output in VCF file
34+ public static final int REF_20_BASES = 20 ;
35+ // Number of bases where to check for MSIs
36+ public static final int REF_30_BASES = 30 ;
37+ public static final int REF_50_BASES = 50 ;
38+ public static final int REF_70_BASES = 70 ;
39+
3340 private Region region ;
3441 private Map <Integer , Integer > refCoverage ;
3542 private Map <Integer , VariationMap <String , Variation >> insertionVariants ;
@@ -196,10 +203,10 @@ private boolean isTheSameVariationOnRef(int position, VariationMap<String, Varia
196203 */
197204 private MSI proceedVrefIsDeletion (int position , int dellen ) {
198205 //left 70 bases in reference sequence
199- String leftseq = joinRef (ref , (Math .max (position - 70 , 1 )), position - 1 ); // left 10 nt
206+ String leftseq = joinRef (ref , (Math .max (position - REF_70_BASES , 1 )), position - 1 ); // left 10 nt
200207 int chr0 = getOrElse (instance ().chrLengths , region .chr , 0 );
201208 //right 70 + dellen bases in reference sequence
202- String tseq = joinRef (ref , position , Math .min (position + dellen + 70 , chr0 ));
209+ String tseq = joinRef (ref , position , Math .min (position + dellen + REF_70_BASES , chr0 ));
203210
204211 //Try to adjust for microsatellite instability
205212 MSI msiData = findMSI (substr (tseq , 0 , dellen ), substr (tseq , dellen ), leftseq );
@@ -223,7 +230,7 @@ private MSI proceedVrefIsDeletion(int position, int dellen) {
223230
224231 /**
225232 * For insertion variant calculates shift3 (number of bases to be shifted to 3' for deletions due to alternative alignment),
226- * msi (which indicates Microsatellite instability) and msint (MicroSattelite unit length in base pairs) fields.
233+ * msi (which indicates Microsatellite instability) and msint (MicroSatellite unit length in base pairs) fields.
227234 * @param position position to seek in reference to get left sequence of variant
228235 * @param vn variant description string
229236 * @return tuple of msi, shift3 and msint.
@@ -232,10 +239,10 @@ private MSI proceedVrefIsInsertion(int position, String vn) {
232239 //variant description string without first symbol '+'
233240 String tseq1 = vn .substring (1 );
234241 //left 50 bases in reference sequence
235- String leftseq = joinRef (ref , Math .max (position - 50 , 1 ), position ); // left 10 nt
242+ String leftseq = joinRef (ref , Math .max (position - REF_50_BASES , 1 ), position ); // left 10 nt
236243 int x = getOrElse (instance ().chrLengths , region .chr , 0 );
237244 //right 70 bases in reference sequence
238- String tseq2 = joinRef (ref , position + 1 , (Math .min (position + 70 , x )));
245+ String tseq2 = joinRef (ref , position + 1 , (Math .min (position + REF_70_BASES , x )));
239246
240247 MSI msiData = findMSI (tseq1 , tseq2 , leftseq );
241248 double msi = msiData .msi ;
@@ -741,9 +748,9 @@ else if (deletionLength < instance().conf.SVMINLEN) {
741748 }
742749 } else { //Not insertion/deletion variant. SNP or MNP
743750 //Find MSI adjustment
744- String tseq1 = joinRef (ref , Math .max (position - 30 , 1 ), position + 1 );
751+ String tseq1 = joinRef (ref , Math .max (position - REF_30_BASES , 1 ), position + 1 );
745752 int chr0 = getOrElse (instance ().chrLengths , region .chr , 0 );
746- String tseq2 = joinRef (ref , position + 2 , Math .min (position + 70 , chr0 ));
753+ String tseq2 = joinRef (ref , position + 2 , Math .min (position + REF_70_BASES , chr0 ));
747754
748755 MSI msiData = findMSI (tseq1 , tseq2 , null );
749756 msi = msiData .msi ;
@@ -897,10 +904,10 @@ else if (deletionLength < instance().conf.SVMINLEN) {
897904 }
898905
899906 //preceding reference sequence
900- vref .leftseq = joinRef (ref , Math .max (startPosition - 20 , 1 ), startPosition - 1 ); // left 20 nt
907+ vref .leftseq = joinRef (ref , Math .max (startPosition - REF_20_BASES , 1 ), startPosition - 1 ); // left 20 nt
901908 int chr0 = getOrElse (instance ().chrLengths , region .chr , 0 );
902909 //following reference sequence
903- vref .rightseq = joinRef (ref , endPosition + 1 , Math .min (endPosition + 20 , chr0 )); // right 20 nt
910+ vref .rightseq = joinRef (ref , endPosition + 1 , Math .min (endPosition + REF_20_BASES , chr0 )); // right 20 nt
904911 //genotype description string
905912 String genotype = genotype1current + "/" + genotype2 ;
906913 //remove '&' and '#' symbols from genotype string
0 commit comments