0
|
1 import sys
|
|
2 import os
|
|
3 import re
|
|
4
|
|
5 def get_field_samples_options(dataset):
|
|
6 options = []
|
|
7 line=os.popen("grep '#CHROM' %s"%dataset.file_name).read()[:-1].split('\t')
|
|
8 index=line.index('FORMAT')
|
|
9 for opt in line[index+1:] :
|
|
10 options.append((opt,opt, True))
|
|
11 return options
|
|
12
|
|
13 def get_field_chrs_options(dataset):
|
|
14 options = []
|
|
15 chrs=os.popen("grep '##contig' %s"%dataset.file_name).read()[:-1].split('\n')
|
|
16 for line in chrs:
|
|
17 opt=re.search('^##contig=<ID=(\w+),length=',line).group(1)
|
|
18 options.append((opt,opt, True))
|
|
19 return options
|
|
20
|