annotate capture_kits.py @ 0:7cdd13ff182a default tip

initial commit
author Yusuf Ali <ali@yusuf.email>
date Wed, 25 Mar 2015 15:49:28 -0600
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
1 import os
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
2 import re
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
3 import sys
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
4 import operator
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
5 import csv
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
6 from galaxy import config
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
7
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
8 # get tool-data path
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
9 configur = config.Configuration()
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
10 kitDir = configur.resolve_path("tool-data")
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
11
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
12 # determine if config file exists
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
13 if not os.path.exists( kitDir + "/report_poor_coverage" ):
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
14 kitDir = "/export/achri_galaxy/dbs/CaptureKits/";
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
15 else:
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
16 with open(kitDir + "/report_poor_coverage", "r") as tsv:
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
17 for line in csv.reader(tsv, delimiter="\t"):
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
18 if line[0] == 'capturekits_directory':
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
19 kitDir = line[1]
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
20
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
21 def kit_fileOptions():
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
22 list = os.listdir(kitDir);
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
23 list.sort()
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
24 pattern = re.compile('(.*)$')
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
25 fileOptions = [(s) for s in list if os.path.exists(kitDir + s)]
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
26 ds = [pattern.match(s) for s in fileOptions]
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
27 datasets = [(m.group(1), m.group(1), False) for m in ds if m]
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
28 return datasets
7cdd13ff182a initial commit
Yusuf Ali <ali@yusuf.email>
parents:
diff changeset
29