view polyphen_datasets.py @ 0:40dd2e7ee63a default tip

initial commit
author Yusuf Ali <ali@yusuf.email>
date Wed, 25 Mar 2015 16:00:12 -0600
parents
children
line wrap: on
line source

import os
import re
import csv
import operator
from galaxy import config

# get tool-data path
configur =  config.Configuration()
kitDir = configur.resolve_path("tool-data")

# determine if config file exists
if not os.path.exists( kitDir +  "/hgvs_annotate.loc" ):
    kitDir = "/export/geno_tmp/achri/dbs/";
else:
	 with open(kitDir + "/hgvs_annotate.loc", "r") as tsv:
	   for line in csv.reader(tsv, delimiter="\t"):
		    if line[0] == 'pathways_dbs':
			       kitDir = line[1]


polyPhenDir = kitDir
def PolyPhen_fileOptions():
    list = os.listdir(polyPhenDir);
    list.sort()
    pattern = re.compile('polyphen_(.*)\.txt.gz$')
    fileOptions = [(s) for s in list if os.path.exists(polyPhenDir + s)]
    ds = [pattern.match(s) for s in fileOptions]
    datasets = [(m.group(1), m.group(1), False) for m in ds if m]
    return datasets