Commit 9c0a92d1 authored by Lena Hersemann's avatar Lena Hersemann

fixed bug: put gtf_file related code into if statement (...

fixed bug: put gtf_file related code into if statement ( if(!is.null(gtf_file)) ) in order to run script without providing a gtf file
parent cf64df51
......@@ -42,7 +42,7 @@ Options:
--gene_info <info_file> Gene information file downloaded from the ensembl website if bioMart version is not present
--betaprior <boolean> Apply betaprior when running DESeq2 [default: TRUE]
--sub_data <boolean> Subset de_results by contrasts and store the data in a subfolder [default: FALSE]
--gtf <gtf_file> Path to a GTF file, preferably the same used for read counting.
--gtf <gtf_file> Path to a GTF file, preferably the same used for read counting.
'
#commandArgs <- function(x) c("--design", "'batch+condition'", "--contrasts", "../contrasts.txt star_counts_matrix_reduced_sampleset.txt", "basic_design_reduced_sampleset.txt")
......@@ -675,26 +675,26 @@ select <- dplyr::select
## import gtf
# if(!file.exists(gene.model)) stop(paste("GTF File:", gene.model, " does NOT exist. Run with: \n", runstr))
gtf <- import.gff(
gtf_file,
format = "gtf",
feature.type = "exon"
)
txdb <- makeTxDbFromGRanges(gtf)
exons <- exonsBy(
txdb,
by = "gene"
)
genes <- genes(txdb) ## genomic coordinates of genes
## after filtering only a subset of genes remains
## genes in the GRangesList must match the number of genes in dds
exons <- exons[names(exons) %in% rownames(assay(dds))]
rowRanges(dds) <- exons
if(!is.null(gtf_file)){
gtf <- import.gff(
gtf_file,
format = "gtf",
feature.type = "exon"
)
txdb <- makeTxDbFromGRanges(gtf)
exons <- exonsBy(
txdb,
by = "gene"
)
genes <- genes(txdb) ## genomic coordinates of genes
## after filtering only a subset of genes remains
## genes in the GRangesList must match the number of genes in dds
exons <- exons[names(exons) %in% rownames(assay(dds))]
rowRanges(dds) <- exons
}
# Load transcriptome annotations needed for results annotation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment