Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Creating and using an array with different files

by Chrispm (Initiate)
on Oct 18, 2013 at 15:49 UTC ( [id://1058773]=perlquestion: print w/replies, xml ) Need Help??

Chrispm has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone, I am a relative newcommer to Perl and am a little bit stumped. I have been given 2 text files, 1 containing a list of different processes and genes linked to the processes if the form below:
Check point factors CCNA1 Check point factors CCNA2 Check point factors CCNB1
Another is containing the same list of genes and lists of species and whether the genes are present in certain species like this:
HFM1 1 EME2 0
Essentially what I want to do is: Select a specific process and pull out all of the genes that are linked to it from the first file, then use the genes from the first file (in the form of an array) to see if a species contain the gene or not by comparing it to the second file. How would I go around creating an array of the selected genes then use that array to search the second file? I know this is probably very badly worded, but any help would be amazing. If you need some more information to help you understand it, don't hesitate to ask. Chris

Replies are listed 'Best First'.
Re: Creating and using an array with different files
by toolic (Bishop) on Oct 18, 2013 at 15:52 UTC
    It's not clear to me how your 2 files relate to each other, but here is some generic advice:
    • Read perlintro.
    • Create some Perl code.
    • Post back here is you have more specific questions.
Re: Creating and using an array with different files
by wjw (Priest) on Oct 18, 2013 at 16:08 UTC
    At least provide the first few pertinent lines of each file. I see no correlation that can be made between your example data. And then at least show that you have tried to use Perl to read the files or something. I would start with Perldoc, write a few lines that prove you put in some effort, then post back here.

    Hope that helps


    ...the majority is always wrong, and always the last to know about it...
    Insanity: Doing the same thing over and over again and expecting different results.
Re: Creating and using an array with different files
by Laurent_R (Canon) on Oct 18, 2013 at 17:18 UTC

    I also can't make any correlation between your sample files, so I am not really sure of what exactly you want to do. But given your description of the task, it seems highly probable that you will want to use hash tables, rather than arrays, as a data structure for storing your data.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1058773]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found