Biostrings icon indicating copy to clipboard operation
Biostrings copied to clipboard

Error writing long reads with writeQualityScaledXStringSet

Open ahl27 opened this issue 1 year ago • 1 comments

This is an error originally posted on the Bioconductor support site: https://support.bioconductor.org/p/9160158/#9160159

Reproducible example:

library(Biostrings)

# Manually create a simple FASTQ file
nrep <- 20001
seqs <- paste0(rep("AGCTGATCGG", nrep), collapse="")
quals <- paste0(rep("ABCDEFGHIJ", nrep), collapse="")
descs <- sprintf("@S%01d_%07d", seq_along(seqs), nchar(seqs))
fastq.txt <- c(descs, seqs, "+", quals)
fname <- "example.fastq"
writeLines(fastq.txt, fname)

# Read and write the simple FASTQ file
qs.seqs <- readQualityScaledDNAStringSet(fname)
writeQualityScaledXStringSet(qs.seqs, fname)

# Error in .Call2("write_XStringSet_to_fastq", x, filexp_list, qualities,  : 
#   XStringSet object (or derivative) to write 'x' cannot contain strings
#   longer than 200000 ('x[[1]]' has 200010 characters)

Also reportedly fails to remove the intermediate file on failure (unconfirmed).

# Warning messages:
# 1: In file.remove(expath) :
#   cannot remove file 'example.fastq', reason 'Permission denied'
# 2: In writeXStringSet(x, filepath, append, compress, compression_level,  :
#   cannot remove file 'example.fastq'

Should be addressed following latest release.

ahl27 avatar Oct 15 '24 18:10 ahl27

Fixed in PR #122

ahl27 avatar Jan 02 '25 18:01 ahl27