Find and replace ambiguous characters in fasta file with Perl and Bioperl
#!/usr/bin/perl -w my $usage="\nUsage: $0 [-h] [-m char] [fastaFileName1 ...]\n". " -h: help\n". " -m: missing character\n". "Print out the name of sequences wi...2908 days ago
Perl program to implement sliding window !
#!/usr/bin/perl -w my $filename = 'data.txt'; open(my TR, '2908 days ago
2903 days ago
Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl
...d text = $& if(exists $results{$&}) { $results{$&}++ } else { $results{$&} = 1; } } foreach (so...2903 days ago
Generating a random string with Perl
...@chars=('a'..'z','A'..'Z','0'..'9','_'); my $random_string; foreach (1..$length_of_randomstring)...#Generate the random string my $random_string=&generate_random_string(11); print "Random string: "...2901 days ago
Needleman-Wunsch Algorithm in Perl
...xt -8 # See: "Biological sequence anaysis" Durbin et al. ed. CUP 1998, Pg. 19 # Needleman-Wunsch global a...== 4; # get sequences, matrix and gapcost from command line my ($seq1, $seq2, $smfile, $gapcost) =...2899 days ago
Count GC Content in nucleotide sequence with Perl
...-------------------------------- if ($#ARGV == -1) { usage(); exit;...t new line. $id = $_; $id =~ s/^>(.+?)\s.+$/$1/g; print OUT "$id\t";...} if ($totalcount > 0) { $gccontent = (100 * $gccount) / $totalcount;...2899 days ago
Implementation of biological random mutation with Perl
...t "Here is the the original DNA: \ n"; print "$DNA \ n"; print "Here is the mutant DNA: \ n \ n"; print "$mutant \ n"; print "motorcycle 10 more successive mutations: \...2895 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,"2869 days ago
Perl script to extract fasta sequence by matching name/ids !!
...*$/; s/>//g; my @ids=split (/\t/, $_); $select{$ids[0]} = 1; } my $size = keys %select;...lit (/\n/, $_); #my @i=split (/\s/, $id); # To avoid >flattened_line_10751 circular cases print...2869 days ago