]> git.donarmstrong.com Git - biopieces.git/commitdiff
added analyze_gc
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 12 Aug 2009 13:44:11 +0000 (13:44 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 12 Aug 2009 13:44:11 +0000 (13:44 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@633 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/analyze_gc [new file with mode: 0755]
code_perl/Maasha/UCSC.pm

diff --git a/bp_bin/analyze_gc b/bp_bin/analyze_gc
new file mode 100755 (executable)
index 0000000..4911124
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2007-2009 Martin A. Hansen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# http://www.gnu.org/copyleft/gpl.html
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+# Analyze GC content in sequences in the stream.
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+use warnings;
+use strict;
+use Maasha::Biopieces;
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+my ( $options, $in, $out, $record, $gc );
+
+$options = Maasha::Biopieces::parse_options();
+
+$in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
+$out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } );
+
+while ( $record = Maasha::Biopieces::get_record( $in ) ) 
+{
+    $record->{ 'GC%' } = sprintf( "%.2f", ( $record->{ "SEQ" } =~ tr/GgCc// / length $record->{ "SEQ" } ) * 100 ) if $record->{ "SEQ" };
+
+    Maasha::Biopieces::put_record( $record, $out );
+}
+
+Maasha::Biopieces::close_stream( $in );
+Maasha::Biopieces::close_stream( $out );
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+BEGIN
+{
+    Maasha::Biopieces::status_set();
+}
+
+
+END
+{
+    Maasha::Biopieces::status_log();
+}
+
+
+# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+
+__END__
index 3dcc830f23729aafe40dc5a13da19b5bbcc9b1a5..5c188fd1ffbaa800cf5dd42cb8238297b4c0728d 100644 (file)
@@ -1295,7 +1295,7 @@ sub phastcons_normalize
 
     # Normalizes a list of lists with PhastCons scores,
     # in such a way that each list contains the same number
-    # or PhastCons scores.
+    # of PhastCons scores.
 
     my ( $AoA,    # AoA with PhastCons scores
        ) = @_;
@@ -1359,7 +1359,7 @@ sub phastcons_list_inflate
         # splice @{ $list }, $pos, 0, "X";
     }
 
-    die qq(ERROR: bad inflate\n) if scalar @{ $list } != $len + $diff;
+    die qq(ERROR: Bad inflate\n) if scalar @{ $list } != $len + $diff;
 }
 
 
@@ -1389,7 +1389,7 @@ sub phastcons_list_deflate
         splice @{ $list }, $pos, 1;
     }
 
-    die qq(ERROR: bad deflate\n) if scalar @{ $list } != $len - $diff;
+    die qq(ERROR: Dad deflate\n) if scalar @{ $list } != $len - $diff;
 }