diff --git a/bin/report.py b/bin/report.py index 1c1d54f..62c7607 100755 --- a/bin/report.py +++ b/bin/report.py @@ -305,9 +305,7 @@ def gff_compare_plots(report, gffcompare_outdirs: Path, sample_ids): * **Totals**: Comparison of the number of stringtie-generated - transcripts, multiexonic transcripts and - loci (I'm not exactly sure what defines this class at the moment) between - reference + transcripts, multiexonic transcripts and loci between reference and query. * **Performance**: How accurate are the query transcript annotations with respect to the @@ -411,6 +409,9 @@ def gff_compare_plots(report, gffcompare_outdirs: Path, sample_ids): tracking.drop(columns=['sample_id', 'Overlaps'], inplace=True) tracking = tracking[['Code', 'Description', 'Count', 'Percent']] + tracking = tracking.round({ + 'Percent': 2 + }) cols = [TableColumn( field=Ci, title=Ci, width=100) for Ci in tracking.columns] diff --git a/main.nf b/main.nf index bf1184e..af60b1c 100644 --- a/main.nf +++ b/main.nf @@ -133,13 +133,17 @@ process split_bam{ if (params["bundle_min_reads"] != false) """ seqkit bam -j ${params.threads} -N ${params.bundle_min_reads} ${bam} -o bam_bundles/ - mv bam_bundles/* . - for f in *:*; do mv -v "\$f" \$(echo "\$f" | tr ':' '-'); done + mv bam_bundles/* . + let i=1 + for b in *.bam; do + newname="${sample_id}_batch_\${i}.bam" + mv \$b \$newname + ((i++)) + done """ else """ - mkdir -p ./${sample_id}_bam_bundles - ln -s ${bam} ${sample_id}_bam_bundles-000000000-ALL-0-1_bundle.bam + ln -s ${bam} ${sample_id}_batch_1.bam """ } @@ -161,17 +165,12 @@ process assemble_transcripts{ output: tuple val(sample_id), path('*.gff'), emit: gff_bundles script: - def out_filename = bam.name.replaceFirst(~/\.[^\.]+$/, '') + "_${sample_id}.gff" def G_FLAG = ref_annotation.name.startsWith('OPTIONAL_FILE') ? '' : "-G ${ref_annotation}" - // Convert batch name to stringtie prefix to prevent clashing attribute names - // eg "0000000123_cluster..." to 123 - def prefix = StringUtils.stripStart(bam.name.split('_')[0],"0") - if (!prefix){ - prefix = "0" - } + def prefix = bam.name.split(/\./)[0] + """ - stringtie --rf ${G_FLAG} -L -v -A gene_abund.tab -p ${params.threads} ${params.stringtie_opts} -o ${out_filename} \ - -l $prefix ${bam} 2>/dev/null + stringtie --rf ${G_FLAG} -L -v -p ${params.threads} ${params.stringtie_opts} \ + -o ${prefix}.gff -l ${prefix} ${bam} 2>/dev/null """ }