I have got a file containing info abt node id and labels, which looks like this
i have to read this file into a hash, for which i converted it first into an array, and then to hash, using a program like this
[CODE=perl]
open (NODES, "node.txt") || die "File not found\n";
@nodearray=<NOD ES>;
%nodehash=@node array;
[/CODE]
now i have got to take labels as input from the user, and return the node id. I have been trying the following code
[CODE=perl]
# usr/bin/perl -w
$start_node = 'AT1G51570';
$end_node = 'AT5G1110';
open (NODES, "node.txt") || die "File not found\n";
@nodearray=<NOD ES>;
%nodehash=@node array;
while (($node_id,$lab el) = each %nodehash) {
if ($nodehash{$lab el} = $start_node) {
print $nodehash{$node _id};
}
}
[/CODE]
but nothing is working out. Please help me out on it. I am new to programming, and my deadline is just arriving. Please suggest something....
Code:
-645 _1__46__1__46__1__46__145__45__RXN -435 _3__45__OXOACYL__45__ACP__45__REDUCT__45__RXN -1084 RXN__45__4262 -565 RXN__45__4264 -740 RXN__45__710 -1290 RXN__45__7698 -1017 LIPOXYGENASE__45__RXN -198 RXN__45__1321 -1151 RXN__45__4121 -55 GIBBERELLIN__45__3__45__BETA__45__DIOXYGENASE__45__RXN -1276 NARINGENIN__45__3__45__DIOXYGENASE__45__RXN -653 RXN__45__113 -455 RXN__45__114
[CODE=perl]
open (NODES, "node.txt") || die "File not found\n";
@nodearray=<NOD ES>;
%nodehash=@node array;
[/CODE]
now i have got to take labels as input from the user, and return the node id. I have been trying the following code
[CODE=perl]
# usr/bin/perl -w
$start_node = 'AT1G51570';
$end_node = 'AT5G1110';
open (NODES, "node.txt") || die "File not found\n";
@nodearray=<NOD ES>;
%nodehash=@node array;
while (($node_id,$lab el) = each %nodehash) {
if ($nodehash{$lab el} = $start_node) {
print $nodehash{$node _id};
}
}
[/CODE]
but nothing is working out. Please help me out on it. I am new to programming, and my deadline is just arriving. Please suggest something....
Comment