diff --git a/.deprecated/align-minimap.smk b/.deprecated/align-minimap.smk index a10ca883f..478b851b2 100644 --- a/.deprecated/align-minimap.smk +++ b/.deprecated/align-minimap.smk @@ -62,7 +62,7 @@ rule genome_setup: container: None message: - "copying {input} to Genome/" + "Copying {input} to Genome/" shell: """ if (file {input} | grep -q compressed ) ;then diff --git a/src/harpy/snakefiles/phase.bak.smk b/.deprecated/phase.bak.smk similarity index 100% rename from src/harpy/snakefiles/phase.bak.smk rename to .deprecated/phase.bak.smk diff --git a/src/harpy/reports/align_bxstats.Rmd b/src/harpy/reports/align_bxstats.Rmd index c11ee90ea..b946de02c 100644 --- a/src/harpy/reports/align_bxstats.Rmd +++ b/src/harpy/reports/align_bxstats.Rmd @@ -128,7 +128,11 @@ DT::datatable( aggregate_df, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + scrollX = TRUE, + buttons = list(list(extend = "csv",filename = "per_sample_barcode_alignment")) + ), caption = 'Per-Sample Alignment Information Pertaining to Barcodes', fillContainer = T, colnames = c("sample", "alignments", "unique molecules", "singletons", "multiplex", "unique barcodes", "molecule:bx ratio", "valid bx alignments", "invalid bx alignments", "% valid bx", "avg reads/molecule", "SEM reads/molecule", "avg molecule coverage %","SEM molecule coverage %", "N50", "N75","N90") diff --git a/src/harpy/reports/align_stats.Rmd b/src/harpy/reports/align_stats.Rmd index 33619a860..4aaf11e44 100644 --- a/src/harpy/reports/align_stats.Rmd +++ b/src/harpy/reports/align_stats.Rmd @@ -110,7 +110,14 @@ valueBox(scales::comma(totuniqBX), caption = "Total unique molecules", color = " valids %>% group_by(contig) %>% summarize(n50 = NX(length_inferred, 50), n75 = NX(length_inferred, 75), n90 = NX(length_inferred, 90)) %>% - DT::datatable(rownames = F, options = list(dom = 'Brtip', buttons = c('csv')), fillContainer = T) + DT::datatable( + rownames = F, + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_molecule_NX"))) + ), + fillContainer = T + ) ``` ## Reads per molecule dec @@ -446,7 +453,11 @@ DT::datatable( contig_avg, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + scrollX = TRUE, + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_align_depth_avg"))) + ), colnames = c('Contig', 'Average Depth', 'Standard Deviation'), autoHideNavigation = T, fillContainer = T, @@ -460,7 +471,11 @@ DT::datatable( contig_avg_filt, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + scrollX = TRUE, + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_align_depth_filt_avg"))) + ), colnames = c('Contig', 'Average Depth', 'Standard Deviation'), autoHideNavigation = T, fillContainer = T, @@ -474,7 +489,11 @@ DT::datatable( outliers, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + scrollX = TRUE, + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_align_depth_outlier_avg"))) + ), colnames = c('Contig', 'Position', 'Depth'), autoHideNavigation = T, fillContainer = T diff --git a/src/harpy/reports/bcftools_stats.Rmd b/src/harpy/reports/bcftools_stats.Rmd index 0535aad76..db3bdba1b 100644 --- a/src/harpy/reports/bcftools_stats.Rmd +++ b/src/harpy/reports/bcftools_stats.Rmd @@ -255,7 +255,7 @@ if(sum(.dpL) == 0){ rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv')), + options = list(dom = 'Brtip', buttons = list(list(extend = "csv",filename = "align_depth_bins"))), colnames = c("Depth Bin", "Genotypes", "% Genotypes", "Sites", "% Sites") ) } @@ -317,7 +317,18 @@ figheight <- 1 + (0.2 * nrow(psc)) ## Individual Statistics {.tabset data-height=plotheight} ### Individual Data ```{r Individual table, echo=FALSE, message=FALSE, warning=FALSE} -DT::datatable(psc, rownames = F, fillContainer = T, filter = "top", extensions = 'Buttons', options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE, paging = F)) +DT::datatable( + psc, rownames = F, + fillContainer = T, + filter = "top", + extensions = 'Buttons', + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "snp_indiv_stats")), + scrollX = TRUE, + paging = F + ) +) ``` ### Individual Statistics diff --git a/src/harpy/reports/hapcut.Rmd b/src/harpy/reports/hapcut.Rmd index f778a309a..14ed501d2 100644 --- a/src/harpy/reports/hapcut.Rmd +++ b/src/harpy/reports/hapcut.Rmd @@ -179,10 +179,14 @@ DT::datatable( percontig, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "phasing_per_contig")), + scrollX = TRUE + ), colnames = c("Contig", "Total Haplotypes", "Mean SNPs", "Median SNPs", "Mean Haplotype Length", "Median Haplotype Length", "Largest Haplotype"), fillContainer = T - ) +) ``` ### per contig plot {.no-title} @@ -247,7 +251,11 @@ DT::datatable( persample, rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "phasing_per_sample")), + scrollX = TRUE + ), colnames = c("Sample", "Haplotypes", "Mean SNPs", "Median SNPs", "Mean Haplotype Length", "Median Haplotype Length", "Largest Haplotype"), fillContainer = T ) diff --git a/src/harpy/reports/leviathan.Rmd b/src/harpy/reports/leviathan.Rmd index 210f3931b..cf2b0d4b0 100644 --- a/src/harpy/reports/leviathan.Rmd +++ b/src/harpy/reports/leviathan.Rmd @@ -27,7 +27,6 @@ using<-function(...) { using("flexdashboard","dplyr","ggplot2","DT","BioCircos") ``` -# General Stats ## Intro ### introtext {.no-title} ```{r} @@ -127,7 +126,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename , "_sv_leviathan`"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) @@ -148,7 +151,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_sv_leviathan_per_contig"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) diff --git a/src/harpy/reports/leviathan_pop.Rmd b/src/harpy/reports/leviathan_pop.Rmd index 0d2339f4a..e8c6c8c05 100644 --- a/src/harpy/reports/leviathan_pop.Rmd +++ b/src/harpy/reports/leviathan_pop.Rmd @@ -137,7 +137,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "leviathan_sv")), + scrollX = TRUE + ), fillContainer = T ) ``` @@ -158,7 +162,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "leviathan_sv_count_pop")), + scrollX = TRUE + ), fillContainer = T ) ``` @@ -177,7 +185,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "leviathan_sv_bp_pop")), + scrollX = TRUE + ), fillContainer = T ) ``` diff --git a/src/harpy/reports/naibr.Rmd b/src/harpy/reports/naibr.Rmd index 03cdaa9b5..46a87e0bc 100644 --- a/src/harpy/reports/naibr.Rmd +++ b/src/harpy/reports/naibr.Rmd @@ -23,7 +23,6 @@ fai <- snakemake@input[["fai"]] samplename <- gsub(".bedpe", "", basename(infile)) ``` -# General Stats ## file top ### file header {.no-title}

NAIBR Variant Calling: `r samplename`

@@ -145,8 +144,11 @@ DT::datatable( grpstats %>% pivot_wider(id_cols = 1, names_from = SV, values_from = count), rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), - #colnames = c('Contig', 'Variant Type', 'Count', 'Total Base Pairs'), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename , "_sv_naibr_count"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) @@ -157,9 +159,11 @@ DT::datatable( grpstats %>% pivot_wider(id_cols = 1, names_from = SV, values_from = total_bp), rownames = F, extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), - #colnames = c('deletion', 'duplication', 'inversion'), - autoHideNavigation = T, + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename , "_sv_naibr_count_bp"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T, ) ``` @@ -210,7 +214,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_sv_naibr"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) @@ -222,7 +230,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = paste0(samplename ,"_sv_naibr_chimeric"))), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) diff --git a/src/harpy/reports/naibr_pop.Rmd b/src/harpy/reports/naibr_pop.Rmd index 0aa9da103..e44de493e 100644 --- a/src/harpy/reports/naibr_pop.Rmd +++ b/src/harpy/reports/naibr_pop.Rmd @@ -172,7 +172,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "naibr_sv_count_pop")), + scrollX = TRUE + ), fillContainer = T ) ``` @@ -189,7 +193,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "naibr_sv_count_bp")), + scrollX = TRUE + ), fillContainer = T ) ``` @@ -239,7 +247,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = 'csv', scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "naibr_sv")), + scrollX = TRUE + ), fillContainer = T ) ``` @@ -250,7 +262,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE) + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "naibr_sv_chimeric")), + scrollX = TRUE + ) ) ``` diff --git a/src/harpy/reports/preflight_bam.Rmd b/src/harpy/reports/preflight_bam.Rmd index ce78be154..fc2f81bba 100644 --- a/src/harpy/reports/preflight_bam.Rmd +++ b/src/harpy/reports/preflight_bam.Rmd @@ -133,7 +133,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = T), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "bam_checks")), + scrollX = T + ), fillContainer = T ) ``` diff --git a/src/harpy/reports/preflight_fastq.Rmd b/src/harpy/reports/preflight_fastq.Rmd index 27ce66e85..7fdd90d94 100644 --- a/src/harpy/reports/preflight_fastq.Rmd +++ b/src/harpy/reports/preflight_fastq.Rmd @@ -129,7 +129,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = T), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "fastq_checks")), + scrollX = T + ), fillContainer = T ) ``` diff --git a/src/harpy/reports/stitch_collate.Rmd b/src/harpy/reports/stitch_collate.Rmd index 4ea82ddc2..9efb9db28 100644 --- a/src/harpy/reports/stitch_collate.Rmd +++ b/src/harpy/reports/stitch_collate.Rmd @@ -145,7 +145,11 @@ DT::datatable( rownames = F, filter = "top", extensions = 'Buttons', - options = list(dom = 'Brtip', buttons = c('csv'), scrollX = TRUE), + options = list( + dom = 'Brtip', + buttons = list(list(extend = "csv",filename = "impute_per_sample")), + scrollX = TRUE + ), autoHideNavigation = T, fillContainer = T ) diff --git a/src/harpy/snakefiles/align_bwa.smk b/src/harpy/snakefiles/align_bwa.smk index 4f2a54294..ed99b9f9e 100644 --- a/src/harpy/snakefiles/align_bwa.smk +++ b/src/harpy/snakefiles/align_bwa.smk @@ -62,7 +62,7 @@ rule genome_setup: container: None message: - "copying {input} to Genome/" + "Copying {input} to Genome/" shell: """ if (file {input} | grep -q compressed ) ;then diff --git a/src/harpy/snakefiles/align_ema.smk b/src/harpy/snakefiles/align_ema.smk index 3ac41f35b..71922e0f6 100644 --- a/src/harpy/snakefiles/align_ema.smk +++ b/src/harpy/snakefiles/align_ema.smk @@ -67,7 +67,7 @@ rule genome_setup: container: None message: - "copying {input} to Genome/" + "Copying {input} to Genome/" shell: """ if (file {input} | grep -q compressed ) ;then diff --git a/src/harpy/snakefiles/align_strobealign.smk b/src/harpy/snakefiles/align_strobealign.smk index 0d3786238..d6fb86f8e 100644 --- a/src/harpy/snakefiles/align_strobealign.smk +++ b/src/harpy/snakefiles/align_strobealign.smk @@ -64,7 +64,7 @@ rule genome_setup: container: None message: - "copying {input} to Genome/" + "Copying {input} to Genome/" shell: """ if (file {input} | grep -q compressed ) ;then diff --git a/src/harpy/snakefiles/phase.smk b/src/harpy/snakefiles/phase.smk index a8af36a2e..980072908 100644 --- a/src/harpy/snakefiles/phase.smk +++ b/src/harpy/snakefiles/phase.smk @@ -22,10 +22,10 @@ bamlist = config["inputs"]["alignments"] # toggle linked-read aware mode if config["ignore_bx"]: - fragfile = outdir + "/extractHairs/{sample}.unlinked.frags" + fragfile = outdir + "/extract_hairs/{sample}.unlinked.frags" linkarg = "--10x 0" else: - fragfile = outdir + "/linkFragments/{sample}.linked.frags" + fragfile = outdir + "/link_fragments/{sample}.linked.frags" linkarg = "--10x 1" if samples_from_vcf: @@ -186,9 +186,9 @@ rule extract_hairs: geno = geno, fai = genofai output: - outdir + "/extractHairs/{sample}.unlinked.frags" + outdir + "/extract_hairs/{sample}.unlinked.frags" log: - outdir + "/logs/extractHairs/{sample}.unlinked.log" + outdir + "/logs/extract_hairs/{sample}.unlinked.log" params: indels = indelarg, bx = linkarg @@ -205,11 +205,11 @@ rule link_fragments: input: bam = get_alignments, vcf = outdir + "/workflow/input/vcf/{sample}.het.vcf", - fragments = outdir + "/extractHairs/{sample}.unlinked.frags" + fragments = outdir + "/extract_hairs/{sample}.unlinked.frags" output: - outdir + "/linkFragments/{sample}.linked.frags" + outdir + "/link_fragments/{sample}.linked.frags" log: - outdir + "/logs/linkFragments/{sample}.linked.log" + outdir + "/logs/link_fragments/{sample}.linked.log" params: d = molecule_distance conda: @@ -226,10 +226,10 @@ rule phase_blocks: vcf = outdir + "/workflow/input/vcf/{sample}.het.vcf", fragments = fragfile output: - blocks = outdir + "/phaseBlocks/{sample}.blocks", - vcf = temp(outdir + "/phaseBlocks/{sample}.blocks.phased.VCF") + blocks = outdir + "/phase_blocks/{sample}.blocks", + vcf = temp(outdir + "/phase_blocks/{sample}.blocks.phased.VCF") log: - outdir + "/logs/phaseBlocks/{sample}.blocks.phased.log" + outdir + "/logs/phase_blocks/{sample}.blocks.phased.log" params: prune = f"--threshold {pruning}" if pruning > 0 else "--no_prune 1", extra = extra @@ -244,9 +244,9 @@ rule phase_blocks: rule compress_phaseblock: input: - outdir + "/phaseBlocks/{sample}.blocks.phased.VCF" + outdir + "/phase_blocks/{sample}.blocks.phased.VCF" output: - outdir + "/phaseBlocks/{sample}.phased.vcf.gz" + outdir + "/phase_blocks/{sample}.phased.vcf.gz" container: None message: @@ -262,11 +262,11 @@ use rule compress_phaseblock as compress vcf with: rule merge_annotations: input: - phase = outdir + "/phaseBlocks/{sample}.phased.vcf.gz", + phase = outdir + "/phase_blocks/{sample}.phased.vcf.gz", orig = outdir + "/workflow/input/gzvcf/{sample}.hom.vcf.gz" output: - bcf = outdir + "/annotations/{sample}.phased.annot.bcf", - idx = outdir + "/annotations/{sample}.phased.annot.bcf.csi" + bcf = outdir + "/phased_samples/{sample}.phased.annot.bcf", + idx = outdir + "/phased_samples/{sample}.phased.annot.bcf.csi" threads: 2 benchmark: @@ -280,8 +280,8 @@ rule merge_annotations: rule merge_samples: input: - bcf = collect(outdir + "/annotations/{sample}.phased.annot.bcf", sample = samplenames), - idx = collect(outdir + "/annotations/{sample}.phased.annot.bcf.csi", sample = samplenames) + bcf = collect(outdir + "/phased_samples/{sample}.phased.annot.bcf", sample = samplenames), + idx = collect(outdir + "/phased_samples/{sample}.phased.annot.bcf.csi", sample = samplenames) output: bcf = outdir + "/variants.phased.bcf", idx = outdir + "/variants.phased.bcf.csi" @@ -305,7 +305,7 @@ rule merge_samples: rule summarize_blocks: input: - collect(outdir + "/phaseBlocks/{sample}.blocks", sample = samplenames) + collect(outdir + "/phase_blocks/{sample}.blocks", sample = samplenames) output: outdir + "/reports/blocks.summary.gz" params: