Perl script to extract fasta sequence by matching name/ids !!
...ta $ARGV[2] or die "use extractSeqbyID.pl LIST FASTA OUT\n"; my $list = shift @ARGV; my $fasta = shift @ARGV; my $ou.../g; my @ids=split (/\t/, $_); $select{$ids[0]} = 1; } my $size = keys %select; print...2918 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;2922 days ago
Perl subroutine to read and write files
...#$string = "YO!"; #InOut('write','file.txt',\$string); sub InOut { my($bit,$file,$data) = @_; if...open InOut,"< $file" or die "Cannot open $file for input: $!\n"; my @file = ; close InOut;...2909 days ago
Perl script introduces control structures, arrays and hashes.
...sr/bin/env perl use strict; use warnings; my @first_array = ('DNA', 'ATGCG...n"; # Scalar gives actual size of an array my $size_of_array = scalar(@firs...ze_of_array\n\n"; # Control Loop: for for (my $i=0; $i 'ATCGATGCT',...2905 days ago
Perl script to insert sequence in contig !!
# sub signature: #insertSEQintoCONTIGatLOC( SEQ , CONTIG , LOC ) ; sub insertSEQintoCONTIGatLOC{ my ( $SEQ , $CONTIG , $LOC ) = @_; substr( $CONTIG , $LOC , -length($CONTIG...2752 days ago
2747 days ago
2736 days ago
2736 days ago
Perl script to remove the duplicate sequences from multifasta file
use strict; use Bio::SeqIO; my %unique; my $file = "myseqs.fa"; my $seqio = Bio::Seq...IO->new(-file => $file, -format => "fasta"); my $outseq = Bio::SeqIO->new(-fi...">$file.uniq", -format => "fasta"); while(my $seqs = $seqio->next_seq) {...2733 days ago
Perl script to insert the DNA string in genome
...ct; use Bio::SeqIO; use Bio::Seq; my $file = $ARGV[0]; # input fasta file (genome file) my $out = $ARGV[1]; # output fas...$pos=10; # position of the insertion my $seqI = "AAAA"; #sequence of...if($seq->primary_id eq $chr){ my $length = length($seq->seq);...2702 days ago