Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to insert the DNA string in genome

  • Public
By Shruti Paniwala 2852 days ago
#!/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="test"; #insertion chromosome my $pos=10; # position of the insertion my $seqI = "AAAA"; #sequence of the insertion my $seq_in = Bio::SeqIO->new( -format => 'fasta',-file => $file); my $seq_out = Bio::SeqIO->new( -format => 'fasta',-file => ">".$out); while( my $seq = $seq_in->next_seq() ) { if($seq->primary_id eq $chr){ my $length = length($seq->seq); my $upstream=substr($seq->seq, 0, $pos); my $downstream=substr($seq->seq, $pos,$length); my $seq_obj = Bio::Seq->new(-seq => $upstream.$seqI.$downstream,-display_id => $seq->primary_id,-alphabet => "dna" ); $seq_out->write_seq($seq_obj); } else{ $seq_out->write_seq($seq); } }