Skip to content

Commit

Permalink
make rRNA optional when reading metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
lpantano committed Jan 15, 2025
1 parent 680df7c commit 349fc06
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
26 changes: 14 additions & 12 deletions inst/templates/rnaseq/00_libs/load_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ load_metrics <- function(se_object, multiqc_data_dir, gtf_fn, counts){

# Sometimes we don't have rRNA due to mismatch annotation, We skip this if is the case
gtf <- NULL
biotype <- NULL

if (genome =="other"){
gtf <- gtf_fn
}else{
Expand All @@ -60,20 +62,20 @@ load_metrics <- function(se_object, multiqc_data_dir, gtf_fn, counts){
}
if (is.null(gtf)) {
warning("No genome provided! Please add it at the top of this Rmd")
}

gtf=rtracklayer::import(gtf)

one=grep("gene_type", colnames(as.data.frame(gtf)), value = TRUE)
another=grep("gene_biotype", colnames(as.data.frame(gtf)), value = TRUE)
biotype=NULL
if(length(one)==1){
biotype=one
}else if(length(another)==1){
biotype=another
}else{
warning("No gene biotype founded")
gtf=rtracklayer::import(gtf)

one=grep("gene_type", colnames(as.data.frame(gtf)), value = TRUE)
another=grep("gene_biotype", colnames(as.data.frame(gtf)), value = TRUE)
if(length(one)==1){
biotype=one
}else if(length(another)==1){
biotype=another
}else{
warning("No gene biotype founded")
}
}

metrics$sample <- make.names(metrics$sample)
if (!is.null(biotype)){
annotation=as.data.frame(gtf) %>% .[,c("gene_id", biotype)]
Expand Down
9 changes: 5 additions & 4 deletions inst/templates/rnaseq/01_quality_assesment/params_qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

# Your data
# This is the file used to run nf-core or compatible to that
coldata_fn='/Path/to/metadata/meta.csv'
coldata_fn <- '/Path/to/metadata/meta.csv'
# This file is inside star_salmon/ folder
counts_fn='/path/to/nf-core/output/star_salmon/salmon.merged.gene_counts.tsv'
counts_fn <- '/path/to/nf-core/output/star_salmon/salmon.merged.gene_counts.tsv'
# This folder called "multiqc_report_data" is inside the output directory star_salmon inside multiqc folder
multiqc_data_dir='/path/to/nf-core/output/multiqc/star_salmon/multiqc_report_data'
multiqc_data_dir <- '/path/to/nf-core/output/multiqc/star_salmon/multiqc_report_data'
# This file is inside the genome folder in the output directory, use this only for non-model organism
# gtf_fn='/path/to/nf-core/output/genome/hg38.filtered.gtf'
se_object = NA
gtf_fn <- NULL
se_object <- NA

0 comments on commit 349fc06

Please sign in to comment.