Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: reading RNA codons into hash

by QM (Parson)
on Jul 13, 2017 at 10:00 UTC ( [id://1195003]=note: print w/replies, xml ) Need Help??


in reply to reading RNA codons into hash

Not sure what your problem is, but that's way to much code :D

I think you want something like this:

#!/usr/bin/env perl use strict; use warnings; our %code; while (<>){ chomp; my @tokens = split " ", $_; my $protein = shift @tokens; for my $token (@tokens) { $code{$token} = $protein; } } foreach my $key (sort keys %code){ print "$key\t$code{$key}\n"; }

Using this input file:

A ABC DEF GHI JKL B QRS TUV WXY C EYE LUV YOU

I get this result:

ABC A DEF A EYE C GHI A JKL A LUV C QRS B TUV B WXY B YOU C

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: reading RNA codons into hash
by ic23oluk (Sexton) on Jul 13, 2017 at 10:13 UTC
    Thank you, too!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found