@@ -25,8 +25,7 @@ public class QSVClusterReport extends QSVReport {
2525 private String normalFindType ;
2626 private boolean isQCMG ;
2727 private final boolean isSingleSided ;
28- private static String TAB = "\t " ;
29-
28+
3029 public QSVClusterReport (String base , String mutationType , String end , String fileType , List <QSVCluster > qsvRecords , String tumourFindType , String normalFindType , boolean isSingleSided ) throws IOException {
3130 super (new File (base + "." + mutationType + end ));
3231 this .fileType = fileType ;
@@ -35,7 +34,7 @@ public QSVClusterReport(String base, String mutationType, String end, String fil
3534 this .tumourFindType = tumourFindType ;
3635 this .normalFindType = normalFindType ;
3736 if (normalFindType == null ) {
38- normalFindType = "" ;
37+ this . normalFindType = "" ;
3938 }
4039
4140 writeHeader ();
@@ -46,17 +45,14 @@ public QSVClusterReport(String base, String mutationType, String end, String fil
4645 this .fileType = fileType ;
4746 this .qsvRecords = qsvRecords ;
4847 this .isSingleSided = isSingleSided ;
49- if (normalFindType == null ) {
50- normalFindType = "" ;
51- }
5248 writeHeader ();
5349 writeReport ();
5450 }
5551
5652 public QSVClusterReport (String base , String mutationType , String end , String fileType , QSVCluster r , String tumourFindType , String normalFindType , boolean isQCMG , boolean isSingleSided ) throws IOException {
5753 super (new File (base + "." + r .getReference () + "." + mutationType + end ));
5854 this .fileType = fileType ;
59- this .qsvRecords = new ArrayList <QSVCluster >();
55+ this .qsvRecords = new ArrayList <>();
6056 this .tumourFindType = tumourFindType ;
6157 this .normalFindType = normalFindType ;
6258 this .isQCMG = isQCMG ;
@@ -71,21 +67,21 @@ public void writeHeader() throws IOException {
7167
7268 // print header for the file.
7369 if (!file .exists ()) {
74- try ( BufferedWriter writer = new BufferedWriter (new FileWriter (file , false )); ) {
70+ try ( BufferedWriter writer = new BufferedWriter (new FileWriter (file , false ))) {
7571 writer .write (getHeader ());
7672 }
7773 }
7874 }
7975
8076 @ Override
8177 public synchronized void writeReport () throws IOException {
82- try (BufferedWriter writer = new BufferedWriter (new FileWriter (file , true )); ) {
78+ try (BufferedWriter writer = new BufferedWriter (new FileWriter (file , true ))) {
8379 for (QSVCluster r : qsvRecords ) {
8480 if (r .printRecord (isSingleSided )) {
8581
8682 String str = r .getDataString (fileType , tumourFindType , normalFindType , isQCMG );
8783 if (fileType .equals ("softclip" )) {
88- if (!str .equals ( "" ) && r .hasSoftClipEvidence ()) {
84+ if (!str .isEmpty ( ) && r .hasSoftClipEvidence ()) {
8985 writer .write (str + QSVUtil .getNewLine ());
9086 }
9187 } else {
@@ -97,25 +93,26 @@ public synchronized void writeReport() throws IOException {
9793 }
9894
9995 @ Override
100- public String getHeader () {
101-
102-
103- if (fileType .equals ("tab" )) {
104- return "#analysis_id" + TAB + "sample_id" + TAB + "sv_id" + TAB + "sv_type" + TAB + "chr1" + TAB + "pos1" + TAB + "strand1" + TAB + "chr2" + TAB + "pos2" + TAB + "strand2" + TAB + QSVConstants .DISEASE_SAMPLE + "_discordant_pairs_count" + TAB + QSVConstants .CONTROL_SAMPLE + "_discordant_pairs_count"
96+ public String getHeader () {
97+
98+
99+ String TAB = "\t " ;
100+ if (fileType .equals ("tab" )) {
101+ return "#analysis_id" + TAB + "sample_id" + TAB + "sv_id" + TAB + "sv_type" + TAB + "chr1" + TAB + "pos1" + TAB + "strand1" + TAB + "chr2" + TAB + "pos2" + TAB + "strand2" + TAB + QSVConstants .DISEASE_SAMPLE + "_discordant_pairs_count" + TAB + QSVConstants .CONTROL_SAMPLE + "_discordant_pairs_count"
105102 + TAB + QSVConstants .CONTROL_SAMPLE + "_low_qual_discordant_reads_count"
106103 + TAB + QSVConstants .DISEASE_SAMPLE + "_clips_count_pos1"
107104 + TAB + QSVConstants .DISEASE_SAMPLE + "_clips_count_pos2"
108105 + TAB + QSVConstants .CONTROL_SAMPLE + "_clips_count_pos1"
109106 + TAB + QSVConstants .CONTROL_SAMPLE + "_clips_count_pos2"
110107 + TAB + "category"
111- + TAB + "microhomology" + TAB + "non-template" + TAB + "test_split_read_bp" + TAB + "control_split_read_bp" + TAB + "event_notes" + TAB + "contig" + QSVUtil .getNewLine ();
108+ + TAB + "microhomology" + TAB + "non-template" + TAB + "test_split_read_bp" + TAB + "control_split_read_bp" + TAB + "event_notes" + TAB + "contig" + QSVUtil .getNewLine ();
112109 } else if (fileType .equals ("softclip" )){
113- return "sv_id" + TAB + "chr1" + TAB + "bp1" + TAB + "contig1" +
114- TAB + "read_strand_1" + TAB + "blat_align_chr1" + TAB + "blat_align_bp1" + TAB +
110+ return "sv_id" + TAB + "chr1" + TAB + "bp1" + TAB + "contig1" +
111+ TAB + "read_strand_1" + TAB + "blat_align_chr1" + TAB + "blat_align_bp1" + TAB +
115112 "blat_align_ref_start_pos_1" + TAB + "blat_align_ref_end_pos_1" + TAB + "blat_align_contig_start_1" + TAB + "blat_align_contig_end_1" + TAB +
116- "blat_align_strand_1" +
117- TAB + "chr2" + TAB + "bp2" + TAB + "contig2" +
118- TAB + "read_strand_2" + TAB + "blat_align_chr2" + TAB + "blat_align_bp2" + TAB + "blat_align_contig_start_1" + TAB + "blat_align_contig_end_1" + TAB +
113+ "blat_align_strand_1" +
114+ TAB + "chr2" + TAB + "bp2" + TAB + "contig2" +
115+ TAB + "read_strand_2" + TAB + "blat_align_chr2" + TAB + "blat_align_bp2" + TAB + "blat_align_contig_start_1" + TAB + "blat_align_contig_end_1" + TAB +
119116 "blat_align_start_pos_2" + TAB + "blat_align_end_pos_2" + TAB + "blat_align_strand_2" +
120117 QSVUtil .getNewLine ();
121118 }
0 commit comments