Skip to content

Commit

Permalink
Support finding the reference GTF properly even for spaceranger versi…
Browse files Browse the repository at this point in the history
…ons > 3.0.0

Co-authored-by: Manisha Barse <[email protected]>
  • Loading branch information
Nick-Eagles and manishabarse committed Oct 11, 2024
1 parent c82c789 commit ed85b26
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/read10xVisiumWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ 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)))

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

0 comments on commit ed85b26

Please sign in to comment.