Skip to content

Commit

Permalink
Merge pull request #88 from Nick-Eagles/read10x_updates
Browse files Browse the repository at this point in the history
Read10x updates
  • Loading branch information
lcolladotor authored Oct 22, 2024
2 parents c82c789 + e2001c6 commit 107929e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion R/read10xVisiumWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,22 @@ read10xVisiumWrapper <- function(
if (missing(reference_gtf)) {
summary_file <- file.path(samples[1], "web_summary.html")
web <- readLines(summary_file)

# For spaceranger versions before 3.0
reference_path <- gsub('.*"', "", regmatches(web, regexpr('\\["Reference Path", *"[/|A-z|0-9|-]+', web)))
reference_gtf <- file.path(reference_path, "genes", "genes.gtf")

# For recent spaceranger versions (3.0.0+?)
if (length(reference_path) == 0) {
reference_path = sub(
'.*--transcriptome=(\\S*).*',
'\\1',
web[grep('--transcriptome=', web)]
)
}
reference_gtf <- list.files(
file.path(reference_path, "genes"), "^genes\\.gtf(\\.gz)?$",
full.names = TRUE
)
}
reference_gtf <- reference_gtf[file.exists(reference_gtf)]
if (length(reference_gtf) > 1) {
Expand Down

0 comments on commit 107929e

Please sign in to comment.