Skip to content

Commit

Permalink
simplify the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Nov 7, 2024
1 parent a5bdc8f commit b1cfddd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion harpy/reports/align_stats.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ contigs <- group_by(tb, contig) %>%
summarize(size = max(position)) %>%
arrange(desc(size))
if ((length(plot_contigs) == 1) && (plot_contigs[1] == "default")){
if (all(plot_contigs == "default")){
# limit the data to only the 30 largest contigs
if (nrow(contigs) > 30){
.contigs <- contigs[1:30, ]
Expand Down
2 changes: 1 addition & 1 deletion harpy/reports/hapcut.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ dropdown_buttons <- function(CONTIGS, CUTOFF = 0){

```{r plotting_contigs_setup}
plotting_contigs <- snakemake@params$contigs
if ((length(plotting_contigs) == 1) && (plotting_contigs[1] == "default")){
if (all(plotting_contigs == "default")){
.contigs <- group_by(df, contig) %>%
summarize(size = max(pos_end)) %>%
arrange(desc(size))
Expand Down
2 changes: 1 addition & 1 deletion harpy/reports/leviathan.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fa.sizes <- read.table(fai, header = F) %>% arrange(desc(2))
colnames(fa.sizes) <- c("contig", "size")
plot_contigs <- snakemake@params$contigs
if ((length(plot_contigs) == 1) && (plot_contigs[1] == "default")){
if (all(plot_contigs == "default")){
# make sure that the contigs with SV are the ones being plotted, not the others
fa.sizes <- fa.sizes[fa.sizes$contig %in% unique(sv$contig), 1:2]
# limit the data to only the 30 of the largest present contigs
Expand Down
2 changes: 1 addition & 1 deletion harpy/reports/leviathan_pop.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ zooming on the plot.
fa.sizes <- read.table(faidx, header = F)[,1:2] %>% arrange(desc(2))
colnames(fa.sizes) <- c("contig", "size")
plot_contigs <- snakemake@params$contigs
if ((length(plot_contigs) == 1) && (plot_contigs[1] == "default")){
if (all(plot_contigs == "default")){
# make sure that the contigs with SV are the ones being plotted, not the others
fa.sizes <- fa.sizes[fa.sizes$contig %in% unique(sv$contig), ]
# limit the data to only the 30 of the largest present contigs
Expand Down
2 changes: 1 addition & 1 deletion harpy/reports/naibr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ ggplot(aes(x, y, fill = colour))+
fa.sizes <- read.table(fai, header = F) %>% arrange(desc(2))
colnames(fa.sizes) <- c("contig", "size")
plot_contigs <- snakemake@params$contigs
if ((length(plot_contigs) == 1) && (plot_contigs[1] == "default")){
if (all(plot_contigs == "default")){
# make sure that the contigs with SV are the ones being plotted, not the others
fa.sizes <- fa.sizes[fa.sizes$contig %in% unique(sv$Chr1), 1:2]
# limit the data to only the 30 of the largest present contigs
Expand Down
2 changes: 1 addition & 1 deletion harpy/reports/naibr_pop.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ zooming on the plot.
fa.sizes <- read.table(fai, header = F) %>% arrange(desc(2))
colnames(fa.sizes) <- c("contig", "size")
plot_contigs <- snakemake@params$contigs
if ((length(plot_contigs) == 1) && (plot_contigs[1] == "default")){
if (all(plot_contigs == "default")){
# make sure that the contigs with SV are the ones being plotted, not the others
fa.sizes <- fa.sizes[fa.sizes$contig %in% unique(sv$Chr1), 1:2]
# limit the data to only the 30 of the largest present contigs
Expand Down

0 comments on commit b1cfddd

Please sign in to comment.