Enlightened Monks, I am writing to you today so that your wisdom may flow through me. I am working with a small problem that is a part of a larger string of programs.

The objective is to write a simple(<10 lines) script that will combine Maternal and Paternal strings into a new string:

1) Open my Table File, and skip the first line in the table as it is unnecessary for the task.

2) Read my file that is shown below two lines at a time(i guess). The Lines are IDed Maternal and Paternal strings of 0s and 1s.

3) Combine the the same ID strings by adding the 0s and 1s creating a new string.

4) Lastly I want to only keep and store the combined> and labeled strings that have 0s and 2s only, no 1s in the string.

THIS IS A SMALL PORTION OF THE FILE I AM WORKING WITH:

INDIV 16051347(G-C) 16051497(A-G) 16052239(A-G) 16052513(G-C) + 16052618(G-A) 16053659(A-C) 16054667(C-G) HG00096.M 0 0 0 1 1 1 1 + 1 0 0 0 0 0 HG00096.P 0 0 1 0 0 0 0 + 1 0 0 0 0 0 HG00097.M 1 1 0 0 0 0 0 + 0 0 0 0 1 0 HG00097.P 0 0 1 0 0 1 0 + 1 1 1 0 0 0 HG00099.M 1 1 0 0 0 0 0 + 0 0 0 0 0 0 HG00099.P 0 0 0 0 1 1 0 + 0 1 1 0 1 0 HG00100.M 0 0 1 1 1 1 1 + 1 1 1 1 1 1 HG00100.P 1 1 0 0 0 1 0 + 0 1 1 0 1 0 HG00101.M 1 1 0 0 0 1 0 + 0 1 1 0 1 0 HG00101.P 0 0 1 1 1 1 1 + 1 1 1 1 1 0 HG00102.M 1 1 0 0 0 0 0 + 0 0 0 0 1 0 HG00102.P 0 0 1 0 0 1 0 + 1 1 1 0 1 0

SO FOR 102 THE NEW STRING WOULD BE ONE I WOULD NOT WANT TO KEEP AS IT HAS 1s

1 1 1 0 0 1 0 1 1 + 1 0 1 0

THIS IS WHAT I CAME UP WITH SO FAR BUT ITS VERY INCOMPLETE SO PLEASE HELP ME BROTHERS

@add = (); open (TA, "Table_C22-17") || die "Can't open file"; while (<TA>) { $c++; if ($c > 1) {$count++; @a = split /\t/,$_; chop ($a[0]); for $x (0..$#a) { if ($count <= 2) { $add[$x] += $a[$x]; push (@tl, $add[$x]); next; } } } } $count = 0; print "@tl\n";

In reply to SEEKING HELP by A1 Transcendence

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.