knitr::opts_chunk$set(eval = FALSE)

What is sidora?

What is sidora.core?

How to install sidora.core on your computer?

How to connect to the Pandora database server from your computer?

These steps are necessary every time you want to connect to the Pandora server (not the website!):

  1. Connect to the institute's subnet via VPN (see the instructions in kbase)
  2. Establish an SSH tunnel to the Pandora database server -- and keep it open!
ssh -L 10001:pandora.eva.mpg.de:3306 \
<your username>@daghead1

This means that the database server now listens on your computer at 127.0.0.1:10001.

How to connect to the Pandora database server from your computer?

We can actually send direct queries to the server there, e.g.

mysql --host=localhost --port=10001 \
--user=<secret> --password=<secret> pandora \
-e "select Sampled_Quantity from TAB_Sample"

But working with R and sidora.core might be more convinient for many applications

How to connect to Pandora with sidora.core?

  1. Create a .credentials file somewhere on your computer
  2. This file stores the relevant login information in a way sidora.core can understand
<host name of the database server>
<port of the database server>
<database username>
<database password>

How to connect to Pandora with sidora.core?

127.0.0.1
10001
<database username>
<database password>

How to connect to Pandora with sidora.core?

  1. Create a connection object in R with the .credentials file
con <- sidora.core::get_pandora_connection(
  "<path to your .credentials file>"
)

How to access Pandora tables with sidora.core?

There are two options:

  1. Download the tables as data.frames into your computer's memory and run all computations there
sidora.core::get_df("TAB_Site", con) %>%
  dplyr::filter(site.Country == "Germany")

How to access Pandora tables with sidora.core?

  1. Send queries (dplyr -> SQL) to the database server and only download the results
sidora.core::get_con("TAB_Site", con) %>%
  dplyr::filter(Country == "Germany") %>%
  tibble::as_tibble()

How to download and merge multiple tables?

Multiple tables can be downloaded with get_df_list() and automatically joined with join_pandora_tables()

sidora.core::get_df_list(c(
  "TAB_Individual", "TAB_Sample"
), con = con) %>%
  sidora.core::join_pandora_tables()

How to download and merge multiple tables?

TAB_Site >
  TAB_Individual >
    TAB_Sample >
      TAB_Extract >
        TAB_Library >
          TAB_Capture >
            TAB_Sequencing >
              TAB_Raw_Data >
                TAB_Analysis
sidora.core::make_complete_table_list(
  c("TAB_Site", "TAB_Capture")
)

How to replace lookup-table keys with real values?

Some values in Pandora are only ids referencing lookup tables (e.g. Worker).

sidora.core::get_df("TAB_Library", con) %$% 
  library.Worker %>% unique()

c(22, 4, 15, ...)

sidora.core::get_df("TAB_Library", con) %>% 
  sidora.core::convert_all_ids_to_values(con) %$% 
  library.Worker %>% unique()

c("Marieke van de Loosdrecht","Alissa Mittnik","Antje Wissgott", ...)



sidora-tools/sidora.core documentation built on May 4, 2024, 12:14 a.m.