4.3 Executing the Analysis
Create reward matrices
<-list()
graph_results<- lapply(DTAI_AML_samples, function(i){
graph_results <-setdiff(colnames(final_sample_summary[[i]]$NGT),"Clone")
mutations <-final_sample_summary[[i]]$Clones%>%
Known_mat separate(col=Clone,
remove = FALSE,
into=`mutations`)%>%
select(c(all_of(mutations),Clone))%>%
pivot_longer(cols=`mutations`,
names_to="Genes",
values_to="Genotype")%>%
pivot_wider(names_from=Clone,
values_from = Genotype)%>%
mutate_at(vars(-Genes),
funs(as.numeric))
<-final_sample_summary[[i]]$Clones$Count/sum(final_sample_summary[[i]]$Clones$Count)*100
weights names(weights)<- final_sample_summary[[i]]$Clones$Clone
<-create_reward_matrix(Known_mat,weights)
graph_results[[i]]
})
names(graph_results) <-DTAI_AML_samples
saveRDS(graph_results,file="graph_results_complete.rds")
Query mutations
<-readRDS(file="./data/graph_results_complete.rds")
graph_results
<-list()
final_resultsfor(i in 1:length(graph_results)){
# print(names(graph_results)[i])
<-query_initiating_mutations(graph_results[[i]])
final_results[[i]]
}names(final_results) <- names(graph_results)
saveRDS(final_results,file="./data/MDP_trajectory_final.rds")