[Bio] / FigKernelScripts / rs_create_ref_profile.pl Repository:
ViewVC logotype

View of /FigKernelScripts/rs_create_ref_profile.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Jun 3 16:44:35 2013 UTC (6 years, 5 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
the rna_seq pipeline

use strict;
use Data::Dumper;
use File::Basename;
use Getopt::Long;
use SeedEnv;


my %counters;
while (defined($_ = <STDIN>))
{
    chomp;
    my @flds = split(/\s+/,$_);
    my $contig = $flds[1];
    my $beg = $flds[8];
    my $end = $flds[9];
    my $strand = ($beg < $end) ? "+" : "-";
    if ($beg > $end) 
    {
	($beg,$end) = ($end,$beg);
    }
    while ($beg <= $end)
    {
	$counters{$contig}->{"$beg,$strand"}++;
	$beg++;
    }
}

foreach my $contig (keys(%counters))
{
    my $hits = $counters{$contig};
    my @pos = keys(%$hits);
    my $max = 0;
    foreach $_ (@pos)
    {
	if (($_ =~ /^(\d+)/) && ($1 > $max)) { $max = $1 }
    }

    my $i;
    for ($i=1; ($i < $max); $i++)
    {
	my $x = $hits->{"$i,+"};
	if (! defined($x))
	{
	    $x = 0;
	}
	print join("\t",($contig,$i,"+",$x)),"\n";

	$x = $hits->{"$i,-"};
	if (! defined($x))
	{
	    $x = 0;
	}
	print join("\t",($contig,$i,"-",$x)),"\n";
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3