|Just another Perl shrine|
Analyse an array and join only some elements of itby Istirion (Initiate)
|on Jun 15, 2012 at 12:45 UTC||Need Help??|
Istirion has asked for the
wisdom of the Perl Monks concerning the following question:
I have a programming problem which I can't solve on my own and therefor Id like to ask for your help.
Earlier in the programm I read a complete inputfile via <STDIN>, process and split it in pieces and get something like a really big array of strings. Each string is a part of DNA, so it looks like "ATCGCAT..." (very long!). I can join the complete array into one string for further analysis of the DNA. But I also would like to do this:
1) Check every item of the array, starting with  if it passes an easy test (here: I just want to see, if the string of bases can be divided by 3 and therefor has the correct number for further analysis and transformation into aminoacids)
2) Join all strings in the array which passed the test into one big string (>6 mio. characters), letting out those which didn't pass (wrong number of bases).
3) Send some info to a logfile, which says something like this "Found x blocks (x = number of elemens in the array = $#array), joined y of them and left out z." The leftout parts should follow, like
Not used blocks# 1200 1500 5000 ...
I think it could be really easily solved, but right now I don't see the solution... :-(Thank you very much for your help!