Mercurial > repos > gandres > vcftools_filter_stats_diversity
changeset 6:b726ff436103 draft
planemo upload
author | gandres |
---|---|
date | Wed, 13 Apr 2016 06:54:57 -0400 |
parents | 18fdec90ed8c |
children | 4f88297ee3e9 |
files | VCFToolFilter/GetChromOfVCF.pl VCFToolFilter/find_indiv.py |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VCFToolFilter/GetChromOfVCF.pl Wed Apr 13 06:54:57 2016 -0400 @@ -0,0 +1,25 @@ +#!/usr/bin/perl + +use strict; + +my $vcf = $ARGV[0]; + +my %chrs; +my $ok = 0; +open(my $V,$vcf); +while(<$V>) +{ + if ($ok) + { + my ($chr,$pos) = split(/\t/,$_); + $chrs{$chr}++; + } + if (/#CHROM/){$ok = 1;} +} +close($V); + +foreach my $chr(sort keys(%chrs)) +{ + my $nb = $chrs{$chr}; + print "$chr $nb\n"; +}
--- a/VCFToolFilter/find_indiv.py Wed Apr 13 04:28:32 2016 -0400 +++ b/VCFToolFilter/find_indiv.py Wed Apr 13 06:54:57 2016 -0400 @@ -18,7 +18,7 @@ opt=re.search('^##contig=<ID=(\w+),length=',line).group(1) options.append((opt,opt, True)) else : - chrs=os.popen("grep -v '#' %s | cut -f1 | sort -u "%dataset.file_name).read()[:-1].split('\n') + 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