File 2 structures (PDB file):SER A ARG A GLU A LYS A ASN A GLN A PRO A LYS A PRO A SER A PRO A LYS A ARG A
ATOM 2 CA PRO A 6 2.437 5.295 -23.029 1.00 0.00 + C ATOM 3 C PRO A 6 2.307 5.113 -21.515 1.00 0.00 + C ATOM 4 O PRO A 6 3.276 4.869 -20.823 1.00 0.00 + O ATOM 15 N TRP A 7 1.114 5.225 -20.998 1.00 0.00 + N ATOM 16 CA TRP A 7 0.916 5.054 -19.531 1.00 0.00 + C ATOM 17 C TRP A 7 0.772 3.567 -19.197 1.00 0.00 + C <>
the above given two file I have to match file one value with third column value(PRO A) of second which is repeated but I have to consider this only one and pick the column fourth value(6). i have created I subroutine for that for first time it matching correctly but for second file it has missing some value.these both file value will change after completion of first time.
MY codethanks in advancesub parse_pdb() { my $file = shift; my %hash_pdb = (); # Opening of PDB file after dowloading open(FH, $file); @atomrecord = <FH>; foreach my $record (@atomrecord) { chomp($record); if($record =~/^ATOM/) { @temp = split(/\s+/, $record); $con_key = ""; $con_key = "$temp[3]"." "."$temp[4]"; $count = 0; if( $hash_pdb{$con_key} ) { if($val_seen{$temp[5]}) { } else { $hash_pdb{$con_key} = $hash_pdb{$con_key}."\t"."$t +emp[5]"; } } else { $hash_pdb{$con_key} = $temp[5]; } $val_seen{$temp[5]} = 1; } if($record =~ /^ENDMDL/){ print "i am going out of loop\n"; last; } } return \%hash_pdb; }
In reply to perl hash problem for comparing two files by sarf13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |