Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ONT_pilot_gitlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESB
ONT_pilot_gitlab
Merge requests
!68
Figures valentina
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Figures valentina
figures_valentina
into
master
Overview
0
Commits
27
Pipelines
0
Changes
4
Merged
Susheel Busi
requested to merge
figures_valentina
into
master
4 years ago
Overview
0
Commits
27
Pipelines
0
Changes
4
Expand
0
0
Merge request reports
Viewing commit
d75c0381
Prev
Next
Show latest version
4 files
+
72
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
d75c0381
added crispr fig (issue
#19
)
· d75c0381
Valentina Galata
authored
4 years ago
figures/src/fig_crispr.R
0 → 100644
+
46
−
0
Options
#!/usr/bin/Rscript
## LOG FILE
sink
(
file
=
file
(
snakemake
@
log
[[
1
]],
open
=
"wt"
),
type
=
"message"
)
## NOTE
# Plot CRISPR statistics
## IMPORT
suppressMessages
(
library
(
testit
))
suppressMessages
(
library
(
UpSetR
))
suppressMessages
(
library
(
ggplot2
))
# custom
source
(
snakemake
@
params
$
utils
)
## DATA
stats
<-
read.csv
(
file
=
snakemake
@
input
$
stats
,
sep
=
"\t"
,
header
=
TRUE
,
stringsAsFactors
=
FALSE
,
check.names
=
FALSE
)
# change names
stats
$
crispr_tool
<-
CRISPR_TOOL_NAMES
[
stats
$
crispr_tool
]
stats
$
asm_tool
<-
ASM_TOOL_NAMES
[
stats
$
asm_tool
]
## PLOT: UpSetR + PDF
plot_upsetr
<-
function
(
df
,
asm_tool
){
asm_sets
<-
lapply
(
CRISPR_TOOL_NAMES
,
function
(
x
){
unique
(
unlist
(
df
[
df
$
asm_tool
==
asm_tool
&
df
$
crispr_tool
==
x
,
"seq_id"
]))
}
)
names
(
asm_sets
)
<-
CRISPR_TOOL_NAMES
[
names
(
asm_sets
)]
UpSetR
::
upset
(
data
=
UpSetR
::
fromList
(
asm_sets
),
order.by
=
"degree"
,
decreasing
=
FALSE
)
}
# NOTE:
# For an unknown reason creating and saving multiple plots using a for-loop or sapply did not work - the PDF was empty.
# Creating a PDF per plot in a for-loop or using sapply did not work either - each PDF was empty.
pdf
(
snakemake
@
output
$
pdf
,
width
=
snakemake
@
params
$
width
,
height
=
snakemake
@
params
$
height
)
plot_upsetr
(
stats
,
"Flye"
)
plot_upsetr
(
stats
,
"MEGAHIT"
)
plot_upsetr
(
stats
,
"metaSPAdes"
)
plot_upsetr
(
stats
,
"metaSPAdes (H)"
)
dev.off
()
\ No newline at end of file
Loading