예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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()
예제 #4
0
파일: check.py 프로젝트: wanliu2019/SCREEN
# 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"])
예제 #5
0
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
예제 #6
0
# 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):
예제 #7
0
# 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:
예제 #8
0
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)
예제 #9
0
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
예제 #10
0
# 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:
예제 #11
0
# 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)