Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl
...$results{$&}++ } else { $results{$&} = 1; } } foreach (sort keys %results) { print "$_ : $results{$_}\n"; }...2923 days ago
2923 days ago
Generating a random string with Perl
...@chars]; } return $random_string; } #Generate the random string my $random_string=&generate_random_string(11); print "Random string: ".$random_string."\n"; print "Length: ".length($random_str...2921 days ago
Needleman-Wunsch Algorithm in Perl
#!/usr/bin/perl # USAGE: perl nw.pl HEAGAWGHEE PAWHEAE BLOSUM50.txt -8 # See: "Biological sequence anaysis" Durbin et al. ed. CUP 1998, Pg. 19 # Needleman...2920 days ago
Count GC Content in nucleotide sequence with Perl
...unless ( open(IN, "$fasta_file") ) { print "Got a bad fasta file: $fasta...} unless ( open(OUT, ">$out_file") ) { print "Couldn't create $out_file\n"...e. $id = $_; $id =~ s/^>(.+?)\s.+$/$1/g; print OUT "$id\t"; } else...2920 days ago
Implementation of biological random mutation with Perl
...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \ n"; my $I; my $mutant; srand (time | $$). $mutant=mutate ($DNA); print "Mutate \ n". $DNA; print "Here is the the original DNA...2915 days ago
Perl script to generate a random psuedo DNA sequence !
#!/usr/bin/perl print "Enter a number of nucleotides: \n"; chomp ($N = ); @b=qw/A T G C/;print ">Genome\n";while($l2897 days ago
Perl script to extract lines with matching ids !!
#!/usr/bin/perl use strict; use warnings; my %patterns; #USAGE: perl extactByIds.pl Idsfile1 file2 > Result # Open file and get patterns to search for open(my $fh2,"2889 days ago
Perl script to find the absolute "full" path of the file !
#!/usr/bin/perl use Cwd; my $this_file_full_path = Cwd::abs_path(__FILE__); print "$this_file_full_path\n"; use Cwd qw/ realpath /; ## $0; this script my $path = realpath($0); print $path;2893 days ago
Perl script to extract fasta sequence by matching name/ids !!
...it (/\t/, $_); $select{$ids[0]} = 1; } my $size = keys %select; print "Total Ids $size\n"; close L...split (/\s/, $id); # To avoid >flattened_line_10751 circular cases print OUT ">$_" if (defined $select...2889 days ago