Skip to content

Commit

Permalink
update sqlite database location
Browse files Browse the repository at this point in the history
  • Loading branch information
patflick committed Sep 22, 2014
1 parent 94dddc5 commit 7066d4e
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 38 deletions.
12 changes: 6 additions & 6 deletions analysis/bossi_lehner.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ get_expression_property_data <- function(ppi_name="bossi",expr_name="gene_atlas"
{
# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# create table names
prop_table <- paste(ppi_name, expr_name, "agg_node_properties", sep="_")
Expand Down Expand Up @@ -109,7 +109,7 @@ plot_tissue_expr_count_hist <- function(expr_name="gene_atlas")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

expr_count_table <- paste(expr_name, "core_expr_counts", sep="_")
#expr_count_table <- paste(expr_name, "expr_counts", sep="_")
Expand Down Expand Up @@ -207,7 +207,7 @@ get_min_max_neighbor_expr_data <- function(ppi_name="bossi", expr_name="gene_atl

# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# have to load from `core`, as the min and max counts are also
# calculated in the `core` of the expression data set.
Expand Down Expand Up @@ -594,7 +594,7 @@ get_hkts_edge_summary <- function(ppi_name="bossi", expr_name="gene_atlas", prop
# tissue specific proteins by only using SQL:

source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# what's the definition of tissuespecific vs. housekeeping?
hkts_table <- get_hkts_sym_threshold_table(expr_name, 0.2)
Expand All @@ -616,7 +616,7 @@ create_test_degrees <- function(ppi_name="bossi",expr_name="gene_atlas",prop_nam
{

source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# create table names
prop_table <- paste("prop", ppi_name, expr_name, prop_name, sep="_")
Expand All @@ -639,7 +639,7 @@ compare_test_degrees <- function(ppi_name="bossi",expr_name="gene_atlas",prop_na
{

source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# create table names
prop_table_1 <- paste("prop", ppi_name, expr_name, "degree", sep="_")
Expand Down
8 changes: 4 additions & 4 deletions analysis/cluster_score_hist.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clusterers <- c('PLP','PLM-gamma-1.0', 'PLM-gamma-5.0', 'PLM-gamma-10.0', 'PLM-g
get_cluster_data <- function(ppi_name="string", expr_name="gene_atlas", clusterer=clusterers[1])
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()
query <- paste("SELECT * FROM clustering_scoring_results ",
"WHERE size >= 4 AND ppi='", ppi_name,
"' AND expr='",expr_name, "'",
Expand All @@ -31,7 +31,7 @@ get_clusterer_data <- function(ppi_name="string", expr_name="gene_atlas")
{
type <- "Global"
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()
query <- paste("SELECT ppi, expr, clusterer, SUM(modularity) as total_mod, COUNT(), MIN(size), AVG(size), MAX(size) FROM clustering_scoring_results ",
"WHERE",
" size >= 4",
Expand All @@ -48,7 +48,7 @@ plot_cluster_distr <- function(ppi_name="string", expr_name="gene_atlas")
{
type <- "GLOBAL"
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()
query <- paste("SELECT * FROM clustering_scoring_results ",
"WHERE ppi='", ppi_name,
"' AND expr='",expr_name, "'",
Expand Down Expand Up @@ -85,7 +85,7 @@ get_top_cluster_distr <- function(ppi_name="string", expr_name="gene_atlas")
{
type <- "GLOBAL"
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()
query <- paste("SELECT * FROM clustering_scoring_results ",
"WHERE ppi='", ppi_name,
"' AND expr='",expr_name, "'",
Expand Down
2 changes: 1 addition & 1 deletion analysis/expr_core.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ is_core <- function(expr_name="hpa")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

query <- paste("SELECT COUNT(DISTINCT Gene) FROM ", expr_name)
gene_count <- dbGetQuery(con, query)
Expand Down
10 changes: 5 additions & 5 deletions analysis/expr_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source("expr_utils.R")
get_all_expr_size_stats <- function()
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

for (e in get_exprs())
{
Expand All @@ -27,7 +27,7 @@ get_expr_values <- function(expr_name="gene_atlas")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

expr_normalized_table <- paste(expr_name, "normalized", sep="_")
query <- paste("SELECT * FROM ", expr_normalized_table)
Expand Down Expand Up @@ -61,7 +61,7 @@ plot_tissue_expr_count_hist <- function(expr_name="gene_atlas")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

expr_count_table <- paste(expr_name, "expr_counts", sep="_")
query <- paste("SELECT * FROM ", expr_count_table, " ORDER BY ExpressedCount*1.0/TotalCount")
Expand All @@ -84,7 +84,7 @@ plot_tshk_example <- function(expr_name="hpa", threshold=0.15)
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

expr_count_table <- paste(expr_name, "expr_counts", sep="_")
query <- paste("SELECT * FROM ", expr_count_table, " WHERE ExpressedCount > 0 ORDER BY ExpressedCount*1.0/TotalCount")
Expand Down Expand Up @@ -129,7 +129,7 @@ plot_tshk_thresholds <- function(expr_name="hpa")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

expr_count_table <- paste(expr_name, "expr_counts", sep="_")
query <- paste("SELECT * FROM ", expr_count_table, " WHERE ExpressedCount > 0 ORDER BY ExpressedCount*1.0/TotalCount")
Expand Down
8 changes: 4 additions & 4 deletions analysis/incr_betweenness.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ get_incr_query <- function(ppi_name="ccsb", expr_name="hpa")
create_union_incr_table <- function()
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

queries <- c()
for (p in get_ppis())
Expand All @@ -64,7 +64,7 @@ create_union_incr_table <- function()
get_incr_betweenness_nodes <- function()
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

query <- paste("SELECT * FROM ", SQL_INCR_TABLE_NAME)
data <- dbGetQuery(con, query)
Expand All @@ -81,7 +81,7 @@ plot_betw_incr_distr <- function()
get_num_genes <- function()
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

query <- paste("SELECT ppi, expr, COUNT(DISTINCT Gene) FROM ",
SQL_INCR_TABLE_NAME,
Expand All @@ -95,7 +95,7 @@ get_num_genes <- function()
get_genes_count <- function()
{
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

query <- paste("SELECT Gene, COUNT(DISTINCT ppi) as cnt_ppi, ",
" COUNT(DISTINCT expr) as cnt_expr, ",
Expand Down
2 changes: 1 addition & 1 deletion analysis/old/overlap_analysis.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

table <- "overlap_pairwise_ppi_ids"
ppi_id_data <- dbGetQuery(con, paste("SELECT * FROM ", table))
Expand Down
2 changes: 1 addition & 1 deletion analysis/overlap_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plot_pairwise_table <- function(src_table)
{
# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# load ppi network from db
data <- dbGetQuery(con, paste("SELECT * FROM ", src_table))
Expand Down
4 changes: 2 additions & 2 deletions analysis/ppi_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ get_node_properties <- function(ppi_name = "string")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_node_prop_tbl <- paste(ppi_name, "node_properties", sep="_")
query <- paste("SELECT * FROM ", ppi_node_prop_tbl)
Expand All @@ -24,7 +24,7 @@ get_graph_properties <- function(ppi_name="string")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_prop_tbl <- paste(ppi_name, "properties", sep="_")
query <- paste("SELECT * FROM ", ppi_prop_tbl)
Expand Down
2 changes: 1 addition & 1 deletion analysis/sql_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Author: flick
###############################################################################
DEFAULT_DATABASE_FILE = 'hpaDB.sqlite'
DEFAULT_DATABASE_FILE = '../data/sql_database.sqlite'


get_sql_conn <- function(database_file=DEFAULT_DATABASE_FILE)
Expand Down
8 changes: 4 additions & 4 deletions analysis/ts_betweenness.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ get_node_properties <- function(ppi_name = "string", expr_name = "gene_atlas")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_node_prop_tbl <- paste(ppi_name,expr_name, "node_properties", sep="_")
query <- paste("SELECT * FROM ", ppi_node_prop_tbl)
Expand All @@ -36,7 +36,7 @@ get_ts_node_properties <- function(ppi_name = "string", expr_name = "gene_atlas"
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_node_prop_tbl <- paste(ppi_name,expr_name, "ts_node_properties", sep="_")
query <- paste("SELECT * FROM ", ppi_node_prop_tbl)
Expand All @@ -49,7 +49,7 @@ get_node_properties_exprcount <- function(ppi_name="string",expr_name="gene_atla
{
# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# create table names
ppi_node_prop_tbl <- paste(ppi_name,expr_name, "node_properties", sep="_")
Expand All @@ -69,7 +69,7 @@ get_ts_node_properties_exprcount <- function(ppi_name="string",expr_name="gene_a
{
# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

# create table names
ppi_node_prop_tbl <- paste(ppi_name,expr_name, "ts_node_properties", sep="_")
Expand Down
4 changes: 2 additions & 2 deletions analysis/tsppi_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ get_graph_properties <- function(ppi_name="string", expr_name="gene_atlas")
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_prop_tbl <- paste(ppi_name, expr_name, "properties", sep="_")
query <- paste("SELECT * FROM ", ppi_prop_tbl)
Expand All @@ -27,7 +27,7 @@ get_ts_graph_properties <- function()
{
# load the ts/hk summary data from the database
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()

ppi_prop_tbl <- "ts_graph_properties"
query <- paste("SELECT ppi, expr, Property, AVG(Value) as avg_value FROM ",
Expand Down
2 changes: 1 addition & 1 deletion analysis/venn_diagram.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plot_venn_diagram <- function(agg_table)

# load sql config and get connection
source("sql_config.R")
con <- get_sql_conn('/home/patrick/dev/bio/data/test_matching.sqlite')
con <- get_sql_conn()


# load ppi network from db
Expand Down
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tmp/
# the actual download folder:
download/

*.sqlite

################
# PPIs
Expand Down
4 changes: 2 additions & 2 deletions src/graph_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def graph_stats(g, verbose=True, timings={}):
if verbose:
print("get connected components")
t = time.time()
cc = ppi_networkit.ConnectedComponents()
cc.run(g)
cc = ppi_networkit.ConnectedComponents(g)
cc.run()
props['conn_comp'] = cc.numberOfComponents()
timings[(ppi_name, "conn_comp")] = time.time() - t

Expand Down
4 changes: 2 additions & 2 deletions src/init_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
#####################

# load GO terms
import pappi.go_import
import pappi.go.import_ass

# import GO associations
pappi.go_import.import_go_association(GO_ASSOC_FILE, con)
pappi.go.import_ass.import_go_association(GO_ASSOC_FILE, con)


##############################
Expand Down
2 changes: 1 addition & 1 deletion src/pappi/data_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
MAP_DATA_FOLDER = os.path.join(DATA_FOLDER, 'mapping')

# TODO add these files into the repo data folder !?
DATABASE = os.path.join(EXT_DATA_FOLDER, 'test_matching.sqlite')
DATABASE = os.path.join(DATA_FOLDER, 'sql_database.sqlite')

# mapping
HGNC_FILE = os.path.join(MAP_DATA_FOLDER, 'hgnc_downloads.txt')
Expand Down
2 changes: 1 addition & 1 deletion src/pappi/go/import.py → src/pappi/go/import_ass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import sql
from .. import sql

GO_ASSOC_TABLE = "go_gene_assoc"

Expand Down

0 comments on commit 7066d4e

Please sign in to comment.