Mercurial > repos > jeremyjliu > region_motif_enrichment
comparison region_motif_intersect.r @ 37:76e108a19e64 draft
Uploaded
author | jeremyjliu |
---|---|
date | Tue, 07 Apr 2015 23:22:43 -0400 |
parents | b868314320e2 |
children |
comparison
equal
deleted
inserted
replaced
36:b868314320e2 | 37:76e108a19e64 |
---|---|
2 # Description: Takes a bed file of target regions and counts intersections | 2 # Description: Takes a bed file of target regions and counts intersections |
3 # of each motif (in separately installed tabix database) and target regions. | 3 # of each motif (in separately installed tabix database) and target regions. |
4 # Author: Jeremy Liu | 4 # Author: Jeremy Liu |
5 # Email: jeremy.liu@yale.edu | 5 # Email: jeremy.liu@yale.edu |
6 # Date: 15/02/11 | 6 # Date: 15/02/11 |
7 # Note: This script is meant to be invoked with the following command | 7 # Note: This script can be invoked with the following command |
8 # R --slave --vanilla -f ./region_motif_intersect.r --args <db_bgz> <db_tbi> <inbed> <outtab> | 8 # R --slave --vanilla -f ./region_motif_intersect.r --args <db_bgz> <db_tbi> <inbed> <outtab> |
9 # Dependencies: region_motif_data_manager | 9 # Dependencies: region_motif_data_manager, Rsamtools |
10 | 10 |
11 # Auxiliary function to concatenate multiple strings | 11 # Auxiliary function to concatenate multiple strings |
12 concat <- function(...) { | 12 concat <- function(...) { |
13 input_list <- list(...) | 13 input_list <- list(...) |
14 return(paste(input_list, sep="", collapse="")) | 14 return(paste(input_list, sep="", collapse="")) |
31 startTime = Sys.time() | 31 startTime = Sys.time() |
32 cat("Running ... Started at:", format(startTime, "%a %b %d %X %Y"), "...\n") | 32 cat("Running ... Started at:", format(startTime, "%a %b %d %X %Y"), "...\n") |
33 | 33 |
34 # Load dependencies | 34 # Load dependencies |
35 cat("Loading dependencies...\n") | 35 cat("Loading dependencies...\n") |
36 suppressPackageStartupMessages(library(Rsamtools, quietly=TRUE)) | 36 suppressPackageStartupMessages(library(Rsamtools, quietly=TRUE)) # NEED TO HANDLE INSTALLATION |
37 | 37 |
38 # Initializing hash table (as env) with motif names and loading tabix file | 38 # Initializing hash table (as env) with motif names and loading tabix file |
39 cat("Loading motif database and initializing hash table...\n") | 39 cat("Loading motif database and initializing hash table...\n") |
40 motifTable = new.env() | 40 motifTable = new.env() |
41 motifTbx <- TabixFile(motifDB_bgz) | 41 motifTbx <- TabixFile(motifDB_bgz) |