Mercurial > repos > iuc > isoformswitchanalyzer
diff IsoformSwitchAnalyzeR.R @ 1:2c4e879a81cf draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/isoformswitchanalyzer commit 7d278967f9c8d2c6ce0a8f83be2c444822746bbf
author | iuc |
---|---|
date | Fri, 19 May 2023 21:26:00 +0000 |
parents | f3fefb6d8254 |
children | 2b0a6af4b85e |
line wrap: on
line diff
--- a/IsoformSwitchAnalyzeR.R Tue Jan 24 18:37:14 2023 +0000 +++ b/IsoformSwitchAnalyzeR.R Fri May 19 21:26:00 2023 +0000 @@ -4,6 +4,8 @@ warn.conflicts = FALSE) library(argparse, quietly = TRUE, warn.conflicts = FALSE) library(dplyr, quietly = TRUE, warn.conflicts = FALSE) +library(ggplot2, quietly = TRUE, warn.conflicts = FALSE) + # setup R error handling to go to stderr options( @@ -740,7 +742,7 @@ file = outputFile, onefile = FALSE, height = 6, - width = 9 + width = 12 ) consequenceSummary <- extractConsequenceSummary( @@ -835,7 +837,7 @@ file = outputFile, onefile = FALSE, height = 6, - width = 9 + width = 12 ) splicingSummary <- extractSplicingSummary( SwitchList, @@ -863,34 +865,37 @@ ### Volcano like plot: outputFile <- file.path(getwd(), "volcanoPlot.pdf") + pdf( file = outputFile, onefile = FALSE, height = 6, width = 9 ) - ggplot(data = SwitchList$isoformFeatures, aes(x = dIF, y = -log10(isoform_switch_q_value))) + - geom_point(aes(color = abs(dIF) > 0.1 & - isoform_switch_q_value < 0.05), # default cutoff - size = 1) + + + p <- ggplot(data = SwitchList$isoformFeatures, aes(x = dIF, y = -log10(isoform_switch_q_value))) + + geom_point( + aes(color = abs(dIF) > 0.1 & isoform_switch_q_value < 0.05), # default cutoff + size = 1 + ) + geom_hline(yintercept = -log10(0.05), linetype = "dashed") + # default cutoff geom_vline(xintercept = c(-0.1, 0.1), linetype = "dashed") + # default cutoff facet_wrap(~ condition_2) + + #facet_grid(condition_1 ~ condition_2) + # alternative to facet_wrap if you have overlapping conditions scale_color_manual("Signficant\nIsoform Switch", values = c("black", "red")) + labs(x = "dIF", y = "-Log10 ( Isoform Switch Q Value )") + theme_bw() + print(p) dev.off() - ### Switch vs Gene changes: outputFile <- file.path(getwd(), "switchGene.pdf") pdf( file = outputFile, - onefile = FALSE, height = 6, width = 9 ) - ggplot(data = SwitchList$isoformFeatures, + p <- ggplot(data = SwitchList$isoformFeatures, aes(x = gene_log2_fold_change, y = dIF)) + geom_point(aes(color = abs(dIF) > 0.1 & isoform_switch_q_value < 0.05), @@ -901,6 +906,7 @@ scale_color_manual("Signficant\nIsoform Switch", values = c("black", "red")) + labs(x = "Gene log2 fold change", y = "dIF") + theme_bw() + print(p) dev.off() outputFile <- file.path(getwd(), "splicingGenomewide.pdf") @@ -908,12 +914,12 @@ file = outputFile, onefile = FALSE, height = 6, - width = 9 + width = 14 ) splicingGenomeWide <- extractSplicingGenomeWide( SwitchList, - featureToExtract = "all", - splicingToAnalyze = c("A3", "MES", "ATSS"), + featureToExtract = "isoformUsage", + splicingToAnalyze = "all", plot = TRUE, returnResult = TRUE )