Skip to content

Commit ed85b26

Browse files
Support finding the reference GTF properly even for spaceranger versions > 3.0.0
Co-authored-by: Manisha Barse <[email protected]>
1 parent c82c789 commit ed85b26

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

R/read10xVisiumWrapper.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,18 @@ read10xVisiumWrapper <- function(
6060
if (missing(reference_gtf)) {
6161
summary_file <- file.path(samples[1], "web_summary.html")
6262
web <- readLines(summary_file)
63+
64+
# For spaceranger versions before 3.0
6365
reference_path <- gsub('.*"', "", regmatches(web, regexpr('\\["Reference Path", *"[/|A-z|0-9|-]+', web)))
66+
67+
# For recent spaceranger versions (3.0.0+?)
68+
if (length(reference_path) == 0) {
69+
reference_path = sub(
70+
'.*--transcriptome=(\\S*).*',
71+
'\\1',
72+
web[grep('--transcriptome=', web)]
73+
)
74+
}
6475
reference_gtf <- file.path(reference_path, "genes", "genes.gtf")
6576
}
6677
reference_gtf <- reference_gtf[file.exists(reference_gtf)]

0 commit comments

Comments
 (0)