lib/cheripic/vcf.rb in cheripic-1.2.6 vs lib/cheripic/vcf.rb in cheripic-1.2.7
- old
+ new
@@ -66,11 +66,22 @@
end
def self.filtering(mutant_vcf, bgbulk_vcf)
var_pos_mut = get_vars(mutant_vcf)
return var_pos_mut if bgbulk_vcf == ''
- var_pos_bg = get_vars(bgbulk_vcf)
+ if bgbulk_vcf.kind_of?(Array)
+ bgbulk_vcf.each do | file |
+ var_pos_bg = get_vars(file)
+ var_pos_mut = subtract(var_pos_mut,var_pos_bg)
+ end
+ else
+ var_pos_bg = get_vars(bgbulk_vcf)
+ return subtract(var_pos_mut,var_pos_bg)
+ end
+ var_pos_mut
+ end
+ def self.subtract(var_pos_mut, var_pos_bg)
# if both bulks have homozygous mutations at same positions then deleting them
var_pos_mut.each_key do | frag |
positions = var_pos_mut[frag][:hom].keys
pos_bg_bulk = var_pos_bg[frag][:hom].keys
positions.each do |pos|
\ No newline at end of file