2908 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) {...$results{$&} = 1; } } foreach (sort keys %results) {...2908 days ago
Generating a random string with Perl
#!/usr/bin/perl # This function generates random strings of a given length...of # the random string to generate my @chars=('a'..'z','A'..'Z','0'..'9','_'); my $random_string; foreach (1..$length_of_randomstring)...2906 days ago
Needleman-Wunsch Algorithm in Perl
...PAWHEAE BLOSUM50.txt -8 # See: "Biological sequence anaysis" Durbin et al. ed. C...: $0 \n" unless @ARGV == 4; # get sequences, matrix and gapcost from co...) my $MATCH = 1; # +1 for letters that match my $MISMATCH = -1; # -1 for...2905 days ago
Count GC Content in nucleotide sequence with Perl
.../usr/bin/perl -w ### Usage: get_gc_content.pl...sta_file = $ARGV[0]; $out_file = "gc_out.txt"; unless ( open(IN,...(OUT, ">$out_file") ) { print "Couldn't create $out_file\n";...if (length($seq) > 0) { &process_it; } #start new line....2905 days ago
Implementation of biological random mutation with Perl
#!/usr/bin/perl -w use strict; use warnings; #sequence for a better recognition my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAA...the mutant DNA: \ n \ n"; print "$mutant \ n"; print "motorcycle 10 more successive mutati...2900 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($l2882 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,"2874 days ago
Perl script to extract fasta sequence by matching name/ids !!
...qw(trim); #Usage perl extractSeqbyID.pl ids.txt seq.fasta...$ARGV[2] or die "use extractSeqbyID.pl LIST FASTA OUT\n";...ist" or die; while () { chomp; next if /^\s*$/;...o avoid >flattened_line_10751 circular cases print OUT "...2874 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;2878 days ago