Skip to content

Commit

Permalink
Add flags to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor committed Mar 7, 2024
1 parent 5eb8c87 commit 8d59ae0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
20 changes: 13 additions & 7 deletions reports/report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ GREEN <- "#28a745"
ORANGE <- "#ff8800"
link_to_sample <- function(sample) {
return (sample)
#paste0('<a target=_blank href=samples/', sample, '.html>', sample,'</a>' )
paste0('<a target=_blank href="samples/', sample, '.html">', sample,'</a>' )
}
Expand Down Expand Up @@ -100,14 +99,21 @@ contamination <- merge(contamination, mapping, by.x="Sample", by.y="Filename") %
contaminated_samples = contamination %>%
rename("Contamination_Status" = "Contamination.Status") %>%
filter(Contamination_Status == "YES");
#variants_count <- data.table(t(table(variants$ID)))
#variants_count <- merge(variants_count, mapping, by.x="V2", by.y="Filename") %>%
# arrange(Sample_Label)
variants_count <- data.table(t(table(variants$ID)))
variants_count <- merge(variants_count, mapping, by.x="V2", by.y="Filename") %>%
variants <- merge(variants, mapping, by.x="ID", by.y="Filename") %>%
arrange(Sample_Label)
variants <- merge(variants, mapping, by.x="ID", by.y="Filename") %>%
variants_count <- variants %>% group_by(Sample_Label) %>%
summarise(
N = n(),
Filtered = sum(Filter != "PASS")
) %>%
arrange(Sample_Label)
variant_caller <- pipeline_params %>%
filter(Parameter == "Variant Caller")
Expand Down Expand Up @@ -296,9 +302,9 @@ Row
```{r}
variants_count %>%
mutate (Sample_Link = link_to_sample(Sample_Label)) %>%
select("Sample_Link", "N") %>%
select("Sample_Link", "N", "Filtered") %>%
datatable(
colnames=c("Sample", "Number of Variants"),
colnames=c("Sample", "Number of Variants", "Flagged Variants"),
options = list(
bPaginate = FALSE
),
Expand Down
29 changes: 27 additions & 2 deletions reports/sample.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ variants <- variants %>%
Type == 2 ~ create_label('Heteroplasmy', 'default'),
Type == 3 ~ create_label('InDel', 'info'),
TRUE ~ "Unknown"
)) %>%
mutate(Filter_Label = case_when(
Filter == "PASS" ~ create_label('PASS', 'success'),
TRUE ~ create_label(Filter, 'warning')
))
variant_caller <- pipeline_params %>%
Expand Down Expand Up @@ -182,19 +186,40 @@ statistics %>%
#)
```

### Variant Flags

```{r}
variants %>% count(Filter_Label) %>%
datatable(
colnames=c("Filter Flag", "Variants"),
options = list(
bPaginate = FALSE,
bFilter = FALSE,
bSort = FALSE,
bFooter = FALSE,
info = FALSE
),
escape = FALSE,
rownames = FALSE,
class = 'cell-border stripe'
)
```

### Variants and Hetroplasmies

Detected **`r variants %>% filter(Type == 1) %>% nrow()` variants**, **`r variants %>% filter(Type == 2) %>% nrow()` heteroplasmies** and **`r variants %>% filter(Type == 3) %>% nrow()` InDels**.


```{r}
variants %>%
mutate(
Variant_Label = link_to_variant(Pos, Ref, Variant)
) %>%
arrange(Pos, Ref, Variant) %>%
select("Variant_Label", "VariantLevel", "Type_Label") %>%
select("Variant_Label", "VariantLevel", "Type_Label","Filter_Label") %>%
datatable(
colnames=c("Variant", "Level", ""),
colnames=c("Variant", "Level", "Type","Flags"),
options = list(
bPaginate = FALSE,
bFilter = FALSE,
Expand Down

0 comments on commit 8d59ae0

Please sign in to comment.