Hi monks,
I am here with a new query. Hope to get a quick reply.
I am try to search for the number of occurrence of 10 hexamer word in a big file of fasta sequence.
I want to get the number of occurrence of each hexamer at each position till 5000, which is the longest sequence.
the code i wrote is given below
#!/usr/bin/perl use Data::Dumper; open $f,$ARGV[0]; while(<$f>) { chomp; $id = $_; #eat up the header line chomp($s = <$f>); if($s !~ /^>/) { push @seq,$s; } } open $fa, "top_10_hexamers.txt"; while(<$fa>) { chomp; $hx{$_}++; #hash of 10 hexamer } @words = sort keys %hx; for($i = 1;$i < 5000;$i++) { for($j = 0;$j <= $#words;$j++) { $result[$i][$j] = 0; # array of 5000 columns of positi +on and words as columns } } foreach $x(@seq) { for($j = 0; $j < (length($x) - 6);$j++) { $wrd = substr $x,$j,6; #getting the hexamer c +ombinations foreach $w(@words) { if($w eq $wrd) # comparing with the w +ord { $result->{$j}->{$wrd}++; # try +ing to get position, word and frequency } } } $wrd = ""; } print Dumper $result;
It worked for me when my sequences where 50 bases long. I used to get a hash named $VAR1. But Now I am working with 5000, and it prints $VAR1 = undef;
Can any one help me with this problem.
Thank you in advance,
Best regards,
Deepak
In reply to Dumb problem with dumper. by oxydeepu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |