Skip to content

Commit

Permalink
Merge pull request #38 from wkumler/enc_hotfix
Browse files Browse the repository at this point in the history
Fixed encoding usage for multi-encoding files
  • Loading branch information
wkumler authored Jun 27, 2024
2 parents 04ce48a + 17f9709 commit 89c01b7
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

*.mzML
*.mzXML
*.sqlite
*.parquet

.Rproj.user
README.Rmd
Expand Down
11 changes: 8 additions & 3 deletions R/grabMzxmlFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,22 @@ grabMzxmlSpectraVoltage <- function(xml_nodes){

grabMzxmlSpectraMzInt <- function(xml_nodes, file_metadata){
all_peak_nodes <- xml2::xml_text(xml2::xml_find_all(xml_nodes, xpath = "d1:peaks"))
vals <- lapply(all_peak_nodes, function(binary){
init_peak_encs <- xml2::xml_attr(xml2::xml_find_all(xml_nodes, xpath = "d1:peaks"), "compressionType")
all_peak_encs <- rep("none", length(init_peak_encs))
all_peak_encs[init_peak_encs=="zlib"] <- "gzip"
all_peak_encs[init_peak_encs=="zlib compression"] <- "gzip"

vals <- mapply(function(binary, encoding_i){
if(!nchar(binary))return(matrix(ncol = 2, nrow = 0))
decoded_binary <- base64enc::base64decode(binary)
raw_binary <- as.raw(decoded_binary)
decomp_binary <- memDecompress(raw_binary, type = file_metadata$compression)
decomp_binary <- memDecompress(raw_binary, type = encoding_i)
final_binary <- readBin(decomp_binary, what = "numeric",
n=length(decomp_binary)/file_metadata$precision,
size = file_metadata$precision,
endian = file_metadata$endi_enc)
matrix(final_binary, ncol = 2, byrow = TRUE)
})
}, all_peak_nodes, all_peak_encs)
}


Expand Down
Binary file modified vignettes/figures/ssc_vignette_renders/make_time_gp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified vignettes/figures/ssc_vignette_renders/multichrom_gp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified vignettes/figures/ssc_vignette_renders/par_time_gp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified vignettes/figures/ssc_vignette_renders/query_time_gp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified vignettes/figures/ssc_vignette_renders/size_cons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vignettes/figures/ssc_vignette_renders/size_list.rds
Binary file not shown.
Binary file modified vignettes/figures/ssc_vignette_renders/sum_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vignettes/speed_size_comparison.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vignette: >
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval=FALSE)
knitr::opts_chunk$set(echo = TRUE, eval=TRUE)
options(rmarkdown.html_vignette.check_title = FALSE)
data.table::setDTthreads(2)
```
Expand Down

0 comments on commit 89c01b7

Please sign in to comment.