Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pruning] Fusions patch and csv export in pgv function #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 R/gGnome.R
Original file line number Diff line number Diff line change
Expand Up @@ -3908,7 +3908,7 @@ gGraph = R6::R6Class("gGraph",
## convert to integer .. and back to snode.id
## if path does not exist get.shortest.paths (for some reason) will return a single vector with the target
## so we clean out all paths that don't have the query
v = lapply(p$vpath, function(x) {y = as.integer(x); if (length(y) == 0 | is.na(y[1]) | y[1] != query) return(c()) else return(snode.id[y])})
v = lapply(p$vpath, function(x) {y = as.integer(x); if (length(y) == 0 || is.na(y[1]) || y[1] != query) return(c()) else return(snode.id[y])})
## chop off the last interval to get the "true" distance from query to subject
if (do.trim)
{
Expand Down
18 changes: 14 additions & 4 deletions R/jsUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ is.acceptable.js.type = function(js.type){
#' @export
gen_js_coverage_files = function(data, outdir, name.col = 'sample', overwrite = FALSE, cov.col = 'coverage',
js.type = 'gGnome.js', cov.field = 'ratio', cov.field.col = NA,
bin.width = 1e4, dataset_name = NA, ref = 'hg19', gg.col = 'graph',
bin.width = 1e4, dataset_name = NA, ref = 'hg38', gg.col = 'graph',
cov.color.field = NULL, meta.js = NULL, kag.col = kag.col,
ncn.gr = ncn.gr, mc.cores = 1){
if (!is.na(cov.field.col)){
Expand Down Expand Up @@ -1082,7 +1082,7 @@ cov2csv = function(cov,
cov2arrow = function(cov,
field = "ratio",
output_file = 'coverage.arrow',
ref = 'hg19',
ref = 'hg38_chr',
cov.color.field = NULL,
overwrite = FALSE,
meta.js = NULL,
Expand Down Expand Up @@ -1126,8 +1126,18 @@ cov2arrow = function(cov,
outdt = outdt[order(x)]

message('Writing arrow file (using write_feather)')
arrow_table = arrow::Table$create(outdt, schema = arrow::schema(x = arrow::float32(), y = arrow::float32(), color = arrow::float32()))
arrow::write_feather(arrow_table, output_file)
#arrow_table = arrow::Table$create(outdt, schema = arrow::schema(x = arrow::float64(), y = arrow::float64(), color = arrow::float64()))
#arrow::write_feather(arrow_table, output_file)

arrow::write_feather(outdt, output_file)


message('Writing csv file')
#arrow_table = arrow::Table$create(outdt, schema = arrow::schema(x = arrow::float64(), y = arrow::float64(), color = arrow::float64()))
#arrow::write_feather(arrow_table, output_file)
output_csv = stringr::str_replace(output_file, "arrow", "csv")
data.table::fwrite(outdt, output_csv, sep=",")

} else {
message('arrow file, "', output_file, '" already exists.')
}
Expand Down