Commit 144f77c1 authored by Lucy McNeill's avatar Lucy McNeill
Browse files

change calls to repeated print to cat

parent 0c80dbc4
No preview for this file type
......@@ -108,11 +108,7 @@ auto_crop_fast <- function(img_path, max_cell_area = 20000, min_cell_area = 700
antibody3_store <- 0
}
}
print("out of")
print(image_count)
print("images, we got")
print(cell_count)
print("viable cells")
cat("out of",image_count,"images, we got",cell_count,"viable cells \n", sep = " ")
}
......
......@@ -42,9 +42,7 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
else{
img_path_new <- paste0(img_path,"/crops/")
}
file_list <- list.files(img_path_new)
print(file_list)
df_cols <- c("filename","cell_no","genotype","stage","foci_count", "sd_foci","mean_foci","median_foci","mean_px","median_px", "percent_on","sd_px","lone_foci")
df_cells <- data.frame(matrix(ncol = length(df_cols), nrow = 0))
colnames(df_cells) <- df_cols
......@@ -124,17 +122,14 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
}
### multiply strands by foci_label
if(annotation == "on"){
print("at file")
print(img_file)
print("cell counter is")
print(cell_count)
cat("at file",img_file, sep = " ")
cat("cell counter is", cell_count, sep= " ")
print("original images")
plot(new_img)
plot(img_orig_foci)
print("displaying resulting foci count")
print("Overlay two channels")
print("displaying resulting foci count plots. Overlay two channels:")
plot(rgbImage(strands,foci_label,0*foci_label))
print("coincident foci")
print("coincident foci:")
plot(colorLabels(coincident_foci))
print("two channels, only coincident foci")
plot(rgbImage(strands,coincident_foci,coincident_foci))
......@@ -142,8 +137,7 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
overlap_no <- table(coincident_foci)
foci_per_cell <- length(overlap_no)
if(annotation=="on"){
print("which counts this many foci:")
print(foci_per_cell)
cat("which counts this many foci:",foci_per_cell, sep = " ")
}
image_mat <- as.matrix(foci_mask_crop)
image_mat <- image_mat[image_mat > 1e-06]
......@@ -161,17 +155,16 @@ count_foci <- function(img_path, stage = "none", offset_px = 0.2, offset_factor
### number of foci NOT on an SC
alone_foci <- nrow(foci_candidates) - foci_per_cell
if(annotation == "on"){
print("number of alone foci")
print(alone_foci)
cat("number of alone foci",alone_foci, sep = " ")
if(alone_foci < 0){
print("this one had a negative lone foci amount. Suspect overcounting of foci in this one:")
plot(rgbImage(strands,foci_label,0*foci_label))
alone_foci <- 0
}
}
percent_px <- sum(overlap)/sum(foci_areas)
if(annotation == "on"){
print("percentage of foci channel coincident:")
print(percent_px*100)
cat("percentage of foci channel coincident:", percent_px*100, sep = " ")
}
tryCatch({
### data frame stuff
......
......@@ -121,8 +121,7 @@ get_pachytene <- function(img_path, species_num = 20, offset = 0.2,ecc_thresh =
}
}
}
print("number of cells kept")
print(pachytene_count)
cat("number of cells kept",pachytene_count, sep = " ")
colnames(df_cells) <- df_cols
return(df_cells)
}
......
......@@ -101,8 +101,7 @@ measure_distances_general <- function(img_path,offset_px = 0.2, offset_factor =
foci_candidates <- data.frame(foci_candidates)
foci_areas <- foci_candidates$s.area
if(annotation == "on"){
print("looking at cell number:")
print(cell_count)
cat("\n looking at cell number:", cell_count, sep = " ")
}
dimensionless_dist <- get_distance_general(strands,num_strands,new_img,foci_label, foci_count_strand, strand_iter,img_file,annotation,eccentricity_min, max_strand_area,cell_count,KO_str ,WT_str,KO_out, WT_out,target_foci_number, max_dist_sq,SC_intens_stop)
df_lengths <- rbind(df_lengths, dimensionless_dist)
......@@ -403,8 +402,7 @@ get_distances_along <- function(distance_strand,distance_strand_2,per_strand,foc
strand_info <- as.data.frame(strand_info)
#### turn this into a table/ data frame
no_foci <- nrow(strand_info)
print("the number of foci in this strand is")
print(no_foci)
cat("\n the number of foci in this strand is", no_foci, sep = " ")
df_col <- c("file","cell_id","genotype","strand_iter","foci_per_strand","iteration_on_strand","foci_x","foci_y","foci_x_line","foci_y_line","total_length","distance_squared","distance_along","SC_pass_fail")
foci_df <- data.frame(matrix(ncol = length(df_col), nrow = 0))
my_walkers_matrix <- t(as.matrix(walkers))
......@@ -412,8 +410,7 @@ get_distances_along <- function(distance_strand,distance_strand_2,per_strand,foc
iter <- 0
while(iter<= no_foci-1){
iter <- iter + 1
print("looking at position data of foci number")
print(iter)
cat("\n looking at position data of foci number",iter, sep = " ")
foci_x <- strand_info$m.cx[iter]
foci_y <- strand_info$m.cy[iter]
#### finding closest point
......@@ -465,13 +462,10 @@ get_distances_along <- function(distance_strand,distance_strand_2,per_strand,foc
colnames(foci_df) <- df_col
if(x_curr == as.numeric(foci_df$foci_x_line[iter]) && y_curr == as.numeric(foci_df$foci_y_line[iter])){
### record the distance along
print("I found a focus, which is this many pixels along:")
foci_dist_along <- dist_along
print(dist_along)
print("and its distance (squared) to the actual foci centre was")
print(distance_fi)
print("and this was a pass/fail")
print(strand_test)
cat("\n I found a focus, which is this many pixels along:", dist_along, sep = " ")
cat("\n and its distance (squared) to the actual foci centre was", distance_fi, sep = " ")
cat("\n and this was a pass/fail", strand_test, sep = " ")
if(annotation == "on"){
ch1 <- bwlabel(noise_gone)
ch1 <-channel(noise_gone,"grey")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment