Top Level Namespace

Defined Under Namespace

Modules: Bio

Instance Method Summary collapse

Instance Method Details

#getTreeObjFromNwkString(nwk_str) ⇒ Object



188
189
190
191
192
# File 'lib/bio/nwk.rb', line 188

def getTreeObjFromNwkString(nwk_str)
  nwk = Bio::Newick.new(nwk_str)
  tree = nwk.tree
  return(tree)
end

#getTreeObjs(tree_file, num = 1000000) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/bio/nwk.rb', line 174

def getTreeObjs(tree_file, num=1000000)
  trees = Array.new
  treeio = Bio::FlatFile.open(Bio::Newick, tree_file=='-' ? $stdin : tree_file)
  while newick = treeio.next_entry
    tree = newick.tree
    tree.options[:bootstrap_style] = :traditional
    next if tree.nodes.empty?
    trees << tree
    break if trees.size >= num
  end
  return(trees)
end