Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splice types #215

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion drop/modules/aberrant-expression-pipeline/OUTRIDER/results.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,29 @@ res <- res[padjust <= snakemake@params$padjCutoff &
abs(zScore) > snakemake@params$zScoreCutoff]

gene_annot_dt <- fread(snakemake@input$gene_name_mapping)

print("IN OUTRIDER RESULTS: GENE NAME MAPPING DT")
print(gene_annot_dt)

print("RES BEFORE GENE NAME MAPPING")
print(res)

if(!is.null(gene_annot_dt$gene_name)){
if(grepl('ENSG00', res[1,geneID]) & grepl('ENSG00', gene_annot_dt[1,gene_id])){
res <- merge(res, gene_annot_dt[, .(gene_id, gene_name)],
res <- merge(res, gene_annot_dt[, .(gene_id, gene_name, blacklist)],
by.x = 'geneID', by.y = 'gene_id', sort = FALSE, all.x = TRUE)
setnames(res, 'gene_name', 'hgncSymbol')
res <- cbind(res[, .(hgncSymbol)], res[, - 'hgncSymbol'])
}
}


print("RES AFTER GENE NAME MAPPING")
print(res)




# Add HPO terms, requires online connection and for there to be annotated HPO terms
sa <- fread(snakemake@config$sampleAnnotation)
if(!is.null(sa$HPO_TERMS) & nrow(res) > 0){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "00_defineDataset.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - ids: '`sm lambda w: sa.getIDsByGroup(w.dataset, assay="RNA")`'
#' - fileMappingFile: '`sm cfg.getRoot() + "/file_mapping.csv"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want the config in requirements and not as params? There should be nothing in there that could change the outcome of the results.
This goes of course also for the other scripts.

#' - sampleAnnoFile: '`sm config["sampleAnnotation"]`'
#' output:
#' - colData: '`sm cfg.getProcessedDataDir() +
Expand All @@ -23,7 +23,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

#+ input
outFile <- snakemake@output$colData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_0_init.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - colData: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/annotations/{dataset}.tsv"`'
#' output:
Expand All @@ -19,7 +19,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
colDataFile <- snakemake@input$colData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "splitReads" / "{sample_id}.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - done_fds: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/cache/raw-{dataset}/fds.done"`'
#' output:
Expand All @@ -19,7 +19,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)
library(BSgenome)

dataset <- snakemake@wildcards$dataset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_2_splitReadsMerge.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' threads: 20
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - sample_counts: '`sm lambda w: cfg.AS.getSplitCountFiles(w.dataset)`'
#' output:
#' - countsJ: '`sm cfg.getProcessedDataDir() +
Expand All @@ -23,7 +23,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
workingDir <- snakemake@params$workingDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "nonsplitReads" / "{sample_id}.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - spliceSites: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/cache/raw-{dataset}/spliceSites_splitCounts.rds"`'
#' output:
Expand All @@ -18,7 +18,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
colDataFile <- snakemake@input$colData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_4_nonSplitReadsMerge.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' threads: 20
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - sample_counts: '`sm lambda w: cfg.AS.getNonSplitCountFiles(w.dataset)`'
#' - gRangesNonSplitCounts: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/cache/raw-{dataset}/gRanges_NonSplitCounts.rds"`'
Expand All @@ -19,7 +19,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
workingDir <- snakemake@params$workingDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "01_5_collect.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - countsJ: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/raw-{dataset}/rawCountsJ.h5"`'
#' - countsSS: '`sm cfg.getProcessedDataDir() +
Expand All @@ -23,7 +23,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
workingDir <- snakemake@params$workingDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "02_PSIcalc.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' threads: 30
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - counting_done: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/raw-{dataset}/counting.done" `'
#' output:
Expand All @@ -18,7 +18,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
workingDir <- snakemake@params$workingDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "03_filter.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - theta: '`sm cfg.getProcessedDataDir()+
#' "/aberrant_splicing/datasets/savedObjects/raw-{dataset}/theta.h5"`'
#' output:
Expand All @@ -20,7 +20,9 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)
#source(snakemake@input$spliceTypeSetup, echo=FALSE)
#source(snakemake@input$addAnnotation)

opts_chunk$set(fig.width=12, fig.height=8)

Expand Down Expand Up @@ -53,5 +55,14 @@ if (params$filter == TRUE) {
message(paste("filtered to", nrow(fds), "junctions"))
}

fds <- saveFraserDataSet(fds)

# Add the junction annotations to the fds
#message("03: load db for annotation")
#txdb <- loadDb(snakemake@input$txdb)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clean up if you do not need the lines.

#seqlevelsStyle(txdb) <- seqlevelsStyle(fds)
#fds <- createFDSAnnotations(fds, txdb)
#message("03: save object after annotation")

fds <- saveFraserDataSet(fds)
file.create(snakemake@output$done)
4 changes: 2 additions & 2 deletions drop/modules/aberrant-splicing-pipeline/Counting/Summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "CountSummary.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - filter: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/{dataset}/filter.done" `'
#' output:
Expand All @@ -17,7 +17,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

suppressPackageStartupMessages({
library(cowplot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
#' wb:
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "{genomeAssembly}--{annotation}_export.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - annotation: '`sm cfg.getProcessedDataDir() + "/preprocess/{annotation}/txdb.db"`'
#' - fds_theta: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/raw-{dataset}/theta.h5"`'
Expand All @@ -17,7 +16,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)
library(AnnotationDbi)

#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "04_hyper.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' threads: 12
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - filter: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/{dataset}/filter.done" `'
#' output:
Expand All @@ -18,7 +18,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

if ("random_seed" %in% names(snakemake@config)){
rseed <- snakemake@config$random_seed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "05_fit.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' threads: 20
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - hyper: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/{dataset}/hyper.done" `'
#' output:
Expand All @@ -18,7 +18,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
workingDir <- snakemake@params$workingDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#' log:
#' - snakemake: '`sm str(tmp_dir / "AS" / "{dataset}" / "06_stats.Rds")`'
#' params:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - workingDir: '`sm cfg.getProcessedDataDir() + "/aberrant_splicing/datasets/"`'
#' threads: 20
#' input:
#' - setup: '`sm cfg.AS.getWorkdir() + "/config.R"`'
#' - fdsin: '`sm cfg.getProcessedDataDir() +
#' "/aberrant_splicing/datasets/savedObjects/{dataset}/" +
#' "predictedMeans_theta.h5"`'
Expand All @@ -20,7 +20,7 @@
#'---

saveRDS(snakemake, snakemake@log$snakemake)
source(snakemake@params$setup, echo=FALSE)
source(snakemake@input$setup, echo=FALSE)

dataset <- snakemake@wildcards$dataset
fdsFile <- snakemake@input$fdsin
Expand Down
Loading