I have a data like this
SEQRES 1 A 1522 U U U G U U G G A G A G U
SEQRES 2 A 1522 U U G A U C C U G G C U C
SEQRES 3 B 1522 A G G G U G A A C G C U G
SEQRES 4 B 1522 G C G G C G U G C C U A A
SEQRES 5 B 1522 G A C A U G C A A G U C G
SEQRES 6 B 1522 U G C G G G C C G C G G G
SEQRES 7 C 1522 G U U U U A C U C C G U G
SEQRES 8 D 1522 G U C A G C G G C G G A C
SEQRES 9 F 1522 G G G U G A G U A A C G C
SEQRES 10 F 1522 G U G G G U G A C C U A C
SEQRES 11 F 1522 C C G G A A G A G G G G G
I am interested only to print , A, B, C, D, F from the third column only once irrespective of how many time these appear in each column.
Here is my code
please help to get the desired results
SEQRES 1 A 1522 U U U G U U G G A G A G U
SEQRES 2 A 1522 U U G A U C C U G G C U C
SEQRES 3 B 1522 A G G G U G A A C G C U G
SEQRES 4 B 1522 G C G G C G U G C C U A A
SEQRES 5 B 1522 G A C A U G C A A G U C G
SEQRES 6 B 1522 U G C G G G C C G C G G G
SEQRES 7 C 1522 G U U U U A C U C C G U G
SEQRES 8 D 1522 G U C A G C G G C G G A C
SEQRES 9 F 1522 G G G U G A G U A A C G C
SEQRES 10 F 1522 G U G G G U G A C C U A C
SEQRES 11 F 1522 C C G G A A G A G G G G G
I am interested only to print , A, B, C, D, F from the third column only once irrespective of how many time these appear in each column.
Here is my code
Code:
I have written a code
open (SP, "myfile");
my $flag=1;
my $chainid;
my $chainid2;
my $chainidB;
while(<SP>){
if ($flag==1){
if ( $_=~/SEQRES\s+\S+\s(\S)/){
$flag++;
#print $1 ;
$chainid=$1;
print "this is chain 1 $chainid\n";
}
}else{
if ( $_=~/SEQRES\s+\S+\s(\S)/){
#print $1 ;
$chainid2=$1;
print " this is chain 2 $chainid2\n";}
}
}
please help to get the desired results