Commit ddea3d4e authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

initial commit

parents
workDir <- "/root/rdconnect"
library(tidyr)
fraserTsvPath <- "./Output/processed_results/aberrant_splicing/results/v29/fraser/fraser/results_per_junction.tsv"
fraserRdsPath <- "./Output/processed_results/aberrant_splicing/datasets/savedObjects/fraser--v29/fds-object.RDS"
setwd(workDir)
# helper functions
# adds assay to fraser tsv
assayToDenormDF <- function(assayName, assay, tsv, gr, fds) {
df <- cbind(gr, assay)
sampleColIndices <- seq(dim(gr)[2]+1, dim(df)[2])
denorm_df <- pivot_longer(df, cols=all_of(sampleColIndices), names_to="sampleID", values_to=assayName)
newTsv <- merge(tsv, denorm_df, all.x=TRUE)
keepCols <- append(colnames(tsv), assayName)
newTsv[, keepCols]
}
# read original output file
fraserTsv <- read.table(fraserTsvPath, sep="\t", header=TRUE)
# read original binary files
fds <- readRDS(fraserRdsPath)
fds
gr <- as.data.frame(granges(fds))
# add additional assays that we are interested in to fraser tsv
fraserTsv <- assayToDenormDF("predictedMeans_psi3", assays(fds)[["predictedMeans_psi3"]], fraserTsv, gr, fds)
fraserTsv <- assayToDenormDF("pvaluesBetaBinomial_junction_psi3", assays(fds)[["pvaluesBetaBinomial_junction_psi3"]], fraserTsv, gr, fds)
fraserTsv <- assayToDenormDF("junction_count", K(fds, type = 'psi3'), fraserTsv, gr, fds)
fraserTsv <- assayToDenormDF("total_junction_count", N(fds, type = 'psi3'), fraserTsv, gr, fds)
# write new tsv
write.table(fraserTsv, sep = "\t", file = "fraser_complete_output.tsv", row.names=FALSE)
##################
##################
outriderTsvPath <- "./Output/processed_results/aberrant_expression/v29/outrider/outrider/OUTRIDER_results.tsv"
outriderRdsPath <- "./Output/processed_results/aberrant_expression/v29/outrider/outrider/ods.Rds"
outriderTsv <- read.table(outriderTsvPath, sep="\t", header=TRUE)
ods <- readRDS(outriderRdsPath)
gr <- as.data.frame(granges(ods))
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