## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----eval=TRUE, echo=TRUE----------------------------------------------------- temp_path <- tempfile() bfc <- BiocFileCache::BiocFileCache(temp_path, ask = FALSE) file_url <- "https://raw.githubusercontent.com/OliverVoogd/FLAMESData/master/data" annot <- bfc[[names(BiocFileCache::bfcadd( bfc, "Annotation", file.path(file_url, "gencodeshortened.gtf") ))]] genome_fa <- bfc[[names(BiocFileCache::bfcadd( bfc, "Genomefa", file.path(file_url, "GRCh38shortened.fa") ))]] fastq <- bfc[[names(BiocFileCache::bfcadd( bfc, "Fastq", file.path(file_url, "sc_align2genome.sample.fastq.gz")))]] # setup other environment variables outdir <- tempfile() dir.create(outdir) config_file <- FLAMES::create_config(outdir, type = "SIRV", do_barcode_demultiplex = TRUE) ## ----eval=FALSE, echo=TRUE---------------------------------------------------- # library(FLAMES) # # do not run if minimap2 cannot be found # if (!any(is.na(find_bin(c("minimap2", "k8"))))) { # sce <- sc_long_pipeline( # annotation = annot, fastq = fastq, genome_fa = genome_fa, # outdir = outdir, config_file = config_file, expect_cell_number = 10) # } ## ----eval=FALSE, echo=TRUE---------------------------------------------------- # library(FLAMES) # # do not run if minimap2 cannot be found # if (!any(is.na(find_bin(c("minimap2", "k8"))))) { # config <- jsonlite::fromJSON(config_file) # # find_barcode(...) # genome_bam <- rownames(minimap2_align( # config = config, fa_file = genome_fa, fq_in = fastq, annot = annot, # outdir = outdir # )) # find_isoform( # annotation = annot, genome_fa = genome_fa, # genome_bam = genome_bam, outdir = outdir, config = config # ) # minimap2_realign( # config = config, fq_in = fastq, # outdir = outdir # ) # quantify_transcript(annotation = annot, outdir = outdir, config = config) # sce <- create_sce_from_dir(outdir = outdir, annotation = annot) # } ## ----eval=TRUE, message=FALSE, warning=FALSE, fig.width=15, fig.height=10, dpi=36---- library(FLAMES) library(SingleCellExperiment) # just the transcript counts scmixology_lib10_transcripts |> scuttle::logNormCounts() |> scater::runPCA() |> scater::runUMAP() |> plot_isoform_reduced_dim('ENSG00000108107') # SCE with gene counts as main assay and transcript counts as altExp scmixology_lib10 <- scmixology_lib10[, colSums(counts(scmixology_lib10)) > 0] sce_lr <- scmixology_lib10[, colnames(scmixology_lib10) %in% colnames(scmixology_lib10_transcripts)] altExp(sce_lr, "transcript") <- scmixology_lib10_transcripts[, colnames(sce_lr)] sce_lr |> scuttle::logNormCounts() |> scater::runPCA() |> scater::runUMAP() |> plot_isoform_reduced_dim('ENSG00000108107') ## ----eval=TRUE, message=FALSE, warning=FALSE, fig.width=15, fig.height=10, dpi=36---- combined_sce <- combine_sce(sce_lr, scmixology_lib90) combined_sce <- combined_sce |> scuttle::logNormCounts() |> scater::runPCA() |> scater::runUMAP() # plot without imputation plot_isoform_reduced_dim(combined_sce, 'ENSG00000108107') # impute missing transcript counts combined_sce_impute <- sc_impute_transcript(combined_sce) plot_isoform_reduced_dim(combined_sce_impute, 'ENSG00000108107') ## ----eval=TRUE, echo=TRUE----------------------------------------------------- temp_path <- tempfile() bfc <- BiocFileCache::BiocFileCache(temp_path, ask = FALSE) file_url <- "https://raw.githubusercontent.com/OliverVoogd/FLAMESData/master/data" annot <- bfc[[names(BiocFileCache::bfcadd( bfc, "Annotation", file.path(file_url, "SIRV_isoforms_multi-fasta-annotation_C_170612a.gtf") ))]] genome_fa <- bfc[[names(BiocFileCache::bfcadd( bfc, "Genomefa", file.path(file_url, "SIRV_isoforms_multi-fasta_170612a.fasta") ))]] # download the two fastq files, move them to a folder to be merged together fastq1 <- bfc[[names(BiocFileCache::bfcadd(bfc, "Fastq1", file.path(file_url, "fastq", "sample1.fastq.gz")))]] fastq2 <- bfc[[names(BiocFileCache::bfcadd(bfc, "Fastq2", file.path(file_url, "fastq", "sample2.fastq.gz")))]] # the downloaded fastq files need to be in a directory to be merged together fastq_dir <- file.path(temp_path, "fastq_dir") dir.create(fastq_dir) file.copy(c(fastq1, fastq2), fastq_dir) unlink(c(fastq1, fastq2)) # the original files can be deleted # setup other environment variables outdir <- tempfile() dir.create(outdir) config_file <- FLAMES::create_config(outdir) ## ----eval=FALSE, echo=TRUE---------------------------------------------------- # library(FLAMES) # if (!any(is.na(find_bin(c("minimap2", "k8"))))) { # summarizedExperiment <- bulk_long_pipeline( # annot = annot, fastq = fastq_dir, outdir = outdir, # genome_fa = genome_fa, config_file = config_file # ) # } ## ----echo=FALSE--------------------------------------------------------------- utils::sessionInfo()