Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: How can one get all possible combinations of elements of different arrays using File::Glob(bsd_glob)?

by supriyoch_2008 (Scribe)
on Apr 25, 2013 at 07:17 UTC ( #1030611=note: print w/ replies, xml ) Need Help??


in reply to Re^5: How can one get all possible combinations of elements of different arrays using File::Glob(bsd_glob)?
in thread How can one get all possible combinations of elements of different arrays using File::Glob(bsd_glob)?

Hi hdb,

Thank you for the code. It works but the problem is that it produces all the combinations alongwith the desired 6-letter combinations i.e.

~A1T1C1G1A1C1~ ~A1T1C1G2A1C1~ ~A1T1C2G1A1C1~ ~A2T3C1G1A1C1~ ~A2T3C1G2A1C1~ ~A2T3C2G1A1C1~

Here is the text output of your code:

~A1T1C1G1A1C1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G1~ ~A1T1C1G2A1C1~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C1G2~ ~A1T1C2G1A1C1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1C2G1~ ~A1T1A1C1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1A1C1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1A1C1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1A1C1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1A1C1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A1T1~ ~A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 ~~ ~~ ~A1C1~ ~~ ~~ ~~ ~~ ~~ ~~ ~~

Here the input files i.e. k1.txt, k2.txt, k3.txt are small. When the input files are large, then I shall face problem in selecting the desired longest combinations from a very large cmd or text file output. It will be much easier if the output text file shows only the longest combinations as given above. I think it is not very easy task in perl. I think so because poj has also suggested a script which produces many unwanted combinations along with the desired 6-letter longest combinations. From the output text file, the unwanted combinations are to be deleted manually to retain only the longest correct, desired combinations. It will be a very time-taking task for more input files with large size. I wish perl could solve this problem.


Comment on Re^6: How can one get all possible combinations of elements of different arrays using File::Glob(bsd_glob)?
Select or Download Code
Re^7: How can one get all possible combinations of elements of different arrays using File::Glob(bsd_glob)?
by hdb (Prior) on Apr 25, 2013 at 07:31 UTC

    Not what I get. I only get the six desired lines. Probabaly your k?.txt files have a lot of empty lines??? In which case, you need to modify the code by adding two more lines:

    chomp $DNA; $DNA=~s/\n/,/g; $DNA=~s/,+$//g; # new $DNA=~s/,,+/,/g; # new $string .= "{$DNA}";

    This removes multiple commata or trailing commata created by empty lines. Let me know whether this solves the problem.

      Hi hdb,

      Thanks a lot. I have put the two new lines given by you in the script. Now the script has worked nicely and I have got the results the way I wanted. My heartfelt thanks to you. I wish I could develop the skills like you in perl. It appears to me that possibly no problem in perl is insurmountable to you. My heart knew no bounds when I had found the correct results using the code given by you.

      With deep REGARDS to you for your kind help and guidance.

      I SALUTE your intellectual achievement. This is the message from my heart to you. My English is not very good and so I don't know which words or sentences I should use here appropriately to thank you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2015-07-04 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls