diff find_indiv.py @ 0:fe39a4677281 draft

Uploaded
author dereeper
date Fri, 05 Aug 2016 09:46:55 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/find_indiv.py	Fri Aug 05 09:46:55 2016 -0400
@@ -0,0 +1,20 @@
+import sys
+import os
+import re
+
+def get_field_samples_options(dataset):
+	options = []
+	line=os.popen("grep '#CHROM' %s"%dataset.file_name).read()[:-1].split('\t')
+	index=line.index('FORMAT')
+	for opt in line[index+1:] :
+		options.append((opt,opt, True))
+	return options
+
+def get_field_chrs_options(dataset):
+        options = []
+        chrs=os.popen("grep '##contig' %s"%dataset.file_name).read()[:-1].split('\n')
+        for line in chrs:
+		opt=re.search('^##contig=<ID=(\w+),length=',line).group(1)
+                options.append((opt,opt, True))
+        return options
+