3434
3535import java .io .StringWriter ;
3636import java .util .List ;
37+ import java .util .Locale ;
3738
3839/**
3940 * A class to convert the data in an AfpChain object to various String outputs.
@@ -67,7 +68,7 @@ public static String toScoresList(AFPChain afpChain){
6768
6869 if ( afpChain .getAlgorithmName ().startsWith ("CE" )) {
6970 writer .append ("Z-score " );
70- writer .append (String .format ("%.2f" , afpChain .getProbability ()));
71+ writer .append (String .format (Locale . US , "%.2f" , afpChain .getProbability ()));
7172 writer .append (newline );
7273 }
7374
@@ -196,10 +197,10 @@ public static String toFatCatCore(
196197 txt .append ("Short match" );
197198 return txt .toString ();
198199 }
199- //txt.append(String.format("raw-score: %.2f norm.-score: %.2f ", alignScore, normAlignScore));
200+ //txt.append(String.format(Locale.US, "raw-score: %.2f norm.-score: %.2f ", alignScore, normAlignScore));
200201
201202 if ( longHeader ) {
202- txt .append (String .format ( "Twists %d ini-len %d ini-rmsd %.2f opt-equ %d opt-rmsd %.2f chain-rmsd %.2f Score %.2f align-len %d gaps %d (%.2f%%)" ,
203+ txt .append (String .format (Locale . US , "Twists %d ini-len %d ini-rmsd %.2f opt-equ %d opt-rmsd %.2f chain-rmsd %.2f Score %.2f align-len %d gaps %d (%.2f%%)" ,
203204 blockNum - 1 , totalLenIni , totalRmsdIni , optLength , totalRmsdOpt , chainRmsd , alignScore ,
204205 alnLength , gapLen , (100.0 * gapLen /alnLength )) );
205206 txt .append (newline );
@@ -213,12 +214,12 @@ public static String toFatCatCore(
213214 }
214215
215216
216- //txt.append(String.format("P-value %.2e Afp-num %d Identity %.2f%% Similarity %.2f%% norm.-score: %.2f"+newline, probability, afpNum, identity * 100, similarity * 100, normAlignScore));
217+ //txt.append(String.format(Locale.US, "P-value %.2e Afp-num %d Identity %.2f%% Similarity %.2f%% norm.-score: %.2f"+newline, probability, afpNum, identity * 100, similarity * 100, normAlignScore));
217218
218219 if ( longHeader ) {
219220 printScore (txt ,algorithmName ,probability ,longHeader );
220221
221- txt .append (String .format ("Afp-num %d Identity %.2f%% Similarity %.2f%%" , afpNum , identity * 100 , similarity * 100 ));
222+ txt .append (String .format (Locale . US , "Afp-num %d Identity %.2f%% Similarity %.2f%%" , afpNum , identity * 100 , similarity * 100 ));
222223 txt .append (newline );
223224 }
224225
@@ -229,7 +230,7 @@ public static String toFatCatCore(
229230 int fragLen = 8 ; // FatCatParameters.DEFAULT_FRAGLEN;
230231 for (i = 0 ; i < blockNum ; i ++) {
231232 gap = blockGap [i ] /( (double )blockGap [i ] + fragLen * blockSize [i ]);
232- txt .append (String .format ( "Block %2d afp %2d score %5.2f rmsd %5.2f gap %d (%.2f%%)" ,
233+ txt .append (String .format (Locale . US , "Block %2d afp %2d score %5.2f rmsd %5.2f gap %d (%.2f%%)" ,
233234 i , blockSize [i ], blockScore [i ], blockRmsd [i ], blockGap [i ], gap ));
234235 txt .append (newline );
235236 }
@@ -389,29 +390,29 @@ public static void printScoresInLines(AFPChain afpChain, int blockNum, int optLe
389390 int alnLength , int gapLen , double identity , double similarity , StringBuffer txt )
390391 {
391392 if ( blockNum - 1 > 0 ) {
392- txt .append (String .format ( "Twists %d " , blockNum -1 ));
393+ txt .append (String .format (Locale . US , "Twists %d " , blockNum -1 ));
393394 txt .append (newline );
394395 }
395396
396- txt .append (String .format ("Equ: %d " , optLength ));
397+ txt .append (String .format (Locale . US , "Equ: %d " , optLength ));
397398 txt .append (newline );
398- txt .append (String .format ("RMSD: %.2f " , totalRmsdOpt ));
399+ txt .append (String .format (Locale . US , "RMSD: %.2f " , totalRmsdOpt ));
399400 txt .append (newline );
400- txt .append (String .format ("Score: %.2f " , alignScore ));
401+ txt .append (String .format (Locale . US , "Score: %.2f " , alignScore ));
401402 txt .append (newline );
402- txt .append (String .format ("Align-len: %d " , alnLength ));
403+ txt .append (String .format (Locale . US , "Align-len: %d " , alnLength ));
403404 txt .append (newline );
404- txt .append (String .format ("Gaps: %d (%.2f%%)" ,
405+ txt .append (String .format (Locale . US , "Gaps: %d (%.2f%%)" ,
405406 gapLen , (100.0 * gapLen /alnLength )) );
406407 txt .append (newline );
407408 if ( afpChain .getTMScore () >= 0 ) {
408- txt .append (String .format ("TM-score: %.2f" ,afpChain .getTMScore ()));
409+ txt .append (String .format (Locale . US , "TM-score: %.2f" ,afpChain .getTMScore ()));
409410 txt .append (newline );
410411 }
411412 txt .append (newline );
412- txt .append (String .format ("Identity: %.2f%% " , identity * 100 ));
413+ txt .append (String .format (Locale . US , "Identity: %.2f%% " , identity * 100 ));
413414 txt .append (newline );
414- txt .append (String .format ("Similarity: %.2f%%" , similarity * 100 ));
415+ txt .append (String .format (Locale . US , "Similarity: %.2f%%" , similarity * 100 ));
415416 txt .append (newline );
416417 }
417418
@@ -421,16 +422,16 @@ private static void printScore(StringBuffer txt,
421422 boolean longHeader )
422423 {
423424 if ( algorithmName .equalsIgnoreCase (CeMain .algorithmName ) || algorithmName .equalsIgnoreCase (CeSideChainMain .algorithmName ) ){
424- txt .append (String .format ("Z-score %.2f " , probability ));
425+ txt .append (String .format (Locale . US , "Z-score %.2f " , probability ));
425426 if ( ! longHeader )
426427 txt .append (newline );
427428 } else if ( algorithmName .equalsIgnoreCase (SmithWaterman3Daligner .algorithmName )) {
428429
429430 } else {
430431 if ( longHeader ){
431- txt .append (String .format ("P-value %.2e " ,probability ));
432+ txt .append (String .format (Locale . US , "P-value %.2e " ,probability ));
432433 } else {
433- txt .append (String .format ("P-value: %.2e " ,probability ));
434+ txt .append (String .format (Locale . US , "P-value: %.2e " ,probability ));
434435 txt .append (newline );
435436 }
436437 }
@@ -1065,15 +1066,15 @@ public static String toDBSearchResult(AFPChain afpChain)
10651066 str .append ("\t " );
10661067 str .append (afpChain .getName2 ());
10671068 str .append ("\t " );
1068- str .append (String .format ("%.2f" ,afpChain .getAlignScore ()));
1069+ str .append (String .format (Locale . US , "%.2f" ,afpChain .getAlignScore ()));
10691070 str .append ("\t " );
10701071 if ( afpChain .getAlgorithmName ().equalsIgnoreCase (CeMain .algorithmName )){
1071- str .append (String .format ("%.2f" ,afpChain .getProbability ()));
1072+ str .append (String .format (Locale . US , "%.2f" ,afpChain .getProbability ()));
10721073 } else {
1073- str .append (String .format ("%.2e" ,afpChain .getProbability ()));
1074+ str .append (String .format (Locale . US , "%.2e" ,afpChain .getProbability ()));
10741075 }
10751076 str .append ("\t " );
1076- str .append (String .format ("%.2f" ,afpChain .getTotalRmsdOpt ()));
1077+ str .append (String .format (Locale . US , "%.2f" ,afpChain .getTotalRmsdOpt ()));
10771078 str .append ("\t " );
10781079 str .append (afpChain .getCa1Length ());
10791080 str .append ("\t " );
@@ -1083,7 +1084,7 @@ public static String toDBSearchResult(AFPChain afpChain)
10831084 str .append ("\t " );
10841085 str .append (afpChain .getCoverage2 ());
10851086 str .append ("\t " );
1086- str .append (String .format ("%.2f" ,afpChain .getIdentity ()));
1087+ str .append (String .format (Locale . US , "%.2f" ,afpChain .getIdentity ()));
10871088 str .append ("\t " );
10881089 str .append (afpChain .getDescription2 ());
10891090 str .append ("\t " );
@@ -1119,11 +1120,11 @@ public static String toRotMat(AFPChain afpChain)
11191120 origString = String .valueOf (blockNr );
11201121
11211122
1122- txt .append (String .format (" X" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,0 ),m .get (1 ,0 ), m .get (2 ,0 ), shift .getX ()));
1123+ txt .append (String .format (Locale . US , " X" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,0 ),m .get (1 ,0 ), m .get (2 ,0 ), shift .getX ()));
11231124 txt .append ( newline );
1124- txt .append (String .format (" Y" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,1 ),m .get (1 ,1 ), m .get (2 ,1 ), shift .getY ()));
1125+ txt .append (String .format (Locale . US , " Y" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,1 ),m .get (1 ,1 ), m .get (2 ,1 ), shift .getY ()));
11251126 txt .append ( newline );
1126- txt .append (String .format (" Z" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,2 ),m .get (1 ,2 ), m .get (2 ,2 ), shift .getZ ()));
1127+ txt .append (String .format (Locale . US , " Z" +(blockNr +1 )+" = (%9.6f)*X" + origString +" + (%9.6f)*Y" + origString +" + (%9.6f)*Z" + origString +" + (%12.6f)" ,m .get (0 ,2 ),m .get (1 ,2 ), m .get (2 ,2 ), shift .getZ ()));
11271128 txt .append (newline );
11281129 }
11291130 return txt .toString ();
@@ -1178,8 +1179,8 @@ public static String toCE(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
11781179 txt .append (")" );
11791180 txt .append (newline );
11801181 txt .append (newline );
1181- txt .append (String .format ("Alignment length = %d Rmsd = %.2fA Z-Score = %.1f" ,optLength ,totalRmsdOpt ,probability ));
1182- txt .append (String .format (" Gaps = %d(%.1f%%) CPU = %d ms. Sequence identities = %.1f%%" ,gapLen ,( gapLen *100.0 /optLength ),calculationTime ,identity *100 ));
1182+ txt .append (String .format (Locale . US , "Alignment length = %d Rmsd = %.2fA Z-Score = %.1f" ,optLength ,totalRmsdOpt ,probability ));
1183+ txt .append (String .format (Locale . US , " Gaps = %d(%.1f%%) CPU = %d ms. Sequence identities = %.1f%%" ,gapLen ,( gapLen *100.0 /optLength ),calculationTime ,identity *100 ));
11831184
11841185 int linelen = 70 ;
11851186 String a ;
0 commit comments