Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found