Perl script for calculate Levenshtein distance
sub levenshtein_dist { my ($str1, $str2) = @_; my ($len1, $len2) = (length $str1, length $str2); if ($len1 == 0) { return $len2; } if ($len2 == 0) { return $len1; } my %mat; for (my $i = 0; $i2337 days ago
Clump Finding Problem Solved with Perl
#Find patterns forming clumps in a string. #Given: A string Genome, and integers k, L, and t. #Return: All distinct k-mers forming (L, t)-clumps in Genome. use st...2331 days ago
Reformat the file names with Perl
#!/usr/bin/perl use strict; use warnings; use File::Copy qw(copy);; $| = 1; my %hash; my @files = glob "*.scf"; if (!$ARGV[0]){ print "Table file needed\n USA...2333 days ago
Convert fastq to fasta in Perl
use Bio::SeqIO; #convert .fastq.gz to .fasta open my $zcat, 'zcat seq.fastq.gz |' or die $!; my $in=Bio::SeqIO->new(-fh=>$zcat, -format=>'...2327 days ago
Fill up the form and blast with perl
use WWW::Mechanize; use strict; use warnings; my $mech = WWW::Mechanize->new; my $sequence = 'GCCCGCGGTCTCAGAGATCTCGATATATTATA'; $mech->get('http://www.arabid...2322 days ago
Insert the sequence at desire location in multi-fasta file with Perl
#!/usr/bin/perl use warnings; use strict; use Bio::SeqIO; use Bio::Seq; use File::Copy; #ARGV[0] should be in following format --- Keep the coordinate sorted by n...2311 days ago
Create genome scaffolding with Perl
#!/usr/bin/perl use warnings; use strict; use English; use Pod::Usage; ## uses pod documentation in usage code use Getopt::Long qw(:config auto_version auto_help p...2305 days ago
Plot the clock using Lastz -gerenal outfile
use strict; use warnings; use Statistics::R ; use List::Util qw(sum); #Usage perl clockPlot.pl Palindrome.palfc 1500 my $R = Statistics::R->new() ; $R->startR ; my $fileN...2296 days ago
Remove duplicate lines with perl
#! perl -sw use strict; my %lines; #open DATA, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n"; while () { print if not $lines{$_}++; } __DATA__ apple apple plum vinegar apple banana banana banana apple2289 days ago
Remove the duplicated line present only next to each other with Perl
#!/usr/bin/perl use strict; use warnings; { $_ = ; my $next_line; while( $next_line = ) { #print "current line: $_ -- next line: $next_line$/";...2289 days ago