Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Depends: R (>= 3.4.1), datasets, graphics, grDevices, methods, stats, utils, sca
License: MIT
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.1
22 changes: 14 additions & 8 deletions R/worm_cat_controller.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,26 @@
#' @param output_dir the output directory
#' @param rm_dir Boolean If FALSE do not remove temp dir. If TRUE remove temp dir
#' @param annotation_file 'straight_mmm-DD-YYYY.csv' or 'physiology_mmm-DD-YYYY.csv' the default is straight
#' @param input_type 'Sequence ID' or 'Wormbase ID' the default is Sequence ID
#' @param input_type 'Sequence.ID' or 'Wormbase.ID' the default is Sequence.ID
#' @param zip_files Boolean If TRUE will create a zipped archive of the results
#' @keywords worm cat
#' @export
#' @examples
#' worm_cat_fun()
worm_cat_fun <- function(file_to_process, title="rgs", output_dir=NULL, rm_dir=FALSE, annotation_file="physiology_jul-15-2018.csv", input_type="Sequence.ID"){
worm_cat_fun <- function(file_to_process, title="rgs", output_dir=NULL, rm_dir=FALSE, annotation_file="whole_genome_jul-03-2019.csv", input_type="Sequence.ID", zip_files=TRUE){
mainDir <- getwd()

if(is.null(output_dir)){
output_dir <- paste("worm-cat_",format(Sys.time(), "%b-%d-%Y-%H:%M:%S"), sep="")
}
output_dirPath <- paste("./",output_dir, sep="")
dir.create(file.path(mainDir, output_dir))

if(!dir.exists(output_dir)){
dir.create(file.path(mainDir, output_dir))
}

worm_cat_annotations <- system.file("extdata", annotation_file, package="wormcat")
if(!file.exists(worm_cat_annotations)){
worm_cat_annotations <- annotation_file
}

# Create the categories file
.worm_cat_add_categories(file_to_process, output_dirPath, worm_cat_annotations, input_type)
Expand Down Expand Up @@ -59,9 +64,10 @@ worm_cat_fun <- function(file_to_process, title="rgs", output_dir=NULL, rm_dir=F

cat(runtime_l,annotation_file_l,input_type_l,file=run_data,sep="\n",append=TRUE)


files2zip <- dir(output_dirPath, full.names = TRUE)
zip(zipfile = output_dir, files = files2zip)
if(zip_files){
files2zip <- dir(output_dirPath, full.names = TRUE)
zip(zipfile = output_dir, files = files2zip)
}
if(rm_dir == TRUE){
print("cleaning up")
unlink(output_dir, TRUE)
Expand Down
6 changes: 3 additions & 3 deletions R/worm_cat_fisher_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ library("plyr")

total_count <- data.frame(nrow(AC))

total_nrow <- rename(total_count, c("nrow.AC." = "nrow"))
total_nrow <- plyr::rename(total_count, c("nrow.AC." = "nrow"))

total_annotated_cat1 <- data.frame(table(AC$Category.1))

Expand All @@ -31,7 +31,7 @@ library("plyr")

RGS_count <- data.frame(nrow(RGS))

RGS_nrow <- rename(RGS_count, c("nrow.RGS." = "nrow"))
RGS_nrow <- plyr::rename(RGS_count, c("nrow.RGS." = "nrow"))

RGS_annotated_cat1 <- data.frame(table(RGS$Category.1))

Expand All @@ -50,7 +50,7 @@ library("plyr")

cat_a <- merge(UP_annotated_cat, total_annotated_cat, by = "Var1", all.x = TRUE)

cat_b <- rename(cat_a, c("Var1" = "Category", "Freq.x" = "RGS", "Freq.y" = "AC" ))
cat_b <- plyr::rename(cat_a, c("Var1" = "Category", "Freq.x" = "RGS", "Freq.y" = "AC" ))

# Step 5: Build contengency table for each category in RGS vs AC

Expand Down
19 changes: 12 additions & 7 deletions man/worm_cat_fun.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.