Skip to content

Commit 0573a5a

Browse files
committed
correctly generating JSON data for annotation result charts
1 parent 11b9fb0 commit 0573a5a

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

workflows/Nextflow/configs/container.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ process {
4747
container = 'ghcr.io/lanl-bioinformatics/edge_contigs_taxonomy:1.12.0'
4848
}
4949
withLabel: 'annotation' {
50-
container = 'ghcr.io/lanl-bioinformatics/edge_annotation:0.6.0'
50+
container = 'apwat/annotation:0.6.1'
5151
}
5252
withLabel: 'phageFinder' {
5353
container = 'ghcr.io/lanl-bioinformatics/edge_phage_finder:1.2.0'

workflows/Nextflow/modules/runAnnotation/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
FROM continuumio/miniconda3:24.5.0-0 AS build
3-
ENV version=0.6.0
3+
ENV version=0.6.1
44

55
ENV container=docker
66

@@ -14,7 +14,7 @@ RUN conda init bash \
1414
&& conda activate annotation
1515

1616
RUN conda install -n annotation -c bioconda perl-lwp-protocol-https
17-
RUN conda install -n annotation -c conda-forge r-base
17+
RUN conda install -n annotation -c conda-forge r-base r-jsonlite=2.0.0
1818
RUN conda install -y -n annotation -c bioconda prokka
1919
RUN conda install -n annotation -c bioconda mummer
2020
RUN conda install -n annotation -c bioconda blast=2.16

workflows/Nextflow/modules/runAnnotation/resources/usr/bin/plot_gff3_stats.pl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ sub Rplot {
213213
$outcmd = "png('${prefix}_plots.png',height=800, width=1000, type='cairo');" if $outfmt =~ /png/i;
214214

215215
my $Rscript = "
216+
library(jsonlite)
216217
setwd('$cwd');
217218
$outcmd
218219
#page setup
@@ -240,6 +241,11 @@ sub Rplot {
240241
barc = 'grey'
241242
#feature plot
242243
table.feat<-table(gff\$feature)
244+
features <- as.data.frame(table.feat)
245+
colnames(features)[1] <- \"Feature\"
246+
exportJSON <- toJSON(features, pretty=TRUE)
247+
write(exportJSON, \"feature_count.json\")
248+
243249
barplot(table.feat,ylab=expression('Count log'[10]), ylim=c(1,10000), col=barc, log='y', las=3, main='Feature count')
244250
#protein size distribution
245251
dist<-hist(gff\$length/3,
@@ -249,6 +255,14 @@ sub Rplot {
249255
breaks=seq(0, max(gff\$length)/3+100, 100),
250256
xlim=c(0,max(gff\$length)/3+400),
251257
probability=FALSE, col=barc, border='black', cex=0.8 )
258+
size_dist <- as.data.frame(dist\$breaks[1:length(dist\$breaks)-1])
259+
size_dist[2] <- dist\$breaks[2:length(dist\$breaks)]
260+
size_dist[3] <- dist\$counts
261+
colnames(size_dist)[1] <- \"LowerBinThreshold\"
262+
colnames(size_dist)[2] <- \"UpperBinThreshold\"
263+
colnames(size_dist)[3] <- \"Count\"
264+
exportJSON <- toJSON(size_dist, pretty=TRUE)
265+
write(exportJSON, \"size_distribution.json\")
252266
#detail info
253267
text(max(gff\$length)/3/2,max(dist\$counts),adj=c(0,1),cex=0.8,'$text')
254268
title('ANNOTATION STATS - $title ($ctg_num contigs, ${length}bp)', outer=TRUE)

workflows/Nextflow/modules/runAnnotation/runAnnotation.nf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ process annPlot {
140140
output:
141141
path "plot_gff3.log"
142142
path "annotation_stats_plots.pdf", emit: annStats
143+
path "{feature_count,size_distribution}.json"
143144
path "${settings["projName"]}.txt", optional:true
144145

145146
script:

workflows/Nextflow/nextflow.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ process {
301301
container = 'ghcr.io/lanl-bioinformatics/edge_contigs_taxonomy:1.12.0'
302302
}
303303
withLabel: 'annotation' {
304-
container = 'ghcr.io/lanl-bioinformatics/edge_annotation:0.6.0'
304+
container = 'apwat/annotation:0.6.1'
305305
}
306306
withLabel: 'phageFinder' {
307307
container = 'ghcr.io/lanl-bioinformatics/edge_phage_finder:1.2.0'

0 commit comments

Comments
 (0)