Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to split fasta sequence and create overlaps

  • Public
By BioJoker 1975 days ago
#!/usr/bin/perl use strict; use warnings; my $len = 5000; my $over = 200; my $seq_id=$ARGV[0]; my $seqFile = $ARGV[1]; my $seq; open(my $fh, "<", "$seqFile") or die "Can't open < $seqFile: $!"; while (<$fh>) { chomp; if (m/^>/) { $seq_id = $_; } else { $seq .= $_; } } for (my $i = 1; $i <= length $seq; $i += ($len - $over)) { my $s = substr ($seq, $i - 1, $len); print "$seq_id.($i-", $i + (length $s) - 1, ")\n$s\n"; }