Skip to content
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

bug fix and minor improvements #86

Merged
merged 8 commits into from
Jan 23, 2025
41 changes: 31 additions & 10 deletions R/prettyOncoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ prettyOncoplot = function(
Hugo_Symbol,
Variant_Classification = value
)

maf_df_noncoding <- inner_join(maf_df, nc)
if(verbose){
print(nc)
print(maf_df_noncoding)
}
} else {
# Make empty maf_df
maf_df_noncoding <- maf_df %>%
Expand Down Expand Up @@ -1126,7 +1131,7 @@ prettyOncoplot = function(
cluster_rows=T,
cluster_cols=F,
fontsize_row = 6,
show_colnames = F
show_colnames = showTumorSampleBarcode
)
if(verbose){
print("Done!")
Expand All @@ -1139,7 +1144,7 @@ prettyOncoplot = function(
cluster_cols=T,
cluster_rows=F,
fontsize_row = 6,
show_colnames = F
show_colnames = showTumorSampleBarcode
)
}else{
message("clustering mutation rows and columns")
Expand All @@ -1148,7 +1153,7 @@ prettyOncoplot = function(
clustering_distance_rows=clustering_distance_rows,
clustering_distance_cols=clustering_distance_cols,
fontsize_row = 6,
show_colnames = F)
show_colnames = showTumorSampleBarcode)
}
if(dry_run){
print(h_obj)
Expand Down Expand Up @@ -1423,7 +1428,7 @@ make_prettyoncoplot = function(mat_input,
message("re-clustering columns based on numeric metadata")

hh = Heatmap(heat_mat,cluster_columns=T,
clustering_distance_columns = clustering_distance_cols)
clustering_distance_columns = clustering_distance_cols,show_column_names = showTumorSampleBarcode)
col_order = NULL
col_dend = column_dend(hh)

Expand All @@ -1441,6 +1446,9 @@ make_prettyoncoplot = function(mat_input,
if(verbose){
print(oncoprint_args)
}
if(showTumorSampleBarcode){
heatmap_args[['show_column_names']] = TRUE
}
if(numeric_heatmap_location == "top"){
if(!missing(splitColumnName)){
heatmap_args[['column_split']] = column_split
Expand All @@ -1450,11 +1458,17 @@ make_prettyoncoplot = function(mat_input,
}
if(verbose){
print(names(heatmap_args))

print(names(oncoprint_args))
print(oncoprint_args)
}
if(return_inputs){
oncoprint_heatmap = do.call("oncoPrint",oncoprint_args)
numeric_heatmap = do.call("Heatmap",heatmap_args)
}
ht_list =
do.call("Heatmap",heatmap_args) %v%
do.call("oncoPrint",oncoprint_args) %v%

ComplexHeatmap::HeatmapAnnotation(df = metadata_df_numeric,
show_legend = show_legend,
col = colours,
Expand All @@ -1465,19 +1479,25 @@ make_prettyoncoplot = function(mat_input,
col_fun = col_fun,
ncol = 1,
direction = legend_direction,
labels_gp = gpar(fontsize = legendFontSize)))
labels_gp = gpar(fontsize = legendFontSize))) %v%
do.call("oncoPrint",oncoprint_args)



draw(ht_list)
if(return_inputs){
return(list(Heatmap=ht_list,heat_mat=heat_mat,mut_mat=mat_input))
return(list(Oncoprint=oncoprint_heatmap,Numeric=numeric_heatmap,Full_Heatmap=ht_list,heat_mat=heat_mat,mut_mat=mat_input))
}
return()
}else if(numeric_heatmap_location == "bottom"){
if(return_inputs){
oncoprint_heatmap = do.call("oncoPrint",oncoprint_args)
numeric_heatmap = do.call("Heatmap",heatmap_args)
}

ht_list =
do.call("oncoPrint",oncoprint_args) %v%
do.call("Heatmap",heatmap_args) %v%

ComplexHeatmap::HeatmapAnnotation(df = metadata_df_numeric,
show_legend = show_legend,
col = colours,
Expand All @@ -1488,13 +1508,14 @@ make_prettyoncoplot = function(mat_input,
col_fun = col_fun,
ncol = 1,
direction = legend_direction,
labels_gp = gpar(fontsize = legendFontSize)))
labels_gp = gpar(fontsize = legendFontSize))) %v%
do.call("Heatmap",heatmap_args)



draw(ht_list)
if(return_inputs){
return(list(Heatmap=ht_list,heat_mat=heat_mat,mut_mat=mat_input))
return(list(Oncoprint=oncoprint_heatmap,Numeric=numeric_heatmap,Full_Heatmap=ht_list,heat_mat=heat_mat,mut_mat=mat_input))
}
return()
}
Expand Down
Loading