class Bio::BFRTools::Container
Constants
- BASES
Attributes
bulk_1_name[R]
bulk_1_sam[R]
bulk_2_name[R]
bulk_2_sam[R]
parental_1_name[R]
parental_1_sam[R]
parental_2_name[R]
parental_2_sam[R]
processed_regions[R]
putative_snps[R]
reference_db[R]
total_length[R]
Public Class Methods
snps_between(seq1, seq2)
click to toggle source
# File lib/bio/BFRTools.rb, line 91 def self.snps_between(seq1, seq2) snps=0 for i in (0..seq1.size) snps += 1 if seq1[i] != seq2[i] end snps end
Public Instance Methods
bulk_1(opts)
click to toggle source
Sets the sorted BAM file of the first bulk
# File lib/bio/BFRTools.rb, line 69 def bulk_1(opts) raise BFRToolsException.new("Missing path for bulk 1") if opts[:path] == nil path = Pathname.new(opts[:path]) raise BFRToolsException.new("Unable to open #{path}") unless path.readable? or path.directory? @bulk_1_name = opts[:name] ? opts[:name] : path.basename(".bam").to_s @bulk_1_sam = Bio::DB::Sam.new(fasta: @reference_path, :bam=>path.realpath.to_s) @bulk_1_path = path end
bulk_2(opts)
click to toggle source
Sets the sorted BAM file of the second bulk
# File lib/bio/BFRTools.rb, line 80 def bulk_2(opts) raise BFRToolsException.new("Missing path for bulk 2") if opts[:path] == nil path = Pathname.new(opts[:path]) raise BFRToolsException.new("Unable to open #{path}") unless path.readable? or path.directory? @bulk_2_name = opts[:name] ? opts[:name] : path.basename(".bam").to_s @bulk_2_sam = Bio::DB::Sam.new(fasta: @reference_path, :bam=>path.realpath.to_s) @bulk_2_path = path end
parental_1(opts)
click to toggle source
Sets the sorted BAM file of the first parental It accepts the following arguments :name=>A name for thie parental 1 (optional). If not provided, :path=>
# File lib/bio/BFRTools.rb, line 46 def parental_1(opts) raise BFRToolsException.new("Missing path for parental 1") if opts[:path] == nil path = Pathname.new(opts[:path]) raise BFRToolsException.new("Unable to open #{path}") unless path.readable? or path.directory? @parental_1_name = opts[:name] ? opts[:name] : path.basename(".bam").to_s @parental_1_sam = Bio::DB::Sam.new(fasta: @reference_path, :bam=>path.realpath.to_s) @parental_1_path = path end
parental_2(opts)
click to toggle source
Sets the sorted BAM file of the second parental
# File lib/bio/BFRTools.rb, line 58 def parental_2(opts) raise BFRToolsException.new("Missing path for parental 2") if opts[:path] == nil path = Pathname.new(opts[:path]) raise BFRToolsException.new("Unable to open #{path}") unless path.readable? or path.directory? @parental_2_name = @name = opts[:name] ? opts[:name] : path.basename(".bam").to_s @parental_2_sam = Bio::DB::Sam.new(fasta: @reference_path, :bam=>path.realpath.to_s) @parental_2_path = path end
reference(path)
click to toggle source
Sets the reference file
# File lib/bio/BFRTools.rb, line 33 def reference(path) @reference_db = Bio::DB::Fasta::FastaFile.new(fasta: path) @reference_path = path end
reference_sequence(region)
click to toggle source
# File lib/bio/BFRTools.rb, line 38 def reference_sequence(region) @reference_db.fetch_sequence(region) end