Hi Monks,

I am running to this problem explained below. I would appreciate if you could give me your ideas and inputs to solve the following situation. Here is my data structure.

The fields are tab delimited. Ignore the alignment. The last column numbers are aligned in the original file.

Name Pos gc score present_absent CLS_S3_Contig1000 1 0 . . . . . . . . . . . . CLS_S3_Contig1000 67 0 CLS_S3_Contig1000 68 0 CLS_S3_Contig1000 69 0 CLS_S3_Contig1000 70 0 CLS_S3_Contig1000 71 0 CLS_S3_Contig1000 72 0 CLS_S3_Contig1000 73 0 CLS_S3_Contig1000 74 0 CLS_S3_Contig1000 75 0 CLS_S3_Contig1000 76 0 CLS_S3_Contig1000 77 9 0.4324 1 CLS_S3_Contig1000 78 0 CLS_S3_Contig1000 79 8 0.3904 1 CLS_S3_Contig1000 80 0 CLS_S3_Contig1000 81 9 0.452 1 CLS_S3_Contig1000 82 0 CLS_S3_Contig1000 83 11 0.4807 1 CLS_S3_Contig1000 84 0 CLS_S3_Contig1000 85 10 0.4892 1 CLS_S3_Contig1000 86 0 CLS_S3_Contig1000 87 10 0.5234 1 CLS_S3_Contig1000 88 0 CLS_S3_Contig1000 89 11 0.5374 1 CLS_S3_Contig1000 90 0 CLS_S3_Contig1000 91 10 0.5249 1 CLS_S3_Contig1000 92 0 CLS_S3_Contig1000 93 11 0.5553 1 <p> #The name is changing here and it will change over and over <p> CLS_S3_Contig10007 1 0 . . . . . . . . . . . . CLS_S3_Contig10007 43 0 CLS_S3_Contig10007 44 0 CLS_S3_Contig10007 45 0 CLS_S3_Contig10007 46 0 CLS_S3_Contig10007 47 0 CLS_S3_Contig10007 48 0 CLS_S3_Contig10007 49 0 CLS_S3_Contig10007 50 0 CLS_S3_Contig10007 51 0 CLS_S3_Contig10007 52 0 CLS_S3_Contig10007 53 10 0.4316 1 CLS_S3_Contig10007 54 0 CLS_S3_Contig10007 55 12 0.5951 1 CLS_S3_Contig10007 56 0 CLS_S3_Contig10007 57 0 CLS_S3_Contig10007 58 0 CLS_S3_Contig10007 59 12 0.5825 1 CLS_S3_Contig10007 60 0 CLS_S3_Contig10007 61 12 0.4785 1 CLS_S3_Contig10007 62 0 CLS_S3_Contig10007 63 14 0.566 1 CLS_S3_Contig10007 64 0 CLS_S3_Contig10007 65 14 0.4894 1 CLS_S3_Contig10007 66 0 CLS_S3_Contig10007 67 15 0.4756 1 CLS_S3_Contig10007 68 0

This is what I want to do. If present_absent column is ==1 for plus/minus 8 positions put present_absent ==1. For any positions 1-8 if present_absent column==0 skip it, if not put for positions 1-8 present_absent column==1 For max position number if present_absent column is 0 then for max - 8 put present_absebt colum ==1

After these conditions the data should look like this.

Name Pos gc score present_absent CLS_S3_Contig1000 1 0 . . . . . . . . . . . . CLS_S3_Contig1000 67 0 CLS_S3_Contig1000 68 0 CLS_S3_Contig1000 69 1 CLS_S3_Contig1000 70 1 CLS_S3_Contig1000 71 1 CLS_S3_Contig1000 72 1 CLS_S3_Contig1000 73 1 CLS_S3_Contig1000 74 1 CLS_S3_Contig1000 75 1 CLS_S3_Contig1000 76 1 CLS_S3_Contig1000 77 9 0.4324 1 CLS_S3_Contig1000 78 1 CLS_S3_Contig1000 79 8 0.3904 1 CLS_S3_Contig1000 80 1 CLS_S3_Contig1000 81 9 0.452 1 CLS_S3_Contig1000 82 1 CLS_S3_Contig1000 83 11 0.4807 1 CLS_S3_Contig1000 84 1 CLS_S3_Contig1000 85 10 0.4892 1 CLS_S3_Contig1000 86 1 CLS_S3_Contig1000 87 10 0.5234 1 CLS_S3_Contig1000 88 1 CLS_S3_Contig1000 89 11 0.5374 1 CLS_S3_Contig1000 90 1 CLS_S3_Contig1000 91 10 0.5249 1 CLS_S3_Contig1000 92 1 CLS_S3_Contig1000 93 11 0.5553 1 #The name is changing here and it will change over and over CLS_S3_Contig10007 1 0 . . . . . . . . . . . . CLS_S3_Contig10007 42 0 CLS_S3_Contig10007 43 0 CLS_S3_Contig10007 44 0 CLS_S3_Contig10007 45 1 CLS_S3_Contig10007 46 1 CLS_S3_Contig10007 47 1 CLS_S3_Contig10007 48 1 CLS_S3_Contig10007 49 1 CLS_S3_Contig10007 50 1 CLS_S3_Contig10007 51 1 CLS_S3_Contig10007 52 1 CLS_S3_Contig10007 53 10 0.4316 1 CLS_S3_Contig10007 54 1 CLS_S3_Contig10007 55 12 0.5951 1 CLS_S3_Contig10007 56 1 CLS_S3_Contig10007 57 1 CLS_S3_Contig10007 58 1 CLS_S3_Contig10007 59 12 0.5825 1 CLS_S3_Contig10007 60 1 CLS_S3_Contig10007 61 12 0.4785 1 CLS_S3_Contig10007 62 1 CLS_S3_Contig10007 63 14 0.566 1 CLS_S3_Contig10007 64 1 CLS_S3_Contig10007 65 14 0.4894 1 CLS_S3_Contig10007 66 1 CLS_S3_Contig10007 67 15 0.4756 1 CLS_S3_Contig10007 68 1

In reply to 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.