Skip to content

Instantly share code, notes, and snippets.

@qgeissmann
Last active March 22, 2017 11:01
Show Gist options
  • Save qgeissmann/4e1e0db29592856412cd56dbe82dc404 to your computer and use it in GitHub Desktop.
Save qgeissmann/4e1e0db29592856412cd56dbe82dc404 to your computer and use it in GitHub Desktop.
# We source a few functions to help us:
source("https://gist.githubusercontent.com/qgeissmann/c977fdfe8528f1311e43ad505c3839eb/raw/rethomics_query2db_mirror.R")
# In any case, you need to tell R where your data lives/will live, on your own computer.
# The data from the cloud will be mirrored here, but only what matches your query.
local_data_dir = "C://Put/somehting/else/here"
#your query file
my_query_file <- "query.csv"
# ========= To fetch the files, THE FIRST TIME you want to analyse your experiment, you would do:
query <- fetchDataForQuery(my_query_file, local_data_dir)
print(query)
# ========= Now the data is downloaded locally, so from now on, you can forget about the lines above (unless you have new data/different query)
primary_query <- fread(my_query_file)
# this should be exatly the same as above, but assumes you have already downloaded the files
query <- buildEthoscopeQuery(local_data_dir, primary_query)
#the we actually start working. e.g.
dt <- loadEthoscopeData(query, reference_hour=9.0, FUN=sleepAnnotation)
# have fun!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment