Mercurial > repos > gandres > vcftools_filter_stats_diversity
view VCFToolFilter/find_indiv.py @ 10:2b7eb79f0ba0 draft
planemo upload
author | gandres |
---|---|
date | Wed, 13 Apr 2016 06:49:39 -0400 |
parents | ce984119f669 |
children | f494c8d22725 |
line wrap: on
line source
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') if len(chr)>0: for line in chrs: opt=re.search('^##contig=<ID=(\w+),length=',line).group(1) options.append((opt,opt, True)) else : chrs=os.popen("perl GetChromOfVCF.pl %s | cut -f1 "%dataset.file_name).read()[:-1].split('\n') for opt in chrs: options.append((opt,opt, True)) return options