Commits

David Gomez-Cabrero committed 80189ab

Update R plot script 3 & Output files

  • Participants
  • Parent commits 7aa7ec7

Comments (0)

Files changed (4)

File src/CCdeep.cpp

 		// READ THE DATA PER BATCHES
 		dataset->read_samCCdeep_bysteps(alignment,outprefix,sitesx);
 
-		// DEVELOPERS: FILE THAT PRINTS THE QUALITY SUMMARY
-		// dataset->print_quality_sum(); //For developers
+		// PRINTS THE QUALITY SUMMARY
+		 dataset->print_quality_sum();
 
 		//******* PART 4. Summarizes the set regarding the RE sites.
 		//**********************************************

File src/HIC_PAIRS.cpp

 	  fprintf(file_print2,"Number of intra-chrom:          %d\t Percentage %2.2lf%% \t Number of intra-chrom RE: %d\t Percentage %2.2lf%% \n",int(statsx->num_intra),double(100*(statsx->num_intra)/(statsx->num_inter+statsx->num_intra)),int(statsx->num_intra_RE),double(100*(statsx->num_intra_RE)/(statsx->num_inter_RE+statsx->num_intra_RE)));
 	  fprintf(file_print2,"Number of inter-chrom:          %d\t Percentage %2.2lf%% \t Number of intra-chrom RE: %d\t Percentage %2.2lf%% \n",int(statsx->num_inter),double(100*(statsx->num_inter)/(statsx->num_inter+statsx->num_intra)),int(statsx->num_inter_RE),double(100*(statsx->num_inter_RE)/(statsx->num_inter_RE+statsx->num_intra_RE)));
 
-
-	//  fprintf(file_print2,"Selected\tDiscarded_by_1\tDiscarded_by_2\tALL\n");
-	//  fprintf(file_print2,"%f\t%f\t%f\t%f\n",statsx->total_unfiltqual,statsx->filterq_deleted1,statsx->filterq_deleted2,statsx->total_sam);
-	//  fprintf(file_print2,"%f\%\t%f\%\t%f\%\t%f\%\n",double(100.0*statsx->total_unfiltqual/statsx->total_sam),double(100.0*statsx->filterq_deleted1/statsx->total_sam),double(100.0*statsx->filterq_deleted2/statsx->total_sam),double(100.0));
-	//  fprintf(file_print2,"STEP 3 FILTERING BY CLOSENESS, threshold %d\n",optionsx->filter1_close);
-	//  fprintf(file_print2,"Selected\tDiscarded\tALL\n");
-	//  fprintf(file_print2,"%f\t%f\t%f\n",statsx->total_unfiltdist,statsx->filter1_dist,statsx->total_unfiltqual);
-	//  fprintf(file_print2,"%f\%\t%f\%\t%f\%\n",double(100.0*statsx->total_unfiltdist/statsx->total_unfiltqual),double(100.0*statsx->filter1_dist/statsx->total_unfiltqual),double(100.0));
-
 	  fclose(file_print2);
 
 	  FILE *file_print3;
 	  fprintf(file_print2,"Number of inter-chrom:\t%d\n",int(statsx->num_inter));
 	  fprintf(file_print2,"Number of intra-chrom RE:\t%d\n",int(statsx->num_inter_RE));
 	  fclose(file_print2);
-
-
-
 }
 
-
 void PAIRS::print_sam_red()
 {
 	FILE *file_print,*file_print1,*file_print2;

File src/HIC_REST.cpp

      // PRINT MATRIXES:
 	 print_matrix("fragl_trans",quanTiles_fragl_trans,quantiles_fragl,optionsh);
 	 print_matrix("fragl_cys",quanTiles_fragl_cys,quantiles_fragl,optionsh);
-	 print_matrix("MP_trans",quanTiles_MAP_trans,quantiles_MAP,optionsh);
-	 print_matrix("MP_cys",quanTiles_MAP_cys,quantiles_MAP,optionsh);
+	 print_matrix("MAP_trans",quanTiles_MAP_trans,quantiles_MAP,optionsh);
+	 print_matrix("MAP_cys",quanTiles_MAP_cys,quantiles_MAP,optionsh);
 	 print_matrix("GC_trans",quanTiles_GC_trans,quantiles_GC,optionsh);
 	 print_matrix("GC_cys",quanTiles_GC_cys,quantiles_GC,optionsh);
 
 		//fprintf(file_print,"\n%.3lf",quantilesx[i]);
 		if(i>0)
 			fprintf(file_print,"\n");
-		for(j=0;j<optionsh->quantiles;j++)
+		for(j=0;j<(quantilesx.size()-1);j++)
 		{
 			fprintf(file_print,"%.3lf",quanTilesx[i][j]);
-			if(j<(optionsh->quantiles-1))
+			if(j<(quantilesx.size()-2))
 				fprintf(file_print,"\t");
 		}
 

File src/graphics.cpp

 	r_script << "pdf(paste(FILE_NAME,\"_report_RE_distances.pdf\",sep=\"\"))" << endl;
 	r_script << "DIST_FILE1a<-read.csv(paste(FILE_NAME,\"_hist_distances_pos.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
 	r_script << "DIST_FILE1b<-read.csv(paste(FILE_NAME,\"_hist_distances_neg.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
-	r_script << "DIST_FILE2<-read.csv(paste(FILE_NAME,\"_histsum_distances_pos.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
+	r_script << "DIST_FILE2<-read.csv(paste(FILE_NAME,\"_histsum_distances.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
 	r_script << "plot(c(-DIST_FILE1b[nrow(DIST_FILE1b):2,1],DIST_FILE1a[,1]), log10(c(DIST_FILE1b[nrow(DIST_FILE1b):2,2],DIST_FILE1a[,2])),main=\"Distances to Restriction Enzyme sites\",xlab=\"Distance\",ylab=\"log10(Quantity)\",xlim=c(-1000,1000))" << endl;
 	r_script << "plot(DIST_FILE2[,1],log10(DIST_FILE2[,2]),main=\"Absolute Distances to Restriction Enzyme sites\",xlab=\"Distance\",ylab=\"log10(Quantity)\",xlim=c(-1000,1000))" << endl;
 	r_script << "dev.off()" << endl;
 
 	r_script << "pdf(paste(FILE_NAME,\"_BIASES.pdf\",sep=\"\"))" << endl;
 
-	r_script << "QUANTILESGC<-read.table(paste(FILE_NAME,\"_QUANTILES_GC.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
-	r_script << "QUANTILESMAP<-read.table(paste(FILE_NAME,\"_QUANTILES_MAP.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
-	r_script << "QUANTILESFRAG<-read.table(paste(FILE_NAME,\"_QUANTILES_fragl.txt\",sep=\"\"),sep=\"\\t\",header=TRUE)" << endl;
+	r_script << "QUANTILESGC<-read.table(paste(FILE_NAME,\"_QUANTILES_GC.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
+	r_script << "QUANTILESMAP<-read.table(paste(FILE_NAME,\"_QUANTILES_MAP.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
+	r_script << "QUANTILESFRAG<-read.table(paste(FILE_NAME,\"_QUANTILES_fragl.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
 
 	r_script << endl << "## GC plots" << endl;
 	r_script << "GC_cys<-read.table(paste(FILE_NAME,\"_GC_cys.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
-	r_script << "PLOT_IMAGE(GC_cys,QUANTILESGC,\"GC cys\",sum(GC_cys)/((length(QUANTILESGC)-1)*(length(QUANTILESGC)-1)))" << endl;
+	r_script << "PLOT_IMAGE(GC_cys,QUANTILESGC,\"GC cys\",sum(GC_cys)/((nrow(QUANTILESGC)-1)*(nrow(QUANTILESGC)-1)))" << endl;
 	r_script << "GC_trans<-read.table(paste(FILE_NAME,\"_GC_trans.txt\",sep=\"\"),sep=\"\\t\",header=FALSE) " << endl;
-	r_script << "PLOT_IMAGE(GC_trans,QUANTILESGC,\"GC trans\",sum(GC_trans)/((length(QUANTILESGC)-1)*(length(QUANTILESGC)-1)))" << endl;
+	r_script << "PLOT_IMAGE(GC_trans,QUANTILESGC,\"GC trans\",sum(GC_trans)/((nrow(QUANTILESGC)-1)*(nrow(QUANTILESGC)-1)))" << endl;
 
 	r_script << endl << "## Fragment Lenght plots" << endl;
-	r_script << "fl_cys<-read.table(paste(FILE_NAME,\"_fragl_cys.txt\",sep=""),sep=\"\\t\",header=FALSE)" << endl;
-	r_script << "PLOT_IMAGE(fl_cys,QUANTILESFRAG,\"Fragment length cys\",sum(fl_cys)/((length(QUANTILESFRAG)-1)*(length(QUANTILESFRAG)-1)))" << endl;
+	r_script << "fl_cys<-read.table(paste(FILE_NAME,\"_fragl_cys.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
+	r_script << "PLOT_IMAGE(fl_cys,QUANTILESFRAG,\"Fragment length cys\",sum(fl_cys)/((nrow(QUANTILESFRAG)-1)*(nrow(QUANTILESFRAG)-1)))" << endl;
 	r_script << "fl_trans<-read.table(paste(FILE_NAME,\"_fragl_trans.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
-	r_script << "PLOT_IMAGE(fl_trans,QUANTILESFRAG,\"Fragment length trans\",sum(fl_trans)/((length(QUANTILESFRAG)-1)*(length(QUANTILESFRAG)-1)))" << endl;
+	r_script << "PLOT_IMAGE(fl_trans,QUANTILESFRAG,\"Fragment length trans\",sum(fl_trans)/((nrow(QUANTILESFRAG)-1)*(nrow(QUANTILESFRAG)-1)))" << endl;
 
 	r_script << endl << "## Mappability plots" << endl;
-	r_script << "MAP_cys<-read.table(paste(FILE_NAME,\"_MAP_cys.txt\",sep=""),sep=\"\\t\",header=FALSE)" << endl;
-	r_script << "PLOT_IMAGE(fl_cys,QUANTILESMAP,\"MAP cys\",sum(MAP)/((length(QUANTILESMAP)-1)*(length(QUANTILESMAP)-1)))" << endl;
-	r_script << "fl_trans<-read.table(paste(FILE_NAME,\"_MAP_trans.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
-	r_script << "PLOT_IMAGE(fl_trans,QUANTILESMAP,\"Fragment length trans\",sum(MAP)/((length(QUANTILESMAP)-1)*(length(QUANTILESMAP)-1)))" << endl;
+	r_script << "MAP_cys<-read.table(paste(FILE_NAME,\"_MAP_cys.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
+	r_script << "PLOT_IMAGE(MAP_cys,QUANTILESMAP,\"MAP cys\",sum(MAP_cys)/((nrow(QUANTILESMAP)-1)*(nrow(QUANTILESMAP)-1)))" << endl;
+	r_script << "MAP_trans<-read.table(paste(FILE_NAME,\"_MAP_trans.txt\",sep=\"\"),sep=\"\\t\",header=FALSE)" << endl;
+	r_script << "PLOT_IMAGE(MAP_trans,QUANTILESMAP,\"Fragment length trans\",sum(MAP_trans)/((nrow(QUANTILESMAP)-1)*(nrow(QUANTILESMAP)-1)))" << endl;
 
 	r_script << "dev.off()" << endl << endl;