annotate gerp_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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
1 import os
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
2 import re
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
3 import csv
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
4 import operator
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
5 from galaxy import config
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
6
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
7 # get tool-data path
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
8 configur = config.Configuration()
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
9 kitDir = configur.resolve_path("tool-data")
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
10
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
11 # determine if config file exists
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
12 if not os.path.exists( kitDir + "/hgvs_annotate.loc" ):
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
13 kitDir = "/export/geno_tmp/achri/dbs/gerp/";
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
14 else:
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
15 with open(kitDir + "/hgvs_annotate.loc", "r") as tsv:
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
16 for line in csv.reader(tsv, delimiter="\t"):
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
17 if line[0] == 'gerp_path':
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
18 kitDir = line[1]
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
19
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
20 gerpDir = kitDir;
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
21 def GERP_fileOptions():
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
22 list = os.listdir(gerpDir);
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
23 list.sort()
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
24 pattern = re.compile('.*\d+')
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
25 fileOptions = [(s) for s in list if os.path.exists(gerpDir + s)]
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
26 datasets = [(s, s, False) for s in fileOptions if pattern.match(s)]
40dd2e7ee63a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
27 return datasets