quadbio / Pando

Multiome GRN inference.
https://quadbio.github.io/Pando/
MIT License
110 stars 21 forks source link

Update grn.R #24

Open Sandman-1 opened 1 year ago

Sandman-1 commented 1 year ago

The NetworkTFs() function does not return a data frame or matrix with transcription factor names as column names. As a result, when the program tries to find transcription factors to use - tf_use <- colnames(motif2tf) - R returns an error of incorrect dimensions shortly after saying it's fitting a model. This is during the early part of the infer_grn step.

Instead, the NetworkTFs() function returns a named numeric, with names being the actual transcription factors. Therefore, my proposed edit is to change the line "tf_use <- colnames(motif2tf)" to "tf_use <- names(motif2tf) %>% na.omit()" and follow it with "motif2tf <- motif2tf[tf_use, drop = FALSE]."

joschif commented 1 year ago

The function NetworkTFs() should return a sparse matrix with TFs a colnames, if this is not the case there is a chance something went wrong earlier in the workflow. What did you pass as motif_tfs to find_motifs()?