Skip to content

Commit

Permalink
Adding separate coverge metrics per sequencing technology to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
marchoeppner committed Oct 18, 2024
1 parent a98923e commit 9798de7
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 3 deletions.
40 changes: 38 additions & 2 deletions bin/gabi_summary.pl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"mlst" => [],
"confindr" => [],
"kraken" => {},
"serotype" => []
"serotype" => [],
"mosdepth" => {}
);

my @files = glob '*/*' ;
Expand Down Expand Up @@ -91,9 +92,23 @@
my %data;
$data{'Lissero'} = parse_lissero(\@lines);
push( @{ $matrix{'serotype'} }, \%data );
} elsif ( $filename =~ /ILLUMINA.mosdepth.summary.txt/) {
my @data = parse_mosdepth(\@lines);
$matrix{'mosdepth'}{'illumina'} = \@data;
} elsif ( $filename =~ /NANOPORE.mosdepth.summary.txt/) {
my @data = parse_mosdepth(\@lines);
$matrix{'mosdepth'}{'nanopore'} = \@data;
} elsif ( $filename =~ /PACBIO.mosdepth.summary.txt/) {
my @data = parse_mosdepth(\@lines);
$matrix{'mosdepth'}{'pacbio'} = \@data;
} elsif ( $filename =~ /.*mosdepth.summary.txt/) {
my @data = parse_mosdepth(\@lines);
$matrix{'mosdepth'} = \@data;
$matrix{'mosdepth'}{'total'} = \@data;
} elsif ( $filename =~ /.sistr.tab/) {
my %data ;

$data{'Sistr'}= parse_sistr(\@lines);
push( @{ $matrix{'serotype'} }, \%data );
}

close($FILE);
Expand All @@ -107,6 +122,27 @@
# Tool-specific parsing methods
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sub parse_sistr {
my @lines = @{$_[0] };

my $h = shift @lines ;
my @header = split "\t" , $h ;

my %data;

my $this_line = shift @lines;

my @elements = split "\t", $this_line;

for my $i (0..$#header) {
my $column = @header[$i];
my $entry = @elements[$i];
$data{$column} = $entry
}

return \%data ;
}

sub parse_mosdepth {

my @lines = @{$_[0] };
Expand Down
1 change: 1 addition & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'CONFINDR' {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/qc" },
Expand Down
4 changes: 4 additions & 0 deletions conf/multiqc_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ extra_fn_clean_exts:
- _1.fastq_trimmed
- _2.fastq_trimmed
- .NanoStats.txt
- .ALL
- .ILLUMINA
- .PACBIO
- .NANOPORE

kraken:
top_n: 15
Expand Down
2 changes: 1 addition & 1 deletion modules/mosdepth/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ process MOSDEPTH {

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.sample_id}"
def prefix = task.ext.prefix ?: "${meta.sample_id}.${meta.platform}"

"""
mosdepth \\
Expand Down
4 changes: 4 additions & 0 deletions subworkflows/coverage/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ include { ALIGN_LONG_READS } from './../align_long_reads'
ch_bam = Channel.from([])
ch_qc = Channel.from([])
ch_versions = Channel.from([])
ch_summary_by_platform = Channel.from([])

workflow COVERAGE {

Expand Down Expand Up @@ -100,9 +101,12 @@ workflow COVERAGE {
SAMTOOLS_INDEX.out.bam
)



emit:
versions = ch_versions
report = MOSDEPTH.out.global_txt
summary = MOSDEPTH.out.summary_txt
summary_by_platform = ch_summary_by_platform

}
5 changes: 5 additions & 0 deletions workflows/gabi.nf
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ workflow GABI {
)
ch_report = ch_report.mix(COVERAGE.out.summary)

ch_report = ch_report.mix(
COVERAGE.out.summary.filter {m,r ->
m.platform != "ALL"
}
)
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB: Identify and analyse plasmids from draft assemblies
Expand Down

0 comments on commit 9798de7

Please sign in to comment.