utils.R 19.4 KB
Newer Older
1
2
#!/usr/bin/Rscript

Valentina Galata's avatar
Valentina Galata committed
3
## IMPORT
4

Valentina Galata's avatar
Valentina Galata committed
5
6
##############################
# INPUT
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#' Transform a molten data.frame into a squared data.frame
#' For lists of pairwise comparisons
#' @input df Molten data.frame w/ three columns (two w/ labels and one w/ values)
#' @input col1 Column name containing labels (1)
#' @input col2 Column name containing labels (2)
#' @return a data.frame with labels from two label columns as row and column names
dcast_sq <- function(df, col1, col2){
    # make sure the labels are identical
    testit::assert(all( sort(df[,col1]) == sort(df[,col2]) ))
    # reshape given data.frame using given formula
    df <- reshape2::dcast(df, as.formula(sprintf("%s ~ %s", col1, col2)))
    # use col. w/ tool names as rownames and remove from table
    rownames(df) <- df[,col1]
    df <- df[,setdiff(colnames(df), col1)]
    return(df)
} 

Valentina Galata's avatar
Valentina Galata committed
25
read_nanostats <- function(fname){
26
    print(sprintf("Reading: %s", fname))
Valentina Galata's avatar
Valentina Galata committed
27
28
29
30
31
32
33
34
35
36
37
38
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        check.names=FALSE,
        stringsAsFactors=FALSE
    )
    df_cols <- c("stat"="Statistic", "value"="Value")
    colnames(df) <- df_cols[colnames(df)]
    return(df)
}

39
read_fastp <- function(fname){
40
    print(sprintf("Reading: %s", fname))
41
42
43
44
45
46
47
48
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        row.names=1,
        check.names=FALSE,
        stringsAsFactors=FALSE
    )
49
    df <- df[,c("total_reads", "total_bases", "q20_rate", "q30_rate")]
50
51
52
    return(df)
}

53
read_mappability <- function(fname){
54
    print(sprintf("Reading: %s", fname))
55
56
57
58
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
59
60
        check.names=FALSE,
        stringsAsFactors=FALSE
61
62
63
64
65
66
    )
    testit::assert(all(df$tool %in% names(ASM_TOOL_NAMES)))
    df$tool <- ASM_TOOL_NAMES[df$tool]
    return(df)
}

67
read_prodigal <- function(fname){
68
    print(sprintf("Reading: %s", fname))
69
70
71
72
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
73
74
        check.names=FALSE,
        stringsAsFactors=FALSE
75
    )
76
77
    testit::assert(all(df$tool %in% names(ASM_TOOL_NAMES)))
    df$tool <- ASM_TOOL_NAMES[df$tool]
78
79
80
    return(df)
}

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
read_prodigal_gcounts <- function(fname){
    df <- read_prodigal(fname)
    df$partial_pct <- 100 * df$partial / df$total
    return(df)
}

read_prodigal_glength <- function(fname){
    df <- read_prodigal(fname)
    return(df)
}

read_quast <- function(fname){
    print(sprintf("Reading: %s", fname))
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        row.names=1,
        check.names=FALSE,
        stringsAsFactors=FALSE
    )
    testit::assert(all(colnames(df) %in% names(ASM_TOOL_NAMES)))
    colnames(df) <- ASM_TOOL_NAMES[colnames(df)]
    df <- df[QUAST_VARS, ASM_TOOL_NAMES]
    return(df)
}

read_plasflow <- function(fname){
109
110
111
112
113
114
115
116
117
118
    print(sprintf("Reading: %s", fname))
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        stringsAsFactors=FALSE,
        check.names=FALSE
    )
    testit::assert(all(df$tool %in% names(ASM_TOOL_NAMES)))
    df$tool <- ASM_TOOL_NAMES[df$tool]
119
120
    df <- df[df$label %in% names(PLASFLOW_NAMES$labels),]
    df$label <- PLASFLOW_NAMES$labels[df$label]
121
122
123
    return(df)
}

124
read_rgi <- function(fname){
125
    print(sprintf("Reading: %s", fname))
126
127
128
129
130
131
132
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        stringsAsFactors=FALSE,
        check.names=FALSE
    )
133
134
135
    colnames(df) <- sapply(colnames(df), function(x){ ifelse(x %in% names(ASM_TOOL_NAMES), ASM_TOOL_NAMES[x], x) })
    testit::assert(all(df$col %in% names(RGI_NAMES$col)))
    df$col <- RGI_NAMES$col[df$col]
136
137
138
    return(df)
}

139
read_barrnap <- function(fname){
140
    print(sprintf("Reading: %s", fname))
141
142
143
144
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
145
146
        stringsAsFactors=FALSE,
        check.names=FALSE
147
    )
148
149
    testit::assert(all(df$tool %in% names(ASM_TOOL_NAMES)))
    df$tool <- ASM_TOOL_NAMES[df$tool]
150
151
    testit::assert(all(df$kingdom %in% names(BARRNAP_KINGDOM_NAMES)))
    df$kingdom <- BARRNAP_KINGDOM_NAMES[df$kingdom]
152
153
154
    return(df)
}

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
proc_barrnap <- function(df){
    # total counts per tool, kingdom and partial/complete categories
    df_total <- aggregate(
        df$count,
        by=list(tool=df$tool, kingdom=df$kingdom, partial=grepl("partial", df$gene)),
        FUN=sum
    )
    # partial: FALSE/TRUE -> label
    df_total$partial <- c("complete", "partial")[df_total$partial + 1]
    # add partial + complete = total
    df_total <- rbind(
        df_total,
        aggregate(
            df_total$x,
            by=list(tool=df_total$tool, kingdom=df_total$kingdom, partial=rep("total", nrow(df_total))),
            FUN=sum
        )
    )
    return(df_total)
}

read_crispr <- function(fname){
177
    print(sprintf("Reading: %s", fname))
178
179
180
181
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
182
183
        stringsAsFactors=FALSE,
        check.names=FALSE
184
    )
185
186
187
    # testit::assert(all(df$crispr_tool %in% names(CRISPR_TOOL_NAMES)))
    testit::assert(all(df$tool    %in% names(ASM_TOOL_NAMES)))
    # df$crispr_tool <- CRISPR_TOOL_NAMES[df$crispr_tool]
188
189
190
191
    df$tool <- ASM_TOOL_NAMES[df$tool]
    return(df)
}

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
aggr_crispr <- function(df){
    df_spacers <- aggregate(
        x=df$spacers,
        by=list(tool=df$tool),
        FUN=sum
    )
    rownames(df_spacers) <- df_spacers$tool
    df_arrays <- aggregate(
        x=df$seq_id,
        by=list(tool=df$tool),
        FUN=length
    )
    rownames(df_arrays) <- df_arrays$tool
    return(list(spacers=df_spacers, arrays=df_arrays))
}

208
read_diamondDB <- function(fname){
209
    print(sprintf("Reading: %s", fname))
210
211
212
213
214
215
216
217
218
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        check.names=FALSE,
        stringsAsFactors=FALSE
    )
    testit::assert(all(df$tool %in% names(ASM_TOOL_NAMES)))
    df$tool <- ASM_TOOL_NAMES[df$tool]
219
220
221
    return(df)
}

222
read_ugenes <- function(fname){
223
    print(sprintf("Reading: %s", fname))
224
225
226
227
228
229
230
    df <- read.csv(
        file=fname,
        sep="\t",
        header=TRUE,
        check.names=FALSE,
        stringsAsFactors=FALSE
    )
231
232
233
    df$uniq_pct                 <- 100 * df$uniq / df$total
    df$highcovuniq_pct_total    <- 100 * df$highcovuniq / df$total
    df$highcovuniq_pct_uniq     <- 100 * df$highcovuniq / df$uniq
234
235
    testit::assert(all(df$tool1 %in% names(ASM_TOOL_NAMES)))
    testit::assert(all(df$tool2 %in% names(ASM_TOOL_NAMES)))
236
    df$tool1 <- ASM_TOOL_NAMES[df$tool1]
237
238
239
240
    df$tool2 <- ASM_TOOL_NAMES[df$tool2]
    return(df)
}

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
read_fastani_many2many <- function(fname){
    print(sprintf("Reading: %s", fname))
    proc_name <- function(x){
        x <- basename(dirname(x))
        testit::assert(x %in% names(ASM_TOOL_NAMES))
        return(ASM_TOOL_NAMES[x])
    }
    dm <- read.csv(file=fname, sep='\t', header=FALSE, check.names=FALSE, stringsAsFactors=FALSE, col.names=c("tool1", "tool2", "ani", "mappings", "queries"))
    dm <- dcast_sq(df=dm[,c("tool1", "tool2", "ani")], col1="tool1", col2="tool2")
    # proc. names
    colnames(dm) <- sapply(colnames(dm), proc_name)
    rownames(dm) <- sapply(rownames(dm), proc_name)
    return(dm)
}

read_mummer_dnadiff <- function(fname){
    print(sprintf("Reading: %s", fname))
    df <- read.csv(file=fname, sep='\t', header=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
    df$seqs_pct  <- 100 * df$seqs_aligned  / df$seqs_total
    df$bases_pct <- 100 * df$bases_aligned / df$bases_total
    testit::assert(all(df$tool1 %in% names(ASM_TOOL_NAMES)))
    testit::assert(all(df$tool2 %in% names(ASM_TOOL_NAMES)))
    df$tool1 <- ASM_TOOL_NAMES[df$tool1]
    df$tool2 <- ASM_TOOL_NAMES[df$tool2]
    return(df)
}

268
read_mash_dist_reads <- function(fname){
269
    print(sprintf("Reading: %s", fname))
270
    proc_name <- function(x){
271
272
273
274
275
        rtype <- basename(dirname(x))
        mtype <- basename(dirname(dirname(x)))
        testit::assert(rtype %in% names(READ_TYPES))
        testit::assert(mtype %in% names(META_TYPES))
        return(sprintf("%s %s", META_TYPES[mtype], READ_TYPES[rtype]))
276
277
278
279
280
281
282
    }
    dm <- read.csv(file=fname, sep='\t', header=TRUE, row.names=1, check.names=FALSE)
    colnames(dm) <- sapply(colnames(dm), proc_name)
    rownames(dm) <- sapply(rownames(dm), proc_name)
    return(dm)
}

283
read_mash_dist_asm <- function(fname){
284
    print(sprintf("Reading: %s", fname))
285
286
287
288
289
290
291
292
293
294
    proc_name <- function(x){
        x <- basename(dirname(x))
        testit::assert(x %in% names(ASM_TOOL_NAMES))
        return(ASM_TOOL_NAMES[x])
    }
    dm <- read.csv(file=fname, sep='\t', header=TRUE, row.names=1, check.names=FALSE)
    colnames(dm) <- sapply(colnames(dm), proc_name)
    rownames(dm) <- sapply(rownames(dm), proc_name)
    return(dm)
}
295

296
##############################
297
298
# PLOTS

299
300
301
302
303
304
305
set_tool_order <- function(df, cols){
    for(cname in cols){
        df[,cname] <- factor(df[,cname], ordered=TRUE, levels=ASM_TOOL_NAMES)
    }
    return(df)
}

306
plot_mappability <- function(df){
307
    df <- set_tool_order(df, c("tool"))
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
    pp <- 
        ggplot(data=df, aes(x=tool, y=value, fill=tool)) +
        geom_col() +
        geom_text(aes(label=value, y=0.5*value), color="black", size=4, angle=90) +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        facet_wrap(vars(minlength), ncol=2, scales="fixed") +
        labs(
            x="",
            y="Mapped reads [%]"
        ) +
        mappability_theme
    return(pp)
}

plot_prodigal <- function(df_gc, df_gl){
    df_gcm <- reshape2::melt(df_gc[,c("tool", "total", "partial")], id.vars=c("tool"))
324
325
326
    df_gc  <- set_tool_order(df_gc,  c("tool"))
    df_gl  <- set_tool_order(df_gl,  c("tool"))
    df_gcm <- set_tool_order(df_gcm, c("tool"))
327
328
329
    pp1 <-
        ggplot(data=df_gcm, aes(x=variable, y=value, fill=tool)) +
        geom_col(position="dodge") +
330
        scale_fill_manual(values=ASM_TOOL_COLORS) +
331
332
333
334
335
336
337
338
339
        labs(
            x="",
            y="Gene count"
        ) +
        prodigal_theme
    
    pp2 <-
        ggplot(data=df_gc, aes(x=tool, y=partial_pct, fill=tool)) +
        geom_col() +
340
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
        labs(
            x="",
            y="Percentage of partial genes"
        ) +
        prodigal_theme
    
    pp3 <-
        ggplot(data=df_gl, aes(x=tool, y=gene_length, fill=tool)) +
        geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        labs(
            x="",
            y="Gene length [bp]"
        ) +
        diamondDB_theme
    
    pp4 <- pp3 + coord_cartesian(ylim=c(0, 2000))

    return(list(
        gcounts=pp1,
        gpct=pp2,
        glen=pp3,
        glen_zoom=pp4
    ))
}

plot_barrnap <- function(df){
368
    df <- set_tool_order(df, c("tool"))
369
370
371
372
373
374
375
376
377
378
379
380
381
382
    pp <-
        ggplot(data=df, aes(x=tool, y=x, fill=tool)) +
        geom_col() +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        facet_grid(vars(partial), vars(kingdom), scales="fixed") +
        labs(
            x="",
            y=sprintf("rRNA gene hits")
        ) +
        barrnap_theme
    return(pp)
}

plot_barrnap_genes <- function(df, subtitle){
383
    df <- set_tool_order(df, c("tool"))
384
385
386
387
388
389
390
391
392
393
394
395
396
397
    pp <-
        ggplot(data=df, aes(x=tool, y=count, fill=tool)) +
        geom_col() +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        facet_wrap(vars(gene), ncol=1, scales="free_y") +
        labs(
            subtitle=subtitle,
            x="",
            y="rRNA gene hits"
        ) +
        barrnap_theme
    return(pp)
}

398
399
400
401
402
403
404
405
406
plot_rgi_overlap <- function(df, ctype, col){
    df <- df[df$type == ctype & df$col == col,]
    df_list <- lapply(ASM_TOOL_NAMES, function(x){ df[df[,x] > 0,"label"] })
    names(df_list) <- ASM_TOOL_NAMES[names(df_list)]
    UpSetR::upset(
        data=UpSetR::fromList(df_list),
        # overlap order
        order.by="degree",
        decreasing=FALSE,
407
408
        # number of sets to plot
        nsets=length(ASM_TOOL_NAMES),
409
410
411
        # y-label title
        mainbar.y.label=sprintf("Intersection size (%s hits, %s)", ctype, col),
        # text size
412
        text.scale = c(1.2, 1.2, 1.2, 1.2, 1.2, 1.2)#,
413
        # colors
414
415
416
417
418
419
420
421
        # set.metadata=list(
        #     data=data.frame(
        #         sets=names(df_list),
        #         Tool=names(df_list),
        #         stringsAsFactors=FALSE
        #     ), 
        #     plots=list(list(type="matrix_rows", column="Tool", colors=ASM_TOOL_COLORS, alpha=0.7))
        # )
422
423
424
    )
}

425
426
plot_crispr <- function(df){
    df_m <- reshape2::melt(df, id.vars="tool")
427
    df_m <- set_tool_order(df_m, c("tool"))
428
    pp <-
429
        ggplot(data=df_m, aes(x=tool, y=value, fill=tool)) +
430
431
        geom_col(position="dodge") +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
432
        facet_wrap(vars(variable), ncol=1, scales="free_y") +
433
434
        labs(
            x="",
435
            y="Number of features"
436
437
438
439
440
441
        ) +
        crispr_theme
    return(pp)
}

plot_plasflow <- function(df, ylab=""){
442
    df <- set_tool_order(df, c("tool"))
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
    pp <-
        ggplot(data=df, aes_string(x="tool", y="value", fill="label")) +
        geom_col(position="dodge") +
        scale_fill_manual(values=PLASFLOW_COLORS$labels, guide="legend") +
        labs(
            x="",
            y=ylab
        ) +
        plasflow_theme
    return(pp)
}

plot_quast <- function(df){
    df_m <- reshape2::melt(
        cbind(stat_vars=rownames(df), df),
        id.vars="stat_vars"
459
    )
460
    df_m <- set_tool_order(df_m, c("variable"))
461
462
463
464
465
466
467
468
469
470
471
    pp <-
        ggplot(data=df_m, aes(x=variable, y=value)) +
        geom_col(aes(fill=variable)) +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        facet_wrap(vars(stat_vars), ncol=2, scales="free_y") +
        labs(
            x="",
            y="QUAST statistic"
        ) +
        quast_theme
    return(pp)
472
473
}

474
plot_ugenes_barplots <- function(df, ycol, ylab="", subtitle=""){
475
    df <- set_tool_order(df, c("tool1", "tool2"))
476
    pp <-
477
        ggplot(data=df, aes_string(x="tool2", y=ycol, fill="tool2")) +
478
479
480
481
        geom_col() +
        facet_wrap(vars(tool1), ncol=1) +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        labs(
482
            subtitle=subtitle,
483
            x="Assembly 2",
484
            y=ylab
485
        ) +
486
        ugenes_theme
487
488
489
    return(pp)
}

490
plot_ugenes_scatterplot <- function(df, subtitle=""){
491
    df <- set_tool_order(df, c("tool1", "tool2"))
492
    pp <-
493
        ggplot(data=df, aes(x=uniq_pct, y=highcovuniq_pct_uniq, fill=tool2, shape=tool2)) +
494
        geom_point(colour="white", size=6) +
495
496
        scale_fill_manual(values=ASM_TOOL_COLORS, name="") +
        scale_shape_manual(values=ASM_TOOL_SHAPES, name="") +
497
        labs(
498
            subtitle=subtitle,
499
            x="Unique proteins [%, total]",
500
            y="Unique proteins w/ high mean cov. [% of unique]"
501
        ) +
502
503
504
505
506
        default_theme +
        theme(
            legend.position="bottom",
            legend.direction="horizontal"
        )
507
508
509
    return(pp)
}

510
plot_diamondDB_density <- function(df, col, xlim=NULL){
511
    df <- set_tool_order(df, c("tool"))
512
513
514
515
516
    pp <-
        ggplot(data=df, aes_string(x=col, colour="tool", fill="tool")) +
        geom_density(alpha=0.2) +
        scale_colour_manual(values=ASM_TOOL_COLORS, guide=NULL) +
        scale_fill_manual(values=ASM_TOOL_COLORS, guide=NULL) +
517
        facet_wrap(vars(tool), nrow=4, scales="free_y") +
518
        labs(
519
            subtitle=ifelse(!is.null(xlim), "zoomed in", ""),
520
521
522
            x=DIAMOND_VAR_LABELLER(col),
            y="Density"
        ) +
523
524
525
526
527
528
529
530
        diamondDB_theme
    if(!is.null(xlim)){
        pp <- pp + coord_cartesian(xlim=xlim)
    }
    return(pp)
}

plot_diamondDB_density2d <- function(df){
531
    df <- set_tool_order(df, c("tool"))
532
533
534
535
    pp <-
        ggplot(data=df, aes(x=qcov, y=scov)) +
        geom_bin2d(bins=25) +
        scale_fill_continuous(type="viridis") +
536
        facet_wrap(vars(tool), ncol=3, nrow=3) +
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
        labs(
            x=DIAMOND_VAR_LABELLER("qcov"),
            y=DIAMOND_VAR_LABELLER("scov")
        ) +
        diamondDB_theme
    return(pp)
}

#' Contig coverage and segmentation plot
#' @input df_cov Coverage data.frame incl. contig ID, base, coverage and state
#' @input cid Contig ID
#' @return ggplot2 object
plot_contig_cov_seg <- function(df_cov, cid){
    # subset cov.
    df_cov <- df_cov[df_cov$contig==cid,]
    # segments/states medians
    df_cov$state_median <- NA
    for(s in unique(df_cov$state)){
        df_cov$state_median[df_cov$state == s] <- median(df_cov[df_cov$state==s, "cov"])
    }
    # plot
    df_plot <-
        ggplot(data=df_cov, aes(x=base, y=cov)) +
        geom_line(colour="#666666") +
        geom_line(aes(x=base, y=state_median), colour="#0066CC", size=2) +
        scale_x_continuous(breaks=seq(0, max(df_cov$base), by=5000)) +
        scale_y_log10(breaks=trans_breaks("log10", function(x) 10^x), labels=trans_format("log10", math_format(10^.x))) +
        labs(
            title=cid,
            x="base",
            y="coverage"
        ) +
        theme_bw() +
        theme(
            axis.text.x=element_text(angle=90, vjust=0.5, hjust=1)
        )
    return(df_plot)
}

#' Coverage and segmentation scatter plot
#' @input df_states Coverage segmentation summary data.frame
#' @input title Title
#' @input subtitle Sub-title
#' @return ggplot object
plot_contig_cov_seg_scatterplot <- function(df_states, title="", subtitle=""){
    pp <-
        ggplot(data=df_states[df_states$states > 1,], aes(x=length, y=mean)) +
        geom_point(data=df_states[df_states$states < 2,], aes(x=length, y=mean), shape=4, color="#CCCCCC", size=0.5) +
        geom_point(aes(size=states_median_sd, fill=as.factor(states), color=as.factor(states)), shape=21, alpha=0.75) +
        scale_x_log10(
            breaks=trans_breaks("log10", function(x) 10^x),
            labels=trans_format("log10", math_format(10^.x))
        ) +
        scale_y_log10(
            breaks=trans_breaks("log10", function(x) 10^x),
            labels=trans_format("log10", math_format(10^.x))
        ) +
        labs(
            title=title, #"Contig coverage segmentation",
            subtitle=subtitle, #"Flye + Racon(metaG SR)",
            fill="Number of states",
            color="Number of states",
            size="State median SD",
            x="Contig length [bp]",
            y="Mean contig coverage"
        ) +
        theme_bw()
604
605
    return(pp)
}
Valentina Galata's avatar
Valentina Galata committed
606

607
608
609
610
611
612
# THEMES
default_theme <-
    # theme_bw() +
    theme_minimal(
        base_size=12
    ) +
Valentina Galata's avatar
Valentina Galata committed
613
    theme(
614
615
        plot.title=element_text(size=14, face="bold"),
        plot.subtitle=element_text(size=12, face="italic"),
Valentina Galata's avatar
Valentina Galata committed
616
617
        # legend
        legend.title=element_blank(),
618
        legend.text=element_text(size=12),
Valentina Galata's avatar
Valentina Galata committed
619
620
621
622
        # grid
        panel.grid=element_blank(),
        # strip
        strip.background=element_rect(fill="white"),
623
        strip.text=element_text(size=12),
Valentina Galata's avatar
Valentina Galata committed
624
        # axes
625
626
627
        axis.title=element_text(size=12, color="black"),
        axis.text.y=element_text(size=12, color="black"),
        axis.text.x=element_text(size=12, color="black")
Valentina Galata's avatar
Valentina Galata committed
628
629
    )

630
default_theme_axis_text_x <-
Valentina Galata's avatar
Valentina Galata committed
631
    theme(
632
        axis.text.x=element_text(size=12, color="black", angle=90, vjust=0.5, hjust=1)
Valentina Galata's avatar
Valentina Galata committed
633
634
    )

635
mappability_theme <- default_theme + default_theme_axis_text_x
Valentina Galata's avatar
Valentina Galata committed
636

637
crispr_theme <- default_theme + default_theme_axis_text_x
Valentina Galata's avatar
Valentina Galata committed
638

639
plasflow_theme <- default_theme + default_theme_axis_text_x
Valentina Galata's avatar
Valentina Galata committed
640

641
prodigal_theme <- default_theme + default_theme_axis_text_x
642

643
diamondDB_theme <- default_theme + default_theme_axis_text_x
Valentina Galata's avatar
Valentina Galata committed
644

645
646
647
648
649
650
rgi_theme <- default_theme + default_theme_axis_text_x

barrnap_theme <- default_theme + default_theme_axis_text_x

quast_theme <- default_theme + default_theme_axis_text_x

651
ugenes_theme <- default_theme + default_theme_axis_text_x