Sha256: e0014fd7e03a4b9c4024e3f333b144076abb83ef91a3b954f8c2d36c74cd6d21
Contents?: true
Size: 1.32 KB
Versions: 4
Compression:
Stored size: 1.32 KB
Contents
require 'bio-samtools-wrapper' require 'optparse' $: << File.expand_path(File.dirname(__FILE__) + '/../lib') $: << File.expand_path('.') path=File.expand_path(File.dirname(__FILE__) + '/../lib/bio-polymarker.rb') def parseVCFheader(head_line="") ##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of samples with data"> m=/##INFO=<ID=(.+),Number=(.+),Type=(.+),Description="(.+)">/.match(head_line) {:id=>m[1],:number=>m[2],:type=>m[3],:desc=>m[4]} end header_info = Hash.new ARGF.each_line do |line| h = nil h = parseVCFheader(line) if line.start_with? "##INFO" header_info[h[:id]] = h[:desc] if h #puts header_info.inspect next if line.start_with? "##" if line.start_with? "#CHROM" arr = line.split arr = arr.drop(9) arr2 = arr.map { |s| [s.clone().prepend('Cov'), s.clone().prepend('Hap') ]} #header += arr2.join("\t") #puts header next end line.chomp! vcf = Bio::DB::Vcf.new(line, arr) # puts arr.join("\t") if vcf.info["TYPE"] == "snp" # puts vcf.inspect #pus vcf.pos.inspect #next if vcf.info["AO"].to_i != 1 vcf.info.each_pair { |name, val| puts "#{name}\t#{val}\t#{header_info[name]}" } arr2 = Array.new puts "____" i = 0 vcf.samples.each do |sample| #puts sample.inspect puts sample[1].keys.join("\t") if i == 0 puts sample[1].values.join("\t") i+=1 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bio-polymarker-1.3.3 | bin/vcfLineToTable.rb |
bio-polymarker-1.3.2 | bin/vcfLineToTable.rb |
bio-polymarker-1.3.1 | bin/vcfLineToTable.rb |
bio-polymarker-1.3.0 | bin/vcfLineToTable.rb |