<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Plot the clock using Lastz -gerenal outfile]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/35265/plot-the-clock-using-lastz-gerenal-outfile?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/35265/plot-the-clock-using-lastz-gerenal-outfile?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/35265/plot-the-clock-using-lastz-gerenal-outfile</guid>
	<pubDate>Thu, 18 Jan 2018 11:05:25 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/35265/plot-the-clock-using-lastz-gerenal-outfile</link>
	<title><![CDATA[Plot the clock using Lastz -gerenal outfile]]></title>
	<description><![CDATA[<code>use strict;
use warnings;
use Statistics::R ;
use List::Util qw(sum);

#Usage  perl clockPlot.pl Palindrome.palfc 1500
my $R = Statistics::R-&gt;new() ;
$R-&gt;startR ;

my $fileN=$ARGV[0];
my $mSize=$ARGV[1];
open (my $fh2, $fileN) or die &quot;Could not open file $fileN $!&quot;;
my (@allKeys, @allFreq); my %pHash;
while(&lt;$fh2&gt;) {
	chomp;
	next if /^$/; #next if empty
	my @arr = split(&quot;\t&quot;, $_);
	if ($arr[7] eq &quot;-&quot;) {
		my $len=$arr[5]-$arr[4];
		#next if $len &lt; $mSize;
		my @chr = split &#039;\_&#039;, $arr[1];
		$chr[0] =~ s/[a-z]//g;
		my $newChr=&quot;$chr[0]&quot;.&quot;_&quot;.&quot;$arr[3]&quot;;
		$pHash{$newChr}++;
	}
}

foreach my $val (keys %pHash) {
	#next if $pHash{$val} &gt; 10;
	my @sChr = split &#039;\_&#039;, $val;
	my $score=$pHash{$val}/$sChr[1];
	push @allKeys, $sChr[0];
	push @allFreq, $score;
}

my $allKeys=join &#039;,&#039;, @allKeys;
my $allFreq=join &#039;,&#039;, @allFreq;
my $hLen=scalar (@allKeys);
my $ll=&quot;$hLen&quot;.&#039;L&#039;;

$R-&gt;run(qq`
d &lt;- structure(list(Chromosome = c($allKeys), Frequency = c($allFreq)), .Names = c(&quot;Chromosome&quot;, &quot;Frequency&quot;
), row.names = c(NA, $ll), class = &quot;data.frame&quot;)
str(d)

library(ggplot2)
ggplot(d , aes(x =  Chromosome, y =  Frequency, fill=Frequency)) +
  coord_polar(theta = &quot;x&quot;, start = -pi/5) +
  geom_bar(stat = &quot;identity&quot;) + 
  scale_x_continuous(breaks = seq(0, $hLen, 50))`);

$R-&gt;stopR() ;</code>]]></description>
	<dc:creator>Jit</dc:creator>
</item>

</channel>
</rss>