Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: How to do a reciprocal matching statement

by ajl412860 (Novice)
on Sep 09, 2015 at 19:51 UTC ( [id://1141463]=note: print w/replies, xml ) Need Help??


in reply to Re: How to do a reciprocal matching statement
in thread How to do a reciprocal matching statement

To address you post, the reason I am using two different while loops is because this is the only way from what I know, will compare both files that I am looking at. The nested while loops was the only thing that was working. If there is another way of comparing to files in perl, I am open to changing the script to do so.

The amount of iterations equates to the amount of data within each file, meaning that once every line of each file has been compared to each other, with the appropriate matching statements, then both while loops should stop, and another iteration of the $a from the list should be implicated, thus starting the whole process all over again. The file names from glob function, have a purpose. The gob files contain the names of genome AB files with in the name of the genome BA file name. So when I do the split function on the $a file I will get both file names.

Also to explain why I did a local $/, without it, the whole content of the files wouldn't be upload into the scripts. At one point only the first lines were being compared, so I used the local $/ so that the scalars could have all the content of the files being upload.

  • Comment on Re^2: How to do a reciprocal matching statement

Replies are listed 'Best First'.
Re^3: How to do a reciprocal matching statement
by graff (Chancellor) on Sep 10, 2015 at 00:20 UTC
    Regarding your reply, it seems I should have been more clear about the problems in your code:
    1. As written in the OP, your code either never enters the second while loop (because you've read an empty string from an input file) or else it goes into an infinite loop (because if $G2A = $RECI returns true, nothing happens to allow exiting the loop).
    2. As written, your handing of inputs from data files appears to be misguided; it's very unlikely that it can work the way you intend it to work.
    3. Based on your updates to the OP, and your replies to me and other monks, it seems like you don't really have a clear picture of an algorithm that will produce the results you want to get, and so far, we have not gotten from you a clear picture of the inputs and intended outputs.

    I hope you understand what I'm saying. If not, you can ask for clarification.

    But more importantly, see if you can provide a fairly simple, direct description of the task you are trying to accomplish: "(A) There are (how many?) different types of input files - here are brief examples of the content for each type: ... (B) Given these inputs, there's this particular type of match that I need to locate: ... (C) Each time I locate this sort of match, there's this particular information that needs to be output: ...." -- or something to that effect.

    If you can't figure out how to express your task in a simple example, it's much harder for us to help you. But if you can do that, it should help you to get a fresh start on your script. (The OP script is unlikely to be a good starting point.)

Re^3: How to do a reciprocal matching statement
by 1nickt (Canon) on Sep 09, 2015 at 21:46 UTC

    You might like to read How do i extract only contigs of interest, from today. To quote choroba from that thread:

    Searching for information taken from one file in another file is quite + a common task. The usual solution is to hash the identifiers, then i +terate over the second file and check the hash for the existence of t +he identifier.

    The way forward always starts with a minimal test.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found