def main(): from utils import Utils, eprint, AddPath AddPath(__file__, '../../common/') from dbconnect import db_connect from postgres_wrapper import PostgresWrapper AddPath(__file__, '../../website/common/') from pg import PGsearch from cached_objects import CachedObjects from pg_common import PGcommon testCONN = db_connect(os.path.realpath(__file__)) ps = PostgresWrapper(testCONN) pgSearch = PGsearch(ps, "hg19") ds = Datasets("hg19", pgSearch) for ctn, vs in ds.byCellType.items(): for v in vs: print(ctn, v)
def main(): args = parse_args() AddPath(__file__, '../../common/') from dbconnect import db_connect from postgres_wrapper import PostgresWrapper AddPath(__file__, '../../api/common/') from pg import PGsearch from cached_objects import CachedObjects from pg_common import PGcommon from db_trackhub import DbTrackhub from cached_objects import CachedObjectsWrapper DBCONN = db_connect(os.path.realpath(__file__)) ps = PostgresWrapper(DBCONN) cacheW = CachedObjectsWrapper(ps) db = DbTrackhub(DBCONN) tdb = TrackhubDb(ps, cacheW, db, UCSC) for assembly in ["hg19", "mm10"]: tdb.makeAllTracks(assembly)
import json import psycopg2 import re import argparse import gzip import StringIO sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../metadata/utils")) from utils import AddPath, Utils, Timer, printt, printWroteNumLines from db_utils import getcursor, vacumnAnalyze, makeIndex, makeIndexIntRange from files_and_paths import Dirs, Tools, Genome, Datasets from exp import Exp AddPath(__file__, '../common/') from dbconnect import db_connect, db_connect_single from constants import chroms, paths, DB_COLS from config import Config class Concordant: def __init__(self, curs, assembly): self.curs = curs self.assembly = assembly self.tableName = assembly + "_concordant" self.inFnp = paths.path(self.assembly, self.assembly + "-concordant-cREs.txt") def run(self): self._setupTable()
# Copyright (c) 2016-2020 Michael Purcaro, Henry Pratt, Jill Moore, Zhiping Weng from __future__ import print_function import os import sys import json import psycopg2 import re import argparse import StringIO sys.path.append( os.path.join(os.path.dirname(__file__), '../../../metadata/utils')) from utils import Utils, eprint, AddPath AddPath(__file__, '../../common/') from dbconnect import db_connect from constants import chroms, chrom_lengths, paths from postgres_wrapper import PostgresWrapper from cre_utils import isclose AddPath(__file__, '../../website/common/') from pg import PGsearch from cached_objects import CachedObjects from pg_common import PGcommon AddPath(__file__, '../../website/models/') from cre import CRE from collections import namedtuple CREnt = namedtuple('CREnt', ["chrom", "start", "stop", "mpName", "accession"])
import sys import StringIO import cherrypy import json import os import heapq import re import argparse from collections import OrderedDict sys.path.append(os.path.join(os.path.dirname(__file__), '../../metadata/utils')) from files_and_paths import Dirs from utils import Utils, eprint, AddPath, printt, printWroteNumLines AddPath(__file__, '../api/models') from trackinfo import TrackInfo AddPath(__file__, '../api/common') from coord import Coord from pg import PGsearch from db_trackhub import DbTrackhub from helpers_trackhub import Track, PredictionTrack, BigGenePredTrack, BigWigTrack, officialVistaTrack, bigWigFilters, BIB5, TempWrap, BigBedTrack, makeTrackName, makeShortLabel, makeLongLabel from cre import CRE AddPath(__file__, '../../common') from constants import paths from config import Config UCSC = 1
# SPDX-License-Identifier: MIT # Copyright (c) 2016-2020 Michael Purcaro, Henry Pratt, Jill Moore, Zhiping Weng import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), "../../metadata/utils")) from utils import AddPath AddPath(__file__, "..") from config import Config from constants import chroms def isaccession(s): if len(s) != 12: return False s = s.lower() # TODO: double check using regex return (s.startswith("eh37e") or s.startswith("em10e") or s.startswith("eh38e")) def isclose(a, b, rel_tol=1e-09, abs_tol=0.0): # from http://stackoverflow.com/a/33024979 return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) def checkChrom(assembly, j):
# SPDX-License-Identifier: MIT # Copyright (c) 2016-2020 Michael Purcaro, Henry Pratt, Jill Moore, Zhiping Weng from __future__ import print_function import os import sys import argparse from importlib import import_module sys.path.append(os.path.join(os.path.dirname(__file__), '../../metadata/utils')) from db_utils import getcursor, makeIndex, makeIndexRev, makeIndexArr from files_and_paths import Dirs, Tools, Genome, Datasets from utils import Utils, printt, AddPath AddPath(__file__, '../common/') from dbconnect import db_connect from constants import chroms, chrom_lengths, paths from config import Config from pgfantomcat import PGFantomCat AddPath(__file__, './rna_seq/') rna1 = import_module('01_import_merged_tsv') rna2 = import_module('02_metadata') def run(args, DBCONN): assemblies = Config.assemblies if args.assembly: assemblies = [args.assembly] for assembly in assemblies:
import os import sys import argparse import time import socket import psycopg2 import psycopg2.pool from main_apis import Apis from common.cached_objects import CachedObjectsWrapper sys.path.append(os.path.join(os.path.dirname(__file__), "../utils")) from templates import Templates from utils import Utils, AddPath AddPath(__file__, "../common") from postgres_wrapper import PostgresWrapper from dbconnect import db_connect from config import Config class WebServerConfig: def __init__(self, siteName, production): self.siteName = siteName self.production = production self.root = os.path.realpath(os.path.dirname(__file__)) hn = socket.gethostname() self.tmpDir = os.path.join(self.root, "tmp", hn)
import json import psycopg2 import re import argparse import gzip import StringIO sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../metadata/utils")) from utils import AddPath, Utils, Timer, printt, printWroteNumLines from db_utils import getcursor, vacumnAnalyze, makeIndex, makeIndexIntRange from files_and_paths import Dirs, Tools, Genome, Datasets from exp import Exp AddPath(__file__, '../common/') from dbconnect import db_connect, db_connect_single from constants import chroms, paths, DB_COLS from config import Config AddPath(__file__, '../website/common/') from pg_common import PGcommon from postgres_wrapper import PostgresWrapper class TopAccessions: def __init__(self, curs, assembly, pg): self.curs = curs self.assembly = assembly self.pg = pg
# SPDX-License-Identifier: MIT # Copyright (c) 2016-2020 Michael Purcaro, Henry Pratt, Jill Moore, Zhiping Weng import os import sys import json import time import numpy as np import cherrypy import uuid as uuider sys.path.append(os.path.join(os.path.dirname(__file__), '../../utils/')) from utils import AddPath AddPath(__file__, "../models") from autocompleter import AutocompleterWrapper AddPath(__file__, "../common") from parse_search import ParseSearch class AutocompleteWebService: def __init__(self, pw): self.pw = pw self.ac = AutocompleterWrapper(pw) self.actions = {"suggestions": self.suggestions, "search": self.search} def process(self, j, args, kwargs): action = args[0] try:
# SPDX-License-Identifier: MIT # Copyright (c) 2016-2020 Michael Purcaro, Henry Pratt, Jill Moore, Zhiping Weng import psycopg2.pool import sys import os sys.path.append( os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../metadata/utils")) from dbs import DBS from utils import AddPath AddPath(__file__, "../") from config import Config # assumes .pgpass file, like http://stackoverflow.com/a/28801642 def getDbs(script): return { "host": Config.db_host, "user": Config.db_usr, "port": Config.db_port, "dbname": Config.db, "application_name": script } def db_connect(script): args = getDbs(script)