Blast result parser with Perl and Bioperl
...# This script will parse a NCBI blastx output file and output the top N hits of...ie "Usage: $0 \n", if (@ARGV != 3); my ($infile,$numHits,$outfile) = @ARGV;...open (OUT,">$outfile") or die "Cannot open $outfile: $!"; # print the header i...2928 days ago
Find and replace ambiguous characters in fasta file with Perl and Bioperl
...my $usage="\nUsage: $0 [-h] [-m char] [fastaFileName1 ...]\n". " -h: hel...the ambigous characters.\n" . "If multiple files are given, sequences in all...(); @ARGV = ('-') unless @ARGV; while (my $file = shift) { my $seqio_obj...2928 days ago
Perl program to implement sliding window !
#!/usr/bin/perl -w my $filename = 'data.txt'; open(my TR, '2928 days ago
2928 days ago
Needleman-Wunsch Algorithm in Perl
...et sequences, matrix and gapcost from command line my ($seq1, $seq2, $smfile, $gapcost) = @ARGV; # scor...SUM50 = (); my @aalist = (); # read substitution matrix open in, $smfile; while(){ if($.2920 days ago
Count GC Content in nucleotide sequence with Perl
...------------------------------------------------------------------------------ if ($#ARGV == -1) { usage(); exit; } $fasta_file = $ARGV[0]; $out_file = "gc_out.txt"; unless ( ope...2920 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 !!
...s $size\n"; close LINE; $/ = "\n>"; open OUT, ">$out" or die; open FILE, "$fasta" or die; while () {...circular cases print OUT ">$_" if (defined $select{$id}); } close FILE; close OUT;2889 days ago
Perl subroutine to read and write files
# Input output (InOut) the file # usage: # @array = InOut('read',$file) # $string = InOut('read',$file) # InOut('write',$file,\$string) # InOut('write',$fil...ring); sub InOut { my($bit,$file,$data) = @_; if($bit eq 'r...'write'){ open InOut,"> $file" or die "Cannot open $file fo...2880 days ago