Commit e37fd465 authored by Lucy McNeill's avatar Lucy McNeill
Browse files

only remaining CMD check warning relates to libraries. No undefined variables anymore

parent bd9dfead
No preview for this file type
......@@ -2,11 +2,11 @@ Package: synapsis
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: Who wrote it
Author: Lucy McNeill
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: What license is it under?
License: GPL (>=3)
Encoding: UTF-8
LazyData: true
Imports:
......@@ -15,3 +15,6 @@ Imports:
graphics,
utils
RoxygenNote: 7.1.1
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
......@@ -7,8 +7,17 @@
#' @import graphics
#' @import utils
#' @export auto_crop
#' @param file_list The file list
#' @param img_path The path
#' @param img_path, The path
#' @param max_cell_area, description
#' @param min_cell_area, description
#' @param mean_pix, description
#' @param annotation, description
#' @param blob_factor, description
#' @param bg_blob_factor, description
#' @param offset, description
#' @param final_blob_amp, description
#' @param test_amount, description
#' @return cropped SC and foci channels around single cells, regardless of stage
......@@ -33,7 +42,6 @@ auto_crop <- function(img_path, max_cell_area = 20000, min_cell_area = 7000, me
print(file)
file_base = file
filename_path_test = paste0(img_path,"/", file)
print(filename_path_test)
file = filename_path_test
if(grepl("*DAPI.jpeg$", file)){
file_DAPI = file
......@@ -121,6 +129,11 @@ print("viable cells")
#' @import EBImage
#' @export
#' @param img_orig Original image
#' @param blob_factor, description
#' @param bg_blob_factor, description
#' @param offset, description
#' @param final_blob_amp, description
#' @return Mask with cell candidates
#################################### new function ####################################
......@@ -161,16 +174,12 @@ get_blobs <- function(img_orig, blob_factor, bg_blob_factor, offset,final_blob_a
#' @import EBImage
#' @export
#' @param candidate Mask of individual cell candidates
#' @param max_cell_area, description
#' @param min_cell_area, description
#' @return Mask of cell candidates which meet size criteria
keep_cells <- function(candidate, max_cell_area, min_cell_area){
# input:
# output:
# delete everything that's too small
colorimg<- colorLabels(candidate, normalize = TRUE)
x <- computeFeatures.shape(candidate)
......@@ -208,6 +217,24 @@ keep_cells <- function(candidate, max_cell_area, min_cell_area){
#' @import EBImage
#' @export
#' @param retained Mask of cell candidates which meet size criteria
#' @param OOI_final, description
#' @param counter_final, description
#' @param img_orig, description
#' @param img_orig_foci, description
#' @param img_orig_DAPI, description
#' @param file_dna, description
#' @param file_foci, description
#' @param file_DAPI, description
#' @param cell_count, description
#' @param mean_pix, description
#' @param annotation, description
#' @param file_base, description
#' @param img_path, description
#'
#' @return Crops aroudn all candidates in both channels
#'
crop_single_object <- function(retained, OOI_final,counter_final,img_orig,img_orig_foci,img_orig_DAPI,file_dna,file_foci,file_DAPI,cell_count, mean_pix, annotation, file_base, img_path){
......@@ -242,9 +269,8 @@ crop_single_object <- function(retained, OOI_final,counter_final,img_orig,img_or
# I think this is quick enough for now.. takes less than 10s...
xx = data.frame(as.numeric(tmp_img))
xx <- data.frame(bwlabel(tmp_img))
xm2 = t(as.matrix(xx))
my_matrix = t(as.matrix(xx))
i <- 0
my_matrix <- xm2
### now loop over matrix
for(row in 1:nrow(my_matrix)) {
for(col in 1:ncol(my_matrix)) {
......
......@@ -7,7 +7,15 @@
#' @import graphics
#' @import utils
#' @export count_foci
#' @param file_list list of files
#' @param img_path, path of crops
#' @param stage, description
#' @param offset_px, description
#' @param offset_factor, description
#' @param brush_size, description
#' @param brush_sigma, description
#' @param foci_norm, description
#' @param annotate, description
#' @return foci count per cell
......
......@@ -7,8 +7,12 @@
#' @import graphics
#' @import utils
#' @export get_pachytene
#' @param file_list The file list
#' @param img_path The path
#' @param species_num, description
#' @param offset, description
#' @param ecc_thresh, description
#' @param area_thresh, description
#' @return Pairs of foci and SC channel crops for pachytene
......
......@@ -4,8 +4,17 @@
#'
#' @import EBImage
#' @export
#' @param file_list The file list
#' @param img_path The path
#' @param offset_px, description
#' @param offset_factor, description
#' @param brush_size, description
#' @param brush_sigma, description
#' @param foci_norm, description
#' @param annotate, description
#' @param offset_SC, description
#' @param stage, description
#' @param eccentricity_min, description
#' @param max_strand_area, description
#' @return Histogram of distances
# should take in same values as count_foci..
......@@ -192,7 +201,9 @@ threshold_SC_crop <- function(image, offset){
#' Creates mask for foci channel
#'
#' @param image foci channel image
#' @param offset offset for a foci signal
#' @param offset_factor offset for a foci signal
#' @param brush_size, description
#' @param brush_sigma, description
#' @return A black white mask with foci as objects
#'
threshold_foci_crop <- function(image, offset_factor, brush_size, brush_sigma){
......@@ -222,14 +233,18 @@ threshold_foci_crop <- function(image, offset_factor, brush_size, brush_sigma){
#'
#' Creates mask for SC channel
#'
#' @param strands A black white mask with SCs as objects
#' @param num_strands offset for an SC signal
#' @param new_img hello
#' @param foci_label A black white mask with foci as objects
#' @param dimensionless_dist hello
#' @param SC_lengths hello
#' @param foci_count_strand hello
#' @param strand_iter hello
#' @param strands, A black white mask with SCs as objects
#' @param num_strands, description
#' @param new_img, description
#' @param foci_label, A black white mask with foci as objects
#' @param SC_lengths, description
#' @param foci_count_strand, description
#' @param strand_iter, description
#' @param file, description
#' @param annotate, description
#' @param eccentricity_min, description
#' @param max_strand_area, description
#' @return A list of distances
#'
get_distance <- function(strands,num_strands,new_img,foci_label, SC_lengths, foci_count_strand, strand_iter,file,annotate, eccentricity_min, max_strand_area){
......@@ -513,6 +528,12 @@ get_first_dir <- function(noise_gone,ix,iy,window){
#' Moves one pixel away from the starting point
#'
#' @param chosen_dir The brightest direction of a line passing through starting point
#' @param ix1, description
#' @param ix2, description
#' @param iy1, description
#' @param iy2, description
#' @param distance_strand, description
#' @param distance_strand_2, description
#' @return New sub square for first and second branch
first_shot_out <- function(chosen_dir, ix1,ix2,iy1,iy2,distance_strand, distance_strand_2){
......@@ -585,7 +606,15 @@ first_shot_out <- function(chosen_dir, ix1,ix2,iy1,iy2,distance_strand, distance
#'
#' Moves one pixel away one first branch
#'
#' @param new_square_1, description
#' @param ix1, description
#' @param iy1, description
#' @param dir_1, description
#' @param window, description
#' @param chosen_dir The brightest direction of the previous step
#' @param distance_strand, description
#' @param first_dir, description
#' @return New sub square for first branch after taking one step
#'
get_next_first_dir <- function(new_square_1,ix1,iy1,dir_1,window,chosen_dir,distance_strand,first_dir){
......@@ -910,11 +939,21 @@ get_next_first_dir <- function(new_square_1,ix1,iy1,dir_1,window,chosen_dir,dist
#' get_next_second_dir
#'
#' Moves one pixel away one second branch. Terminates if at the end of the SC.
#'
#' @param new_square_2, description
#' @param ix2, description
#' @param iy2, description
#' @param dir_2, description
#' @param window, description
#' @param chosen_dir The brightest direction of the previous step
#' @param distance_strand_2, description
#' @param second_dir, description
#' @return New sub square for second branch after taking one step
#'
......@@ -1190,7 +1229,24 @@ get_next_second_dir <- function(new_square_2,ix2,iy2,dir_2,window,chosen_dir,dis
#'
#' Calculates the pixel distance
#'
#' @param chosen_dir The brightest direction of the previous step
#' @param distance_strand, description
#' @param distance_strand_2, description
#' @param per_strand, description
#' @param foci_label, description
#' @param walkers, description
#' @param noise_gone, description
#' @param start_x, description
#' @param start_y, description
#' @param start_x2, description
#' @param start_y2, description
#' @param start_dir, description
#' @param cx, description
#' @param cy, description
#' @param mean_x, description
#' @param mean_y, description
#' @param strand_iter, description
#' @param file, description
#' @param annotate, description
#' @return List of fractional distances between foci for all SCs with two. Optional: total distances of SCs. Optional: images of all resulting traces/ foci locations.
#'
get_distance_between_two <- function(distance_strand,distance_strand_2,per_strand,foci_label, walkers, noise_gone,start_x,start_y,start_x2,start_y2,start_dir,cx,cy,mean_x,mean_y,strand_iter,file,annotate){
......
......@@ -6,16 +6,37 @@
\usage{
auto_crop(
img_path,
crop_method = "regular",
max_cell_area = 20000,
min_cell_area = 7000,
mean_pix = 0.08
mean_pix = 0.08,
annotation = "off",
blob_factor = 15,
bg_blob_factor = 10,
offset = 0.2,
final_blob_amp = 10,
test_amount = 0
)
}
\arguments{
\item{img_path}{The path}
\item{img_path, }{The path}
\item{file_list}{The file list}
\item{max_cell_area, }{description}
\item{min_cell_area, }{description}
\item{mean_pix, }{description}
\item{annotation, }{description}
\item{blob_factor, }{description}
\item{bg_blob_factor, }{description}
\item{offset, }{description}
\item{final_blob_amp, }{description}
\item{test_amount, }{description}
}
\value{
cropped SC and foci channels around single cells, regardless of stage
......
......@@ -16,7 +16,21 @@ count_foci(
)
}
\arguments{
\item{file_list}{list of files}
\item{img_path, }{path of crops}
\item{stage, }{description}
\item{offset_px, }{description}
\item{offset_factor, }{description}
\item{brush_size, }{description}
\item{brush_sigma, }{description}
\item{foci_norm, }{description}
\item{annotate, }{description}
}
\value{
foci count per cell
......
......@@ -15,11 +15,40 @@ crop_single_object(
file_foci,
file_DAPI,
cell_count,
mean_pix
mean_pix,
annotation,
file_base,
img_path
)
}
\arguments{
\item{retained}{Mask of cell candidates which meet size criteria}
\item{OOI_final, }{description}
\item{counter_final, }{description}
\item{img_orig, }{description}
\item{img_orig_foci, }{description}
\item{img_orig_DAPI, }{description}
\item{file_dna, }{description}
\item{file_foci, }{description}
\item{file_DAPI, }{description}
\item{cell_count, }{description}
\item{mean_pix, }{description}
\item{annotation, }{description}
\item{file_base, }{description}
\item{img_path, }{description}
}
\value{
Crops aroudn all candidates in both channels
......
......@@ -16,6 +16,18 @@ first_shot_out(
}
\arguments{
\item{chosen_dir}{The brightest direction of a line passing through starting point}
\item{ix1, }{description}
\item{ix2, }{description}
\item{iy1, }{description}
\item{iy2, }{description}
\item{distance_strand, }{description}
\item{distance_strand_2, }{description}
}
\value{
New sub square for first and second branch
......
......@@ -4,10 +4,18 @@
\alias{get_blobs}
\title{get_blobs}
\usage{
get_blobs(img_orig, crop_method = "regular")
get_blobs(img_orig, blob_factor, bg_blob_factor, offset, final_blob_amp)
}
\arguments{
\item{img_orig}{Original image}
\item{blob_factor, }{description}
\item{bg_blob_factor, }{description}
\item{offset, }{description}
\item{final_blob_amp, }{description}
}
\value{
Mask with cell candidates
......
......@@ -9,30 +9,37 @@ get_distance(
num_strands,
new_img,
foci_label,
dimensionless_dist,
SC_lengths,
foci_count_strand,
strand_iter,
file,
annotate
annotate,
eccentricity_min,
max_strand_area
)
}
\arguments{
\item{strands}{A black white mask with SCs as objects}
\item{strands, }{A black white mask with SCs as objects}
\item{num_strands}{offset for an SC signal}
\item{num_strands, }{description}
\item{new_img}{hello}
\item{new_img, }{description}
\item{foci_label}{A black white mask with foci as objects}
\item{foci_label, }{A black white mask with foci as objects}
\item{dimensionless_dist}{hello}
\item{SC_lengths, }{description}
\item{SC_lengths}{hello}
\item{foci_count_strand, }{description}
\item{foci_count_strand}{hello}
\item{strand_iter, }{description}
\item{strand_iter}{hello}
\item{file, }{description}
\item{annotate, }{description}
\item{eccentricity_min, }{description}
\item{max_strand_area, }{description}
}
\value{
A list of distances
......
......@@ -21,13 +21,46 @@ get_distance_between_two(
mean_x,
mean_y,
strand_iter,
dimensionless_dist,
file,
annotate
)
}
\arguments{
\item{chosen_dir}{The brightest direction of the previous step}
\item{distance_strand, }{description}
\item{distance_strand_2, }{description}
\item{per_strand, }{description}
\item{foci_label, }{description}
\item{walkers, }{description}
\item{noise_gone, }{description}
\item{start_x, }{description}
\item{start_y, }{description}
\item{start_x2, }{description}
\item{start_y2, }{description}
\item{start_dir, }{description}
\item{cx, }{description}
\item{cy, }{description}
\item{mean_x, }{description}
\item{mean_y, }{description}
\item{strand_iter, }{description}
\item{file, }{description}
\item{annotate, }{description}
}
\value{
List of fractional distances between foci for all SCs with two. Optional: total distances of SCs. Optional: images of all resulting traces/ foci locations.
......
......@@ -16,7 +16,21 @@ get_next_first_dir(
)
}
\arguments{
\item{new_square_1, }{description}
\item{ix1, }{description}
\item{iy1, }{description}
\item{dir_1, }{description}
\item{window, }{description}
\item{chosen_dir}{The brightest direction of the previous step}
\item{distance_strand, }{description}
\item{first_dir, }{description}
}
\value{
New sub square for first branch after taking one step
......
......@@ -16,7 +16,21 @@ get_next_second_dir(
)
}
\arguments{
\item{new_square_2, }{description}
\item{ix2, }{description}
\item{iy2, }{description}
\item{dir_2, }{description}
\item{window, }{description}
\item{chosen_dir}{The brightest direction of the previous step}
\item{distance_strand_2, }{description}
\item{second_dir, }{description}
}
\value{
New sub square for second branch after taking one step
......
......@@ -15,7 +15,13 @@ get_pachytene(
\arguments{
\item{img_path}{The path}
\item{file_list}{The file list}
\item{species_num, }{description}
\item{offset, }{description}
\item{ecc_thresh, }{description}
\item{area_thresh, }{description}
}
\value{
Pairs of foci and SC channel crops for pachytene
......
......@@ -8,6 +8,10 @@ keep_cells(candidate, max_cell_area, min_cell_area)
}
\arguments{
\item{candidate}{Mask of individual cell candidates}
\item{max_cell_area, }{description}
\item{min_cell_area, }{description}
}
\value{
Mask of cell candidates which meet size criteria
......
......@@ -7,19 +7,39 @@
measure_distances(
img_path,
offset_px = 0.2,
offset_factor = 2,
offset_factor = 3,
brush_size = 3,
brush_sigma = 3,
foci_norm = 0.01,
annotate = "off",
offset_SC = 0.2,
stage = "pachytene"
stage = "pachytene",
eccentricity_min = 0.6,
max_strand_area = 300
)
}
\arguments{
\item{img_path}{The path}
\item{file_list}{The file list}
\item{offset_px, }{description}
\item{offset_factor, }{description}
\item{brush_size, }{description}
\item{brush_sigma, }{description}
\item{foci_norm, }{description}
\item{annotate, }{description}
\item{offset_SC, }{description}
\item{stage, }{description}
\item{eccentricity_min, }{description}
\item{max_strand_area, }{description}
}
\value{
Histogram of distances
......
......@@ -9,7 +9,11 @@ threshold_foci_crop(image, offset_factor, brush_size, brush_sigma)
\arguments{
\item{image}{foci channel image}
\item{offset}{offset for a foci signal}
\item{offset_factor}{offset for a foci signal}