Skip to content

Commit

Permalink
Added TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
renewiegandt committed Apr 5, 2019
1 parent bce6e1b commit 2e14753
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions bin/2.2_motif_estimation/png_to_pdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ png_to_pdf <- function(png_top, png_list, cluster_ids, new_id, out = "cluster.pd
grobs <- lapply(png_split,function(p){rasterGrob(readPNG(p),interpolate = FALSE)})

split_grobs <- split(grobs, rep(1:ceiling(length(grobs)/3), each = 3)[1:length(grobs)])

rows <- lapply(seq(1,length(split_grobs)), function(sg){
arrangeGrob(grobs = split_grobs[[sg]], top = textGrob(paste0("Cluster ",cluster_list[sg]),gp = gpar(fontsize = 20,font = 3)), ncol = 3)
})
split_rows <- split(rows, rep(1:ceiling(length(rows)/4), each = 4)[1:length(rows)])

pdf(out,width = 17, height = 11)
grid.arrange(grobs = top_grob, nrow = 3, top = textGrob(paste0("New Cluster ",new_id),gp = gpar(fontsize = 30,font = 3)))
lapply(split_rows, function(r){
grid.arrange(grobs = r, nrow = 4, top = textGrob("Generated from...",gp = gpar(fontsize = 30,font = 3)))
grid.arrange(grobs = r, nrow = 4, top = textGrob("Generated from...",gp = gpar(fontsize = 30,font = 3)))
})

dev.off()
Expand All @@ -68,27 +68,25 @@ get_index <- function(index_file){
index <- f[,c(2,8)]
index$V8 <- strsplit(index$V8,",")
return(index[unlist(lapply(index$V8, function(v){ifelse(length(v) > 1, TRUE, FALSE)}))])

}

}

@TODO
png_to_pdf_set_up <- function(png_top, png_list, index_file){

index <- get_index(index_file)
t <- lapply(seq(nrow(index)), function(i){
new_id <- index[i,1]
cluster_ids <- index[i,2]
out <- paste0("Summary_cluster_", new_id, ".pdf")
png_to_pdf(png_top = ,png_list = ,cluster_ids = cluster_ids, new_id = new_id, out = out )
#regex_png <- paste0("*_cluster_", new_id , "/logo${NUM}.png") #????
png_to_pdf(png_top = "TODO" ,png_list = "TODO" ,cluster_ids = cluster_ids, new_id = new_id, out = out )
})

}


# run function merge_similar with given parameteres if not in interactive context (e.g. run from shell)
if (!interactive()) {
png_to_pdf_set_up(opt$png_new, opt$png_old , opt$index)
}



0 comments on commit 2e14753

Please sign in to comment.