Read a tab delimited file and search with perl
use strict; use warnings; use Data::Dumper; use Text::CSV; use IO::Handle; my $file = "/home/urbe/Tools/Alienomics_v0.1/Alienomics/output/intermediate_files/rRNA/refGene.megablast"; open my $fh, "[0]\n"; warn Dumper $row; # To see the structure }2521 days ago
Extract fasta sequence from a multifasta file with fasta header Ids
...@ARGV; my $fasta = shift @ARGV; my $out = shift @ARGV; my %select; open LIST, "$list" or die; while...homp; s/>//g; $select{$_} = 1; } close LIST; $/ = "\n>"; open OUT, ">$out" or die; open FA...2514 days ago
2508 days ago
Calculate Dinucleotide Frequency with Perl
#!/usr/bin/perl -w use strict; my ($genome, $head, $tail); my (%mono_nt, %di_nt); $/ = ">"; open my $fasta, '2334 days ago
Count the number of N in fasta file with Perl
#!/usr/bin/perl my ($h, $n, $l); open(I,$ARGV[0]) or die($!); while(){ chomp; if(/^>/){ $h=substr($_,1); }else{ $n=($_=~tr/nN/nN/); $l=length($_); print $h,"\t",$l,"\t",$n,"\t",$n/($l-$n),"\n"; } } close(I);2462 days ago
Extract the fastq sequence with range in Perl
use Bio::DB::Fasta; open(POSITIONS,"positions.txt"); while(){ chomp; my ($seqName,$begin,$end) = split(/\s/); my $db = Bio::DB::Fasta->new('allGenomeContacted.fa'); my $seq = $db->seq("$seqName", $begin => $end); print "$seq\n"; } close(POSITIONS);2464 days ago
Collision free write with Perl
...te into outfile -- collision free because of multicore usesage sub collision_free_write { my($outFile, $msg) = @_; open my $ofh, ">>", $outFile or die "$0 [$$]: open: $!"; flock $ofh, LOCK_EX...2457 days ago
Convert newline formated sequence into fasta format with perl
use strict; use warnings; my $filename = $ARGV[0]; open(my $fh, '2366 days ago
Reformat the file names with Perl
...copy("$files[$_].scf", $newName) or die "Copy failed: $!"; } } sub read_fh { my $filename = shift @_; my $filehandle; open $filehandle, "...2331 days ago
Convert fastq to fasta in Perl
use Bio::SeqIO; #convert .fastq.gz to .fasta open my $zcat, 'zcat seq.fastq.gz |' or die $!; my $in=Bio::SeqIO->new(-fh=>$zcat, -format=>'fastq'); my $o...2326 days ago