8000 display flip flop fix by alphabdiallo · Pull Request #103 · formbio/laava · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

display flip flop fix #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
89 changes: 65 additions & 24 deletions src/report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -543,37 +543,78 @@ if (file.exists(agg_flipflop_tsv)) {

```{r ffplot, message=FALSE, warning=FALSE, results='asis'}
if (exists("df.flipflop") && (nrow(df.flipflop) > 1)) {
# Generate flip/flop summary plot
ffplot <- df.flipflop %>%
mutate(
class = if_else(
leftITR == 'unclassified' | rightITR == 'unclassified',
"unclassified",
paste(leftITR, rightITR, sep = '-')
)
) %>%
mutate(
unclass = if_else( class == "unclassified", "unclassified", "classified")
) %>%
group_by(type, subtype, class, unclass) %>%
summarize(classct = sum(count)) %>%
filter(subtype == 'full')
ggplot(ffplot, aes(x = class, y = classct, fill = unclass)) +
geom_bar(stat = 'identity', show.legend = FALSE) +
labs(x = 'Assigned type') +
scale_y_continuous("Number of reads",
limits = c(0, NA),
expand = expansion(mult = c(0, 0.05)))

if (params$vector_type == "ss") {
# Generate flip/flop summary plot
ffplot <- df.flipflop %>%
mutate(
class = if_else(
leftITR == 'unclassified' | rightITR == 'unclassified',
"unclassified",
paste(leftITR, rightITR, sep = '-')
)
) %>%
mutate(
unclass = if_else( class == "unclassified", "unclassified", "classified")
) %>%
group_by(type, subtype, class, unclass) %>%
summarize(classct = sum(count)) %>%
filter(subtype == 'full')
ggplot(ffplot, aes(x = class, y = classct, fill = unclass)) +
geom_bar(stat = 'identity', show.legend = FALSE) +
labs(x = 'Assigned type') +
scale_y_continuous("Number of reads",
limits = c(0, NA),
expand = expansion(mult = c(0, 0.05)))
} else if (params$vector_type == "sc") {
# Generate flip/flop summary plot
ffplot <- df.flipflop %>%
mutate(
class = if_else(
rightITR == 'unclassified',
"unclassified",
paste(rightITR)
)
) %>%
mutate(
unclass = if_else( class == "unclassified", "unclassified", "classified")
) %>%
group_by(type, subtype, class, unclass) %>%
summarize(classct = sum(count)) %>%
filter(subtype == 'full')
ggplot(ffplot, aes(x = class, y = classct, fill = unclass)) +
geom_bar(stat = 'identity', show.legend = FALSE) +
labs(x = 'Assigned type') +
scale_y_continuous("Number of reads",
limits = c(0, NA),
expand = expansion(mult = c(0, 0.05)))
}
} else {
cat("No flip/flop analysis results available to display.")
}
```

```{r fftable, message=FALSE, warning=FALSE, results='asis'}
if (exists("df.flipflop") && (nrow(df.flipflop) > 1)) {
flextable(df.flipflop) %>%
set_header_labels(values = c("type", "subtype", "leftITR", "rightITR", "count"))
if (params$vector_type == "ss") {
flextable(df.flipflop) %>%
set_header_labels(values = c("type" = "Type", "subtype" = "Subtype", "leftITR" = "Left ITR", "rightITR" = "Right ITR", "count" = "Count"))

}
else if (params$vector_type == "sc") {
# flextable(df.flipflop) %>%
# set_header_labels(values = c("type", "subtype", "leftITR", "rightITR", "count"))
# flextable(df.flipflop) %>%
# set_header_labels(values = c("type", "subtype", "leftITR", "rightITR", "count")) %>%
# select(type, subtype, rightITR, count)
#print(colnames(df.flipflop))
df.flipflop %>%
group_by(type, subtype, rightITR) %>%
summarize(count = sum(count), .groups = "drop") %>%
select(type, subtype, rightITR, count) %>%
filter(subtype == 'full' ) %>%
flextable() %>%
set_header_labels(values = c("type" = "Type", "subtype" = "Subtype", "rightITR" = "Right ITR", "count" = "Count"))
}
}
```

Expand Down
Loading
0