Thank your very much GrandFather,

The code works perfect, but when the gap between two adjacent PIP in the original file is large let's say 16 or more it behaves differently.

Please take a look at the input and output files I have included here. In the output after 949 it has printed three "1"s instead of 8.

I went through the code and I think a condition should be added here. To see if the gap in pip is greater or equal to 16. is my speculation right?

my $first = $pip > 8 ? $pip - 8 : 0; my $last = $pip + 8;
Original CLS_S3_Contig1000 933 10 0.488 CLS_S3_Contig1000 935 9 0.4867 CLS_S3_Contig1000 937 9 0.4989 CLS_S3_Contig1000 939 10 0.503 CLS_S3_Contig1000 943 8 0.3531 CLS_S3_Contig1000 949 8 0.3477 CLS_S3_Contig1000 1060 6 0.1498 CLS_S3_Contig1000 1070 9 0.3885 CLS_S3_Contig1000 1071 8 0.3848 OUTPUT CLS_S3_Contig1000 933 10 0.488 1 CLS_S3_Contig1000 934 1 CLS_S3_Contig1000 935 9 0.4867 1 CLS_S3_Contig1000 936 1 CLS_S3_Contig1000 937 9 0.4989 1 CLS_S3_Contig1000 938 1 CLS_S3_Contig1000 939 10 0.503 1 CLS_S3_Contig1000 940 1 CLS_S3_Contig1000 941 1 CLS_S3_Contig1000 942 1 CLS_S3_Contig1000 943 8 0.3531 1 CLS_S3_Contig1000 944 1 CLS_S3_Contig1000 945 1 CLS_S3_Contig1000 946 1 CLS_S3_Contig1000 947 1 CLS_S3_Contig1000 948 1 CLS_S3_Contig1000 949 8 0.3477 1 CLS_S3_Contig1000 950 1 CLS_S3_Contig1000 951 1 CLS_S3_Contig1000 952 0 CLS_S3_Contig1000 953 0 CLS_S3_Contig1000 954 0 CLS_S3_Contig1000 955 0 CLS_S3_Contig1000 956 0 CLS_S3_Contig1000 957 0

In reply to Re^2: Hash_of_Hash_Would do it? by Anonymous Monk
in thread Hash_of_Hash_Would do it? by sesemin

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.