Blast result parser with Perl and Bioperl
...ation die "Usage: $0 \n", if (@ARGV != 3); my ($infile,$numHits,$outfile) = @ARGV; print "Parsing the BLAST result ..."; my $in = Bio::SearchIO->new(-for...print OUT "\tNo hits found\n"; } else { my $count = 0;...2964 days ago
Find and replace ambiguous characters in fasta file with Perl and Bioperl
#!/usr/bin/perl -w my $usage="\nUsage: $0 [-h] [-m char] [..."$usage\n" if (defined($opt_h)); my $format = "fasta"; my @seqAr...@ARGV = ('-') unless @ARGV; while (my $file = shift) { my $seq...exit; sub AmbiguousChar { my $string = shift; $string...2964 days ago
Perl program to implement sliding window !
#!/usr/bin/perl -w my $filename = 'data.txt'; open(my TR, '2964 days ago
2964 days ago
Perl to print indivisual nucleotide from a sequence!
#!/usr/bin/perl use strict; use warnings; my $string = "ATGCTTGCGT?AAATG??CT?GCGTA"; my @chars = split("", $string); print "First character: $chars[0]\n";2964 days ago
Find the number of each 2 consecutive characters AA, AC,AG,AT,CC,CA... with Perl
#!/usr/bin/perl -w use strict; my $subject = "AACGTACTGACGTACTGGTTGGTACGA"; my %results = (); while ($subject =~ m/[ACTG][ATGC]/g) { # matched text = $& if(exists $results{$&})...2959 days ago
Generating a random string with Perl
...a given length sub generate_random_string { my $length_of_randomstring=shift...gth of # the random string to generate my @chars=('a'..'z','A'..'Z','0'...andom_string; } #Generate the random string my $random_string=&generate_rand...2957 days ago
Needleman-Wunsch Algorithm in Perl
...ess @ARGV == 4; # get sequences, matrix and gapcost from command line my ($seq1, $seq2, $smfile, $gapc...g fixed MATCH and MISMATCH scores we will use values read from BLOSUM50) my $MATCH = 1; # +1 for lett...2955 days ago
Implementation of biological random mutation with Perl
...use strict; use warnings; #sequence for a better recognition my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \ n"; my $I; my $mutant; srand (...2951 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,"2925 days ago