66
77import java .text .DecimalFormat ;
88
9+ import static com .astrazeneca .vardict .Utils .getRoundedValueToPrint ;
910import static com .astrazeneca .vardict .Utils .join ;
1011import static com .astrazeneca .vardict .data .scopedata .GlobalReadOnlyScope .instance ;
1112
@@ -200,76 +201,9 @@ public String toString() {
200201 */
201202 private String create_somatic_variant_61columns () {
202203 String outputVariant ;
203- String var1frequency_f = var1frequency == Math .round (var1frequency )
204- ? new DecimalFormat ("0" ).format (var1frequency )
205- : new DecimalFormat ("0.0000" ).format (var1frequency ).replaceAll ("0+$" , "" );
206- String var1meanPosition_f = var1meanPosition == Math .round (var1meanPosition )
207- ? new DecimalFormat ("0" ).format (var1meanPosition )
208- : new DecimalFormat ("0.0" ).format (var1meanPosition ).replaceAll ("0+$" , "" );
209- String var1meanQuality_f = var1meanQuality == Math .round (var1meanQuality )
210- ? new DecimalFormat ("0" ).format (var1meanQuality )
211- : new DecimalFormat ("0.0" ).format (var1meanQuality ).replaceAll ("0+$" , "" );
212- String var1meanMappingQuality_f = var1meanMappingQuality == Math .round (var1meanMappingQuality )
213- ? new DecimalFormat ("0" ).format (var1meanMappingQuality )
214- : new DecimalFormat ("0.0" ).format (var1meanMappingQuality ).replaceAll ("0+$" , "" );
215- String var1highQualityToLowQualityRatio_f = var1highQualityToLowQualityRatio == Math .round (var1highQualityToLowQualityRatio )
216- ? new DecimalFormat ("0" ).format (var1highQualityToLowQualityRatio )
217- : new DecimalFormat ("0.000" ).format (var1highQualityToLowQualityRatio ).replaceAll ("0+$" , "" );
218- String var1highQualityReadsFrequency_f = var1highQualityReadsFrequency == Math .round (var1highQualityReadsFrequency )
219- ? new DecimalFormat ("0" ).format (var1highQualityReadsFrequency )
220- : new DecimalFormat ("0.0000" ).format (var1highQualityReadsFrequency ).replaceAll ("0+$" , "" );
221- String var1extraFrequency_f = var1extraFrequency == Math .round (var1extraFrequency )
222- ? new DecimalFormat ("0" ).format (var1extraFrequency )
223- : new DecimalFormat ("0.0000" ).format (var1extraFrequency ).replaceAll ("0+$" , "" );
224204 var1nm = var1nm > 0 ? var1nm : 0 ;
225- String var1nm_f = var1nm == Math .round (var1nm )
226- ? new DecimalFormat ("0" ).format (var1nm )
227- : new DecimalFormat ("0.0" ).format (var1nm ).replaceAll ("0+$" , "" );
228- String var1pvalue_f = pvalue1 == Math .round (pvalue1 )
229- ? new DecimalFormat ("0" ).format (pvalue1 )
230- : new DecimalFormat ("0.00000" ).format (pvalue1 ).replaceAll ("0+$" , "" );
231-
232- String var2frequency_f = var2frequency == Math .round (var2frequency )
233- ? new DecimalFormat ("0" ).format (var2frequency )
234- : new DecimalFormat ("0.0000" ).format (var2frequency ).replaceAll ("0+$" , "" );
235- String var2meanPosition_f = var2meanPosition == Math .round (var2meanPosition )
236- ? new DecimalFormat ("0" ).format (var2meanPosition )
237- : new DecimalFormat ("0.0" ).format (var2meanPosition ).replaceAll ("0+$" , "" );
238- String var2meanQuality_f = var2meanQuality == Math .round (var2meanQuality )
239- ? new DecimalFormat ("0" ).format (var2meanQuality )
240- : new DecimalFormat ("0.0" ).format (var2meanQuality ).replaceAll ("0+$" , "" );
241- String var2meanMappingQuality_f = var2meanMappingQuality == Math .round (var2meanMappingQuality )
242- ? new DecimalFormat ("0" ).format (var2meanMappingQuality )
243- : new DecimalFormat ("0.0" ).format (var2meanMappingQuality ).replaceAll ("0+$" , "" );
244- String var2highQualityToLowQualityRatio_f = var2highQualityToLowQualityRatio == Math .round (var2highQualityToLowQualityRatio )
245- ? new DecimalFormat ("0" ).format (var2highQualityToLowQualityRatio )
246- : new DecimalFormat ("0.000" ).format (var2highQualityToLowQualityRatio ).replaceAll ("0+$" , "" );
247- String var2highQualityReadsFrequency_f = var2highQualityReadsFrequency == Math .round (var2highQualityReadsFrequency )
248- ? new DecimalFormat ("0" ).format (var2highQualityReadsFrequency )
249- : new DecimalFormat ("0.0000" ).format (var2highQualityReadsFrequency ).replaceAll ("0+$" , "" );
250- String var2extraFrequency_f = var2extraFrequency == Math .round (var2extraFrequency )
251- ? new DecimalFormat ("0" ).format (var2extraFrequency )
252- : new DecimalFormat ("0.0000" ).format (var2extraFrequency ).replaceAll ("0+$" , "" );
253205 var2nm = var2nm > 0 ? var2nm : 0 ;
254- String var2nm_f = var2nm == Math .round (var2nm )
255- ? new DecimalFormat ("0" ).format (var2nm )
256- : new DecimalFormat ("0.0" ).format (var2nm ).replaceAll ("0+$" , "" );
257- String var2pvalue_f = pvalue2 == Math .round (pvalue2 )
258- ? new DecimalFormat ("0" ).format (pvalue2 )
259- : new DecimalFormat ("0.00000" ).format (pvalue2 ).replaceAll ("0+$" , "" );
260-
261- String msi_f = msi == 0
262- ? "0"
263- : new DecimalFormat ("0.000" ).format (msi );
264- String var1duprate_f = var1duprate == Math .round (var1duprate )
265- ? new DecimalFormat ("0" ).format (var1duprate )
266- : new DecimalFormat ("0.0" ).format (var1duprate ).replaceAll ("0+$" , "" );
267- String var2duprate_f = var2duprate == Math .round (var2duprate )
268- ? new DecimalFormat ("0" ).format (var2duprate )
269- : new DecimalFormat ("0.0" ).format (var2duprate ).replaceAll ("0+$" , "" );
270- String pvalue_f = pvalue == Math .round (pvalue )
271- ? new DecimalFormat ("0" ).format (pvalue )
272- : new DecimalFormat ("0.00000" ).format (pvalue ).replaceAll ("0+$" , "" );
206+ String msi_f = msi == 0 ? "0" : new DecimalFormat ("0.000" ).format (msi );
273207
274208 outputVariant = join (delimiter ,
275209 sample ,
@@ -287,18 +221,18 @@ private String create_somatic_variant_61columns() {
287221 var1variantForwardCount ,
288222 var1variantReverseCount ,
289223 var1genotype ,
290- var1frequency_f ,
224+ getRoundedValueToPrint ( "0.0000" , var1frequency ) ,
291225 var1strandBiasFlag ,
292- var1meanPosition_f ,
226+ getRoundedValueToPrint ( "0.0" , var1meanPosition ) ,
293227 var1isAtLeastAt2Position ,
294- var1meanQuality_f ,
228+ getRoundedValueToPrint ( "0.0" , var1meanQuality ) ,
295229 var1hasAtLeast2DiffQualities ,
296- var1meanMappingQuality_f ,
297- var1highQualityToLowQualityRatio_f ,
298- var1highQualityReadsFrequency_f ,
299- var1extraFrequency_f ,
300- var1nm_f ,
301- var1pvalue_f ,
230+ getRoundedValueToPrint ( "0.0" , var1meanMappingQuality ) ,
231+ getRoundedValueToPrint ( "0.000" , var1highQualityToLowQualityRatio ) ,
232+ getRoundedValueToPrint ( "0.0000" , var1highQualityReadsFrequency ) ,
233+ getRoundedValueToPrint ( "0.0000" , var1extraFrequency ) ,
234+ getRoundedValueToPrint ( "0.0" , var1nm ) ,
235+ getRoundedValueToPrint ( "0.00000" , pvalue1 ) ,
302236 oddratio1 ,
303237
304238 var2totalCoverage ,
@@ -308,18 +242,18 @@ private String create_somatic_variant_61columns() {
308242 var2variantForwardCount ,
309243 var2variantReverseCount ,
310244 var2genotype ,
311- var2frequency_f ,
245+ getRoundedValueToPrint ( "0.0000" , var2frequency ) ,
312246 var2strandBiasFlag ,
313- var2meanPosition_f ,
247+ getRoundedValueToPrint ( "0.0" , var2meanPosition ) ,
314248 var2isAtLeastAt2Position ,
315- var2meanQuality_f ,
249+ getRoundedValueToPrint ( "0.0" , var2meanQuality ) ,
316250 var2hasAtLeast2DiffQualities ,
317- var2meanMappingQuality_f ,
318- var2highQualityToLowQualityRatio_f ,
319- var2highQualityReadsFrequency_f ,
320- var2extraFrequency_f ,
321- var2nm_f ,
322- var2pvalue_f ,
251+ getRoundedValueToPrint ( "0.0" , var2meanMappingQuality ) ,
252+ getRoundedValueToPrint ( "0.000" , var2highQualityToLowQualityRatio ) ,
253+ getRoundedValueToPrint ( "0.0000" , var2highQualityReadsFrequency ) ,
254+ getRoundedValueToPrint ( "0.0000" , var2extraFrequency ) ,
255+ getRoundedValueToPrint ( "0.0" , var2nm ) ,
256+ getRoundedValueToPrint ( "0.00000" , pvalue2 ) ,
323257 oddratio2 ,
324258
325259 shift3 ,
@@ -329,11 +263,11 @@ private String create_somatic_variant_61columns() {
329263 region ,
330264 varLabel ,
331265 varType ,
332- var1duprate_f ,
266+ getRoundedValueToPrint ( "0.0" , var1duprate ) ,
333267 var1sv ,
334- var2duprate_f ,
268+ getRoundedValueToPrint ( "0.0" , var2duprate ) ,
335269 var2sv ,
336- pvalue_f ,
270+ getRoundedValueToPrint ( "0.00000" , pvalue ) ,
337271 oddratio
338272 );
339273 return outputVariant ;
0 commit comments