Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
RD-Connect
rdconnect-r
Commits
ddea3d4e
Commit
ddea3d4e
authored
Jul 26, 2021
by
Sascha Herzinger
Browse files
initial commit
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
process.R
0 → 100644
View file @
ddea3d4e
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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment