Skip to content

Commit

Permalink
fix heatmap in mae qc for just 1 sample
Browse files Browse the repository at this point in the history
  • Loading branch information
ischeller committed Apr 6, 2023
1 parent 25ad87a commit a03a253
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions drop/modules/mae-pipeline/QC/DNA_RNA_matrix_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ ann_colors = list(
ann_colors[['status']] <- ann_colors[['status']][unique(c(dna_df$status, rna_df$status))]

#+ Heatmap, fig.height=6, fig.width=8
pheatmap(qc_mat, color = color, cluster_rows = FALSE, cluster_cols = FALSE,
annotation_row = dna_df, annotation_col = rna_df, annotation_colors = ann_colors,
labels_row = 'DNA samples', labels_col = 'RNA samples', angle_col = 0)
if(nrow(qc_mat) > 1 || ncol(qc_mat) > 1){
pheatmap(qc_mat, color = color, cluster_rows = FALSE, cluster_cols = FALSE,
annotation_row = dna_df, annotation_col = rna_df, annotation_colors = ann_colors,
labels_row = 'DNA samples', labels_col = 'RNA samples', angle_col = 0)
} else {
print("No heatmap created as only 1 sample is provided.")
print(qc_mat)
}


#' ## Identify matching samples
Expand Down
2 changes: 1 addition & 1 deletion drop/modules/mae-pipeline/QC/create_matrix_dna_rna_cor.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ lp <- bplapply(1:N, function(i){
mat <- do.call(rbind, lp)
row.names(mat) <- dna_samples
colnames(mat) <- rna_samples
mat <- mat[sa[rows_in_group, DNA_ID], sa[rows_in_group, RNA_ID]]
mat <- mat[sa[rows_in_group, DNA_ID], sa[rows_in_group, RNA_ID],drop=FALSE]

saveRDS(mat, snakemake@output$mat_qc)

0 comments on commit a03a253

Please sign in to comment.