PavlidisLab / GemmaDE

Discover biological conditions associated with differential gene expression by compiling information from >10,000 published experiments
MIT License
4 stars 0 forks source link

Unclear line in process.R #32

Closed oganm closed 2 years ago

oganm commented 2 years ago

@jsicherman

hey jordan. was wondering what exactly was happening in this line. specifically .(as.character(ChildNode_Long). trying to run the data generation code and it runs into

Error in .(as.character(ChildNode_Long), as.character(ParentNode_Long)) : could not find function "."

error. Reading the code I am unclear on how it's supposed not to have that error. Could you tell what the . is supposed to be?

https://github.com/PavlidisLab/GemmaDE/blob/a81bb6d8f9bcffd801e1856d287ab70562d426f2/main/process.R#L162

jsicherm commented 2 years ago

Hey Ogan,

That, and other instances of the .(... = ...) syntax is from data.table. As outlined in their intro to data.table vignette, it's a short form for list(... = ...). I imagine if you load the data table library and try running that line again, it should work.

jsicherm commented 2 years ago

You can think of it as a catch-all for dplyrs select, rename, mutate and summarize. Basically, when it's used as the second argument to a data.table, you can use it to select columns, compute new ones, or summarize (if by is specified). In this particular instance, it's selecting two columns from the original data table (no names are provided so it's naming them V1 and V2) and returning them as a new data table where both columns are characters rather than factors.

oganm commented 2 years ago

thank you