<?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: Perl script to insert the DNA string in genome]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/30650/perl-script-to-insert-the-dna-string-in-genome?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/30650/perl-script-to-insert-the-dna-string-in-genome?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/30650/perl-script-to-insert-the-dna-string-in-genome</guid>
	<pubDate>Mon, 23 Jan 2017 10:04:55 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/30650/perl-script-to-insert-the-dna-string-in-genome</link>
	<title><![CDATA[Perl script to insert the DNA string in genome]]></title>
	<description><![CDATA[<code>#!/usr/bin/perl

use warnings;
use strict;
use Bio::SeqIO;
use Bio::Seq;

my $file = $ARGV[0]; # input fasta file (genome file)
my $out = $ARGV[1]; # output fasta file

my $chr=&quot;test&quot;; #insertion chromosome
my $pos=10; # position of the insertion
my $seqI = &quot;AAAA&quot;; #sequence of the insertion

my $seq_in  = Bio::SeqIO-&gt;new( -format =&gt; &#039;fasta&#039;,-file =&gt; $file);
my $seq_out = Bio::SeqIO-&gt;new( -format =&gt; &#039;fasta&#039;,-file =&gt; &quot;&gt;&quot;.$out);
while( my $seq = $seq_in-&gt;next_seq() ) {    
    if($seq-&gt;primary_id eq $chr){
        my $length = length($seq-&gt;seq);    
        my $upstream=substr($seq-&gt;seq, 0, $pos);
        my $downstream=substr($seq-&gt;seq, $pos,$length);        
        my $seq_obj = Bio::Seq-&gt;new(-seq =&gt; $upstream.$seqI.$downstream,-display_id =&gt; $seq-&gt;primary_id,-alphabet =&gt; &quot;dna&quot; );
            $seq_out-&gt;write_seq($seq_obj);
    }
    else{
        $seq_out-&gt;write_seq($seq);
    }
}</code>]]></description>
	<dc:creator>Shruti Paniwala</dc:creator>
</item>

</channel>
</rss>