Dear Perl Monks. I have an interesting problem, I need to combine two tab-delimited tables, that are of different dimensions. The first one has 5 columns while the second 10, so in principle I need a new table with 15 columns.Underneath are the first lines of each file

miR BC1 BC2 BC3 BC4 BC5 hsa-mir-223 3arm 47,99932662 10,24365339 13,55247228 10,45 +37212 19,12230677 hsa-mir-21 5arm 9,382432686 14,37697968 16,24729954 11,061 +31971 14 begin_of_the_skype_highlighting              06131971 14  +     end_of_the_skype_highlighting begin_of_the_skype_highlighting    +           06131971 14      end_of_the_skype_highlighting begin_of_th +e_skype_highlighting              06131971 14      end_of_the_skype_h +ighlighting,07563561 hsa-mir-24 3arm 5,268913507 17,15846054 13,48409367 14,532 +89899 10,16886185

the second file

miR C14C C14P CD4C CD4P CD8C CD8P T0H T48H +TH1 TH2 hsa-mir-150 5arm 2,908940033 0,438105498 31,86213 19,53177 +981 43,48177377 59,26980003 0,23934135 0,40506398 16,2 +8900742 14,75863711 hsa-mir-223 3arm 26,49304598 15,18021615 4,083714993 9,840 +496003 1,934720532 0,568416266 30,72565058 14,62196623 + 0,069010679 0,039852851

What I need is to create a combined table. The first part of my program just reads the first line of each file, and then splits it and prints a new file where the columns are the combined columns of each file. so far so good. The second step is to read each valuse in the miR column from file 1 and compare it with each value in the miR column of file 2. That also works. I am though stuck in the next step because I cannot think of a way to do it. I need to print if there is no corresponding values zero's and if there are corresponding values, a combined line that has the results from both, so as in the first row there are no duplicate entries.

I don't know if I made it clear what it is I need to do, but any suggestions and ideas on how to do it would be highly appreciated

Thank you in advance for your help!

In reply to Combining tab delimited tables by gogoglou

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.