<?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: Owner]]></title>
	<link>https://bioinformaticsonline.com/snippets/owner/abhinav?offset=30</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/owner/abhinav?offset=30" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/27308/extract-a-random-sequence-from-a-file</guid>
	<pubDate>Thu, 12 May 2016 11:02:24 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/27308/extract-a-random-sequence-from-a-file</link>
	<title><![CDATA[Extract a random sequence from a file]]></title>
	<description><![CDATA[<code>#!/usr/local/bin/perl -w

use strict;
use warnings;
use autodie;

use List::Util qw/ shuffle /;

my $outputfile = &#039;randomoutput.txt&#039;;

open my $in_fh,  &#039;&lt;&#039;, &#039;seq1.fa&#039;;
open my $out_fh, &#039;&gt;&#039;, $outputfile;

my $size       = 21;
my $count      = 10;

while (my $line = &lt;$in_fh&gt;) {
   next unless $line =~ /^([ATGCN]+)/;

   my $genome     = $1;
   my $len_genome = length $genome;

   my @start_points = shuffle(0 .. $len_genome-$size);
   next unless @start_points &gt;= $count;
   print substr($genome, $_, 21), &quot;\n&quot; for @start_points[0 .. $count-1];
}</code>]]></description>
	<dc:creator>Abhi</dc:creator>
</item>

</channel>
</rss>