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

bidirectional motifs and positions #5

Open
2 of 4 tasks
KevCaz opened this issue Jan 16, 2020 · 7 comments
Open
2 of 4 tasks

bidirectional motifs and positions #5

KevCaz opened this issue Jan 16, 2020 · 7 comments

Comments

@KevCaz
Copy link
Member

KevCaz commented Jan 16, 2020

Would be good to have another function that handle bidirectional network for 3 nodes motifs.
It'd mean to handle 64 cases, quite boring to write but there might be a way of writing it smartly using boolean algebra!

edit ✏️
What remains is:

  • enhance the doc of the function motif_census(), especially to list the position for the bidirecitonal case;
  • add a count of motif per species;
  • add a total count of positions.
  • add test
@KevCaz
Copy link
Member Author

KevCaz commented Jan 16, 2020

I'll follow the motifs order as in fig. 1 in Milo 2002, for each motif I'll do every position so that we have a clear mapping between position and motif and so it'll be easy to get a count of motif based on the count of positions.

@KevCaz
Copy link
Member Author

KevCaz commented Jan 16, 2020

Depending on the performance it'd may be make sense to use the function even for unidirectional network.

@david-beauchesne
Copy link
Collaborator

Why not do it for 4-species motifs as well?

@KevCaz
Copy link
Member Author

KevCaz commented Jan 16, 2020

too many positions (256).... unless there is a smart way to proceed I won't do that 😆 !

@david-beauchesne
Copy link
Collaborator

👍 haha fair enough!

@KevCaz
Copy link
Member Author

KevCaz commented Jan 16, 2020

See d0556c4

@KevCaz
Copy link
Member Author

KevCaz commented Jan 16, 2020

Performance-wise there is still a small advantage using the unidirectional implementation

R> nsp <- 200 
   mat <- matrix(runif(nsp^2)>.5, nsp, nsp) 
    
   microbenchmark( 
       res2 <- motif_census(mat, unidirectional = TRUE), 
       res <- motif_census(mat),  
       times = 50 
   )                                                             

Unit: milliseconds
                                             expr      min       lq     mean   median       uq      max neval
 res2 <- motif_census(mat, unidirectional = TRUE)  99.3449 102.5198 103.6208 103.5854 104.9859 108.9092    50
                         res <- motif_census(mat) 123.1422 128.6429 132.1059 130.3861 133.0326 174.4492    50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants