Skip to content

Commit

Permalink
try write.table instead?
Browse files Browse the repository at this point in the history
  • Loading branch information
kriemo committed Jan 22, 2024
1 parent 1bbe9d6 commit 13ce89c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: raer
Type: Package
Title: RNA editing tools in R
Version: 1.1.2
Version: 1.1.3
Authors@R: c(
person("Kent", "Riemondy", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0750-1273")),
Expand Down
19 changes: 10 additions & 9 deletions R/sc-pileup.R
Original file line number Diff line number Diff line change
Expand Up @@ -464,27 +464,28 @@ write_sparray <- function(sce, mtx_fn, sites_fn, bc_fn) {
if (!conforms) {
cli::cli_abort("nRef and nAlt sparseMatrices triplet dimensions differ")
}

mtx_fn <- gzfile(mtx_fn, 'w')
writeLines(
c(
"%%% raer MatrixMarket-like matrix coordinate integer general",
paste("%%% ", nref@Dim[1], nref@Dim[2], length(nref@x)),
"%%% x y nRef nAlt"
),
gzfile(mtx_fn)
mtx_fn
)

mtx <- matrix(0L, nrow = dim(nref_trpl)[1], ncol = 4L)
mtx <- cbind(nref_trpl, nalt = nalt_trpl$x)

data.table::fwrite(mtx, mtx_fn,
append = TRUE,
write.table(mtx,
mtx_fn,
sep = " ",
row.names = FALSE,
col.names = FALSE,
showProgress = FALSE
quote = FALSE
)

close(mtx_fn)

sites <- data.frame(
seq_along(sce),
seqnames(sce),
Expand All @@ -494,11 +495,11 @@ write_sparray <- function(sce, mtx_fn, sites_fn, bc_fn) {
rowData(sce)$ALT
)

data.table::fwrite(sites, sites_fn,
write.table(sites,
gzfile(sites_fn),
sep = "\t",
row.names = FALSE,
col.names = FALSE,
showProgress = FALSE
col.names = FALSE
)

writeLines(colnames(sce), gzfile(bc_fn))
Expand Down

0 comments on commit 13ce89c

Please sign in to comment.