From eaa7cb81a4ae7bb1dc9c7629d7365131db22ffef Mon Sep 17 00:00:00 2001 From: martinahansen Date: Wed, 10 Oct 2012 12:28:52 +0000 Subject: [PATCH] removed stale file crap from biostat git-svn-id: http://biopieces.googlecode.com/svn/trunk@1959 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/biostat | 5 ----- bp_bin/classify_taxonomy | 13 ++++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bp_bin/biostat b/bp_bin/biostat index 6a7d040..d409d28 100755 --- a/bp_bin/biostat +++ b/bp_bin/biostat @@ -76,11 +76,6 @@ while ( 1 ) push @table, $info; } - else - { - print STDERR "Removing stale file: $file\n"; - unlink $file; - } } if ( $options->{ 'sort' } =~ /^(USER|TMP_DIR|START_TIME|RUN_TIME|COMMAND)$/ ) { diff --git a/bp_bin/classify_taxonomy b/bp_bin/classify_taxonomy index 1614e5d..8c211de 100755 --- a/bp_bin/classify_taxonomy +++ b/bp_bin/classify_taxonomy @@ -31,7 +31,10 @@ require 'pp' require 'maasha/biopieces' +# Class containing methods to construct a taxonomic tree for the classification of +# organisms. Currently only works with GreenGenes type of entries. class TaxTree + # Method to initialize a new TaxTree object. def initialize @tree = TaxNode.new("root", "Root", 0, 0, 0.0) end @@ -55,6 +58,7 @@ class TaxTree end end + # Method to merge two TaxTrees. def merge(tree) node = @tree @@ -76,6 +80,7 @@ class TaxTree end end + # Method to flatten a TaxTree turning this into a list by recursive depth first traversal. def flatten(node = @tree, list = []) list << TaxNode.new(node.level, node.name, node.count, node.size, node.score) @@ -86,6 +91,8 @@ class TaxTree list end + # Method to recursively trim a TaxTree show that it only contains a unbranched tree, + # which gives the lowest common ancestor. def lowest_common_ancestor(node = @tree) node.children = {} if node.children.size > 1 @@ -94,6 +101,7 @@ class TaxTree end end + # Method for iterating over a TaxTree. def each self.flatten.each do |node| yield node @@ -104,6 +112,7 @@ class TaxTree private + # Method containing a helper hash to expand the phylogenetic level name. def expand_level(level) hash = { 'd' => "domain", @@ -121,6 +130,7 @@ class TaxTree hash[level] end + # Nested class for TaxTree nodes. class TaxNode attr_accessor :level, :name, :count, :size, :score, :children @@ -133,6 +143,7 @@ class TaxTree @children = {} end + # Method to convert a TaxNode to a Biopiece record. def to_bp record = {} record[:REC_TYPE] = "Classification" @@ -148,7 +159,7 @@ end casts = [] casts << {:long=>'LCA', :short=>'l', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'size', :short=>'s', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'size', :short=>'s', :type=>'uint', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} options = Biopieces.options_parse(ARGV, casts) -- 2.39.5