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; $i2368 days ago
Calculate Dinucleotide Frequency with Perl
#!/usr/bin/perl -w use strict; my ($genome, $head, $tail); my (%mono_nt, %di_nt); $/ = ">"; open my $fasta, '2366 days ago
Reformat the file names with Perl
...ings; use File::Copy qw(copy);; $| = 1; my %hash; my @files = glob "*.scf"; if...le file needed\n USAGE: $0 table\n"; exit;} my $ifh = read_fh($ARGV[0]); wh...(0..$#files){ $files[$_] =~ s/\.scf$//; my @pName = split /\_/, $files[$...2363 days ago
Clump Finding Problem Solved with Perl
...k-mers forming (L, t)-clumps in Genome. use strict; use warnings; my %myHash; my $string="CGGACTCGACA...y $kmer=5; for (my $aa=0; $aa $max) { $max = $km;} #print "$km\t$myStr\n"; $myHash{$myStr}=$...2361 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=>'fastq'); my $out=Bio::SeqIO->new(-file=>'...2358 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....arabidopsis.org/Blast/'); $mech->submit_form( form_name => 'myForm', fields => { 'Al...2353 days ago
Insert the sequence at desire location in multi-fasta file with Perl
...hrName locationStart AlienGene AlienLength # The coordinate should not overlaps --- next postition shold be bigger than firstpos+alienLen open(my $fh, '2341 days ago
Create genome scaffolding with Perl
...; } sub getConsensus { my ($b1, $b2) = @_; if(($b1 e..."N"); } sub getMatch { my ($b1, $b2) = @_; return(((...ences into memory..."); open(my $queryFile, "=21 tab-separate...ost), length($lPost)); my $lastS = $sBlStarts[0];...2336 days ago
Plot the clock using Lastz -gerenal outfile
...perl clockPlot.pl Palindrome.palfc 1500 my $R = Statistics::R->new() ; $R->startR ; my $fileN=$ARGV[0]; my $mSize=$...le $fileN $!"; my (@allKeys, @allFreq); my %pHash; while() { chomp;...$pHash{$newChr}++; } } foreach my $val (keys %pHash) { #next...2326 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 apple2320 days ago