Skip to content

Instantly share code, notes, and snippets.

@meltzerpete
Last active October 1, 2018 16:32
Show Gist options
  • Save meltzerpete/8001d0f70e3818f1fedc81fdd37b5de4 to your computer and use it in GitHub Desktop.
Save meltzerpete/8001d0f70e3818f1fedc81fdd37b5de4 to your computer and use it in GitHub Desktop.

Dropbox Data Storage

Paths

  • GAMMA data root: "ResearchDepartment/ResearchProjects/GAMMA/Data/"
  • Samples: GAMMA_DATA_ROOT/Samples/
  • Toy graphs (for testing during dev): GAMMA_DATA_ROOT/ToySamples/
  • Results: GAMMA_DATA_ROOT/Results/

Please create additional folders inside as necessary (but never change an existing file/directory).

Setting the Environment Variable

Setting an environment variable for the GAMMA data root will allow us to share code across machines without a need to change any code.

Linux

Add the following to your .bash_rc:

export GAMMA_DATA_ROOT="path_to_gamma_root_on_your_machine"

For example, for me it is:

export GAMMA_DATA_ROOT="$HOME/Dropbox/ResearchDepartment/ResearchProjects/GAMMA/Data/"

Notice: the double quotes are required - they allow the spaces in the path while still expanding the $HOME path environment variable.

Mac

Create a symlink to the GAMMA data root on your machine:

$ ln -s "path_to_gamma_root_on_your_machine" .gamma_data_root

Add the following to your .bash_profile:

export GAMMA_DATA_ROOT=$HOME/.gamma_data_root/

Referencing the path from your code

Python

import os
import pandas as pd

data_path = os.environ['GAMMA_DATA_ROOT']
df = pd.read_csv(data_path + 'Samples/enzymes/edges')

Java

import java.io.File;

String dataPath = System.getenv("GAMMA_DATA_ROOT");
File edges = new File(dataPath, "Samples/enzymes/edges");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment