From: martinahansen Date: Wed, 12 Aug 2009 13:44:11 +0000 (+0000) Subject: added analyze_gc X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d55eed52586fe52477168339231f52783379ad7b;p=biopieces.git added analyze_gc git-svn-id: http://biopieces.googlecode.com/svn/trunk@633 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/analyze_gc b/bp_bin/analyze_gc new file mode 100755 index 0000000..4911124 --- /dev/null +++ b/bp_bin/analyze_gc @@ -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__ diff --git a/code_perl/Maasha/UCSC.pm b/code_perl/Maasha/UCSC.pm index 3dcc830..5c188fd 100644 --- a/code_perl/Maasha/UCSC.pm +++ b/code_perl/Maasha/UCSC.pm @@ -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; }