Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^8: Parsing problem

by MB123 (Initiate)
on Nov 09, 2012 at 12:31 UTC ( #1003116=note: print w/ replies, xml ) Need Help??


in reply to Re^7: Parsing problem
in thread Parsing problem

Thank you for the very informative post.

I followed your instructions and the output printed perfectly into the command line. I changed the file extensions around (to BSAC.txt and Script.pl) and obtained the same result - uninitialised value errors and the Number of Strains and AA Change columns were left blank.

I decided to try pasting the rest of my file under the __DATA__ part of your code. For the most part it worked as expected, but with interspersed Use of uninitialised value within %cod in string eq at Script.pl line 32, <DATA> line XXX.. These lines are referring to non-synonymous mutations that code for a STOP codon, like the one below-

FT SNP 2811491 FT /note="refAllele: G SNPstrains: 7414_8#89=A (SNP codon is ST +OP) (AA Gln->STOP) " FT /colour=4
I assume this is because the code has not matched 'non' in the line. Could this also be the cause of my uninitialised value error in the original post?

Many Thanks


Comment on Re^8: Parsing problem
Select or Download Code
Re^9: Parsing problem
by MB123 (Initiate) on Nov 10, 2012 at 12:15 UTC
    I changed all the (SNP codon is STOP) to 'non-synonymous' and have not achieved better results.
Re^9: Parsing problem
by kcott (Abbot) on Nov 16, 2012 at 09:02 UTC

    Your problem here is that the number after 'FT        /colour=' (in this case "4"), is used as a key for %cod but you've only assigned @cod{qw{1 2 3}}. Using the following line solved the problem for me (you'll probably want a different value):

    my %cod = ( 1 => "red", 2 => "non", 3 => "green", 4 => 'value for key +4' );

    Alternatively, you can check $cod{$1} before using it:

    if ( exists $cod{$1} and $cod{$1} eq "non" ) { printf ...

    -- Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-07-25 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (171 votes), past polls