Hi Monks,

I'm with the following problem:

I have data in a CSV file:(contig name, species name)

contig2, ponkan

contig2, orange

contig2, clementine

contig2, maxima

contig8, maxima

contig8, orange

contig8, clementine

contig8, ponkan

contig8, medica

contig8, maxima

contig8, ponkan

contig9, maxima

contig9, orange

contig9, clementine

contig9, ponkan

contig9, medica

contig9, maxima

contig9, ponkan

contig9, ponkan

.

.

.

Excel CSV. file with more rows of data

My output should look like:

contig8 = maxima, orange, clementine, ponkan, medica

contig9 = maxima, orange, clementine, ponkan, medica

Perl script should read the first column and select entries equal (ie: lines with contig8 entry, for example) and then evaluate the second column of those selected entries and check if it have the five elements (maxima, orange, clementine, ponkan, doctors), selected will be in the output file. The entries (lines) that do not have the five elements (maxima, orange, clementine, ponkan, medical) will not be selected (ie: contig2) and not will be in the output file.

I ask help and suggestions from you all on how to proceed in the analysis of these data. Please excuse any mistakes as English is my second language

Thank you very much!


In reply to Extracting data from CSV file + Extracting selected few lines through perl by NicholasNVS

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.