Solved

output problems

Posted on 2004-04-12
16
168 Views
Last Modified: 2010-03-04
Hi Guys,

I really thought this problem was fixed but its not working the way I want it to.

Basically, I have an input file that looks like this:

1plfBD
Interfacing Residues Chain B:21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,31 ,57 ,64 ,65
,66 ,67
Interface Residue matched cB:E  ,D  ,L  ,Q  ,C  ,V  ,C  ,L  ,K  ,T  ,I  ,R  ,K
,I  ,C
Interfacing Residues Chain D:21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,65 ,66
,67
Interface Residue matched cD:E  ,D  ,L  ,Q  ,C  ,V  ,C  ,L  ,K  ,T  ,T  ,K  ,I
,C
Neighboring Residues Chain B:30 ,32 ,56 ,58 ,63 ,68
Neighboring Residue match cB:T  ,S  ,L  ,A  ,G  ,L
Neighboring Residues Chain D:32 ,57 ,64 ,68
Neighboring Residue match cD:S  ,I  ,R  ,L

1plfBD
Surface Residues chainA:21 ,22 ,24 ,28 ,29 ,30 ,32 ,33 ,35 ,37 ,38 ,40 ,41 ,43 ,
44 ,46 ,47 ,48 ,49 ,52 ,53 ,54 ,61 ,62 ,63 ,64 ,65 ,69 ,70 ,71 ,72 ,73 ,76 ,77 ,
79 ,80 ,81 ,82 ,83 ,84 ,85
Surface Resitype chainA:E  ,D  ,Q  ,L  ,K  ,T  ,S  ,G  ,N  ,R  ,H  ,S  ,S  ,E  ,
V  ,G  ,A  ,G  ,L  ,P  ,S  ,P  ,K  ,T  ,G  ,R  ,K  ,D  ,Q  ,Q  ,N  ,P  ,K  ,K  ,
I  ,K  ,R  ,L  ,L  ,K  ,S
Surface Residues chainB:21 ,24 ,28 ,29 ,30 ,32 ,33 ,35 ,37 ,38 ,40 ,41 ,43 ,44 ,46 ,47 ,48 ,49 ,
50 ,52 ,53 ,54 ,61 ,62 ,63 ,64 ,65 ,69 ,70 ,71 ,72 ,73 ,76 ,77 ,
79 ,80 ,81 ,82 ,83 ,84 ,85
Surface Resitype chainB:E  ,Q  ,L  ,K  ,T  ,S  ,G  ,N  ,R  ,H  ,S  ,S  ,E  ,V  ,
G  ,A  ,G  ,L  ,H  ,P  ,S  ,P  ,K  ,T  ,G  ,R  ,K  ,D  ,Q  ,Q  ,N  ,P  ,K  ,K  ,
I  ,K  ,R  ,L  ,L  ,K  ,S

I have to parse this file above and if any of the numbers from the "Interfacting Residues chainA" line or "neighboring ResidueschainA" line occur in the"Surface Residues chainA"- I have to remove the number from "Surface Residues chainA" and also its corresponding Surface Resitype chainA letter(which lies directly beneath it) without altering the format I have!  This has also got to be repeated for the numbers in "Interfacting Residues chainB" or  "neighboring ResidueschainB" again, removing any of the same numbers in "Surface Residues chainB" and its corresponding "Surface Resitype chainB". It is removing the numbers ok, but not the corresponding Letters in the "Surface Resitype chainA" and "Surface Resitype chainB" lines. Can someone help?  My program is below.

My program looks like this:

open (IN,'1bbbAB60') || die "Unable to open the Input File";
undef($/); $_=<IN>; close IN;
@ChainB=();  @ChainD=();
if (m#Interfacing Residues Chain B: ?([\s,\d]*)#) {push(@ChainB,split(/\s*,\s*/,$1))};
if (m#Neighboring Residues Chain B: ?([\s,\d]*)#) {push(@ChainB,split(/\s*,\s*/,$1))};
if (m#Interfacing Residues Chain D: ?([\s,\d]*)#) {push(@ChainD,split(/\s*,\s*/,$1))};
if (m#Neighboring Residues Chain D: ?([\s,\d]*)#) {push(@ChainD,split(/\s*,s*/,$1))};
@SurfaceResidueB=();  @SurfaceResidueD=();
if (m#Surface Residues chainB: ?([\s\d,]*)#) {push(@SurfaceResidueB,split(/\s*,\s*/,$1)
)};
if (m#Surface Residues chainD: ?([\s,\d]*)#) {push(@SurfaceResidueD,split(/\s*,\s*/,$1)
)};

@ChainA{@ChainB}=(1)x@ChainB;
$SRA=join(",", map{sprintf("%-3s", $_)} grep {!$ChainB{$_}} @SurfaceResidueB);
s#(Surface Residues chainB:)[\d\s,]*#$1 $SRA#;
@ChainD{@ChainD}=(1)x@ChainD;
$SRB=join(",", map{sprintf("%-3s", $_)} grep {!$ChainD{$_}} @SurfaceResidueD);
s#(Surface Residues chainD:)[\d\s,]*#$1 $SRB#;

open (OUT,">outty.txt") or die $!;
print OUT;


The output I'm getting now is :

1plfBD
Interfacing Residues Chain B:21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,31 ,57 ,64 ,65
,66 ,67
Interface Residue matched cB:E  ,D  ,L  ,Q  ,C  ,V  ,C  ,L  ,K  ,T  ,I  ,R  ,K
,I  ,C
Interfacing Residues Chain D:21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,65 ,66
,67
Interface Residue matched cD:E  ,D  ,L  ,Q  ,C  ,V  ,C  ,L  ,K  ,T  ,T  ,K  ,I
,C
Neighboring Residues Chain B:30 ,32 ,56 ,58 ,63 ,68
Neighboring Residue match cB:T  ,S  ,L  ,A  ,G  ,L
Neighboring Residues Chain D:32 ,57 ,64 ,68
Neighboring Residue match cD:S  ,I  ,R  ,L

1plfBD
Surface Residues chainB: 33 ,35 ,37 ,38 ,40 ,41 ,43 ,44 ,46 ,47 ,48 ,49 ,52 ,53
,54 ,61 ,62 ,69 ,70 ,71 ,72 ,73 ,76 ,77 ,79 ,80 ,81 ,82 ,83 ,84 ,85
Surface Resitype chainB:E  ,D  ,Q  ,L  ,K  ,T  ,S  ,G  ,N  ,R  ,H  ,S  ,S  ,E  ,
V  ,G  ,A  ,G  ,L  ,P  ,S  ,P  ,K  ,T  ,G  ,R  ,K  ,D  ,Q  ,Q  ,N  ,P  ,K  ,K  ,
I  ,K  ,R  ,L  ,L  ,K  ,S
Surface Residues chainD: 33 ,35 ,37 ,38 ,40 ,41 ,43 ,44 ,46 ,47 ,48 ,49 ,50 ,52
,53 ,54 ,61 ,62 ,63 ,69 ,70 ,71 ,72 ,73 ,76 ,77 ,79 ,80 ,81 ,82 ,83 ,84 ,85
Surface Resitype chainD:E  ,Q  ,L  ,K  ,T  ,S  ,G  ,N  ,R  ,H  ,S  ,S  ,E  ,V  ,
G  ,A  ,G  ,L  ,H  ,P  ,S  ,P  ,K  ,T  ,G  ,R  ,K  ,D  ,Q  ,Q  ,N  ,P  ,K  ,K  ,
I  ,K  ,R  ,L  ,L  ,K  ,S

0
Comment
Question by:sarahJo
  • 9
  • 7
16 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 10810822
@ChainA{@ChainB}=(1)x@ChainB;
#should probably be:
@ChainB{@ChainB}=(1)x@ChainB;
0
 

Author Comment

by:sarahJo
ID: 10810835
Hi ozo,

Yeah, sorry that was my mistake. But I still don't think the program is removing the corresponding Surface Resitype chainB and Surface Resitype chainD letters along with the numbers
0
 

Author Comment

by:sarahJo
ID: 10810900
So basically, the program is removing all the same numbers from "surface residues chainB" that are in the "Interfacing Residues Chain B" or "Neighboring Residues Chain B" (and obviously the same from chain D) but I need it to remove the corresponding letter from the Surface Resitype chainB line (and the same situation for chain D).
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 84

Expert Comment

by:ozo
ID: 10811159
open (IN,'1bbbAB60') || die "Unable to open the Input File $!";
{local $/; $_=<IN>;} close IN;
@ChainB=();  @ChainD=();
if( m#Interfacing Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,\s*/,$1))};
if( m#Neighboring Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,\s*/,$1))};
if( m#Interfacing Residues Chain D: ?([\s,\d]*)# ){push(@ChainD,split(/\s*,\s*/,$1))};
if( m#Neighboring Residues Chain D: ?([\s,\d]*)# ){push(@ChainD,split(/\s*,s*/,$1))};

    @SurfaceResidueB=();  @SurfaceResidueD=();
if( m#Surface Residues chainB: ?([\s\d,]*)# ){push@SurfaceResidueB,split/\s*,\s*/,$1 };
if( m#Surface Residues chainD: ?([\s,\d]*)# ){push@SurfaceResidueD,split/\s*,\s*/,$1 };

if( m#Surface Resitype chainB: ?([\s,\w]*)# ){push@SurfaceResitypeB,split/\s*,\s*/,$1 };
if( m#Surface Resitype chainD: ?([\s,\w]*)# ){push@SurfaceResitypeD,split/\s*,\s*/,$1 };
    @ResitypeB{@SurfaceResidueB} = @SurfaceResitypeB;
    @ResitypeD{@SurfaceResidueD} = @SurfaceResitypeD;
    @ChainB{@ChainB}=(1)x@ChainB;
    $SRA=join(",", map{sprintf("%-3s", $_)} grep {!$ChainB{$_}} @SurfaceResidueB);
s#(Surface Residues chainB:)[\d\s,]*#$1$SRA#;
    @ChainD{@ChainD}=(1)x@ChainD;
    $SRB=join(",", map{sprintf("%-3s", $_)} grep {!$ChainD{$_}} @SurfaceResidueD);
s#(Surface Residues chainD:)[\d\s,]*#$1$SRB#;
   
    $SR = join",",map{sprintf("%-3s",$ResitypeB{$_})} grep {!$ChainB{$_}} @SurfaceResidueB;
s#(Surface Resitype chainB:)[\w\s,]*#$1$SR#;

     $SR = join",",map{sprintf("%-3s",$ResitypeD{$_})} grep {!$ChainD{$_}} @SurfaceResidueD;
s#(Surface Resitype chainD:)[\w\s,]*#$1$SR#;

    open (OUT,">outty.txt") or die $!;
    print OUT;
0
 

Author Comment

by:sarahJo
ID: 10811400
Hi ozo,

That program is removing the letters now, which is great but it is still not removing some of the numbers in "interfacing residue chains" and "neighboring residue chains" from the "surface Residue chains". I tried it on the below example..I'll give the input file, the program and the output. I hope you can help...you're really good at this.  As you can see, for example, in the output 178 from the "interface chainA"and 179 from the "neighboring chainA" are still been collected in the surface residuesChainA.


Input:
mdsAB
Interfacing Residues Chain A:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cA:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Interfacing Residues Chain B:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cB:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Neighboring Residues Chain A:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cA:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R
Neighboring Residues Chain B:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cB:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R

3mdsAB
Surface Residues chainA:1  ,2  ,3  ,5  ,7  ,8  ,10 ,12 ,13 ,14 ,15 ,17 ,18 ,19 ,
23 ,26 ,30 ,31 ,35 ,38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,
67 ,68 ,70 ,71 ,72 ,74 ,88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,
111,114,115,118,119,122,125,126,139,140,141,142,144,147,149,150,156,157,158,160,
175,178,179,181,182,185,189,194,198,201,202,203
Surface Resitype chainA:P  ,Y  ,P  ,K  ,P  ,D  ,G  ,P  ,Y  ,E  ,A  ,E  ,P  ,H  ,
K  ,E  ,Q  ,K  ,A  ,T  ,N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,
Q  ,D  ,Q  ,T  ,A  ,R  ,R  ,T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,
G  ,Q  ,A  ,E  ,K  ,Q  ,M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,P  ,N  ,M  ,E  ,G  ,T  ,
K  ,N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,K  ,K  ,A
Surface Residues chainB:1  ,3  ,5  ,6  ,7  ,8  ,10 ,12 ,14 ,15 ,17 ,18 ,19 ,23 ,
26 ,30 ,31 ,35 ,38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,
68 ,70 ,71 ,72 ,74 ,88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,
114,115,117,118,119,121,122,125,126,139,140,141,142,144,147,149,157,158,160,175,
178,179,181,182,185,189,194,198,201,202,203
Surface Resitype chainB:P  ,P  ,K  ,L  ,P  ,D  ,G  ,P  ,E  ,A  ,E  ,P  ,H  ,K  ,
E  ,Q  ,K  ,A  ,T  ,N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,Q  ,
D  ,Q  ,T  ,A  ,R  ,R  ,T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,G  ,
Q  ,A  ,K  ,E  ,K  ,T  ,Q  ,M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,P  ,E  ,G  ,T  ,K  ,
N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,K  ,K  ,A


program:
#!usr/local/bin/perl



open (IN,'8catAB2') || die "Unable to open the Input File $!";
{local $/; $_=<IN>;} close IN;
@ChainA=();  @ChainB=();
if( m#Interfacing Residues Chain A: ?([\s,\d]*)# ){push(@ChainA,split(/\s*,\s*/,
$1))};
if( m#Neighboring Residues Chain A: ?([\s,\d]*)# ){push(@ChainA,split(/\s*,\s*/,
$1))};
if( m#Interfacing Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,\s*/,
$1))};
if( m#Neighboring Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,s*/,$
1))};

    @SurfaceResidueA=();  @SurfaceResidueB=();
if( m#Surface Residues chainA: ?([\s\d,]*)# ){push@SurfaceResidueA,split/\s*,\s*
/,$1 };
if( m#Surface Residues chainB: ?([\s,\d]*)# ){push@SurfaceResidueB,split/\s*,\s*
/,$1 };
if( m#Surface Resitype chainA: ?([\s,\w]*)# ){push@SurfaceResitypeA,split/\s*,\s
*/,$1 };
if( m#Surface Resitype chainB: ?([\s,\w]*)# ){push@SurfaceResitypeB,split/\s*,\s
*/,$1 };
    @ResitypeA{@SurfaceResidueA} = @SurfaceResitypeA;
    @ResitypeB{@SurfaceResidueB} = @SurfaceResitypeB;
    @ChainA{@ChainA}=(1)x@ChainA;
    $SRA=join(",", map{sprintf("%-3s", $_)} grep {!$ChainA{$_}} @SurfaceResidueA
);
s#(Surface Residues chainA:)[\d\s,]*#$1$SRA#;
    @ChainB{@ChainB}=(1)x@ChainB;
    $SRB=join(",", map{sprintf("%-3s", $_)} grep {!$ChainB{$_}} @SurfaceResidueB
);
s#(Surface Residues chainB:)[\d\s,]*#$1$SRB#;
$SR = join",",map{sprintf("%-3s",$ResitypeA{$_})} grep {!$ChainA{$_}} @Surfa
ceResidueA;
s#(Surface Resitype chainA:)[\w\s,]*#$1$SR#;

     $SR = join",",map{sprintf("%-3s",$ResitypeB{$_})} grep {!$ChainB{$_}} @Surf
aceResidueB;
s#(Surface Resitype chainB:)[\w\s,]*#$1$SR#;

    open (OUT,">8catAB") or die $!;
    print OUT;

ouput

3mdsAB
Interfacing Residues Chain A:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cA:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Interfacing Residues Chain B:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cB:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Neighboring Residues Chain A:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cA:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R
Neighboring Residues Chain B:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cB:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R
3mdsAB
Surface Residues chainA:1  ,2  ,3  ,5  ,7  ,8  ,10 ,12 ,13 ,14 ,15 ,17 ,18 ,19 ,
38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,68 ,70 ,71 ,72 ,
88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,114,115,118,119,122,
125,126,139,140,141,142,144,147,156,157,158,160,178,179,181,182,185,189,194,198,
201,202,203
Surface Resitype chainA:P  ,Y  ,P  ,K  ,P  ,D  ,G  ,P  ,Y  ,E  ,A  ,E  ,P  ,H  ,
T  ,N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,Q  ,D  ,Q  ,T  ,A  ,
R  ,T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,G  ,Q  ,A  ,E  ,K  ,Q  ,
M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,M  ,E  ,G  ,T  ,N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,
K  ,K  ,A
Surface Residues chainB:1  ,3  ,5  ,6  ,7  ,8  ,10 ,12 ,14 ,15 ,17 ,18 ,19 ,38 ,
39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,68 ,70 ,71 ,72 ,88 ,
91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,114,115,117,118,119,121,
122,125,126,139,140,141,142,144,147,157,158,160,178,179,181,182,185,189,194,198,
201,202,203
Surface Resitype chainB:P  ,P  ,K  ,L  ,P  ,D  ,G  ,P  ,E  ,A  ,E  ,P  ,H  ,T  ,
N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,Q  ,D  ,Q  ,T  ,A  ,R  ,
T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,G  ,Q  ,A  ,K  ,E  ,K  ,T  ,
Q  ,M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,E  ,G  ,T  ,N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,
K  ,K  ,A



0
 

Author Comment

by:sarahJo
ID: 10811423
The input lines are all read in in one line like :
Interfacing Residues Chain A:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150

if that helps?
0
 

Author Comment

by:sarahJo
ID: 10811884
Can you see anything wrong Ozo?
0
 
LVL 84

Expert Comment

by:ozo
ID: 10813230
#a small typo:
if( m#Neighboring Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,s*/,$1))};
#should be
if( m#Neighboring Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,\s*/,$1))};
0
 
LVL 84

Expert Comment

by:ozo
ID: 10813302
#There could also be a problem could be with the last chain on a line, which you can fix with
chomp @ChainA;
chomp @ChainB;
chomp @SurfaceResidueA;
chomp @SurfaceResidueB;
#You'll probably have to put the end of line back with
s#(Surface Residues chainA:)[\d\s,]*#$1$SRA\n#;


0
 

Author Comment

by:sarahJo
ID: 10813848
mmm, I'm not sure I follow...how would this look compared with my original script?  Where would I put the "chomp" part?
0
 
LVL 84

Expert Comment

by:ozo
ID: 10815383
#!usr/local/bin/perl



open (IN,'8catAB2') || die "Unable to open the Input File $!";
{local $/; $_=<IN>;} close IN;
@ChainA=();  @ChainB=();
if( m#Interfacing Residues Chain A: ?([\s,\d]*)# ){push(@ChainA,split(/\s*,\s*/,
$1))};
if( m#Neighboring Residues Chain A: ?([\s,\d]*)# ){push(@ChainA,split(/\s*,\s*/,
$1))};
if( m#Interfacing Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,\s*/,
$1))};
if( m#Neighboring Residues Chain B: ?([\s,\d]*)# ){push(@ChainB,split(/\s*,s*/,$
1))};

    @SurfaceResidueA=();  @SurfaceResidueB=();
if( m#Surface Residues chainA: ?([\s\d,]*)# ){push@SurfaceResidueA,split/\s*,\s*
/,$1 };
if( m#Surface Residues chainB: ?([\s,\d]*)# ){push@SurfaceResidueB,split/\s*,\s*
/,$1 };
if( m#Surface Resitype chainA: ?([\s,\w]*)# ){push@SurfaceResitypeA,split/\s*,\s
*/,$1 };
if( m#Surface Resitype chainB: ?([\s,\w]*)# ){push@SurfaceResitypeB,split/\s*,\s
*/,$1 };

chomp @ChainA;
chomp @ChainB;
chomp @SurfaceResidueA;
chomp @SurfaceResidueB;
chomp @SurfaceResitypeA;
chomp @SurfaceResitypeB;

    @ResitypeA{@SurfaceResidueA} = @SurfaceResitypeA;
    @ResitypeB{@SurfaceResidueB} = @SurfaceResitypeB;
    @ChainA{@ChainA}=(1)x@ChainA;
    $SRA=join(",", map{sprintf("%-3s", $_)} grep {!$ChainA{$_}} @SurfaceResidueA
);
s#(Surface Residues chainA:)[\d\s,]*#$1$SRA\n#;
    @ChainB{@ChainB}=(1)x@ChainB;
    $SRB=join(",", map{sprintf("%-3s", $_)} grep {!$ChainB{$_}} @SurfaceResidueB
);
s#(Surface Residues chainB:)[\d\s,]*#$1$SRB\n#;
$SR = join",",map{sprintf("%-3s",$ResitypeA{$_})} grep {!$ChainA{$_}} @SurfaceResidueA;
s#(Surface Resitype chainA:)[\w\s,]*#$1$SR\n#;

     $SR = join",",map{sprintf("%-3s",$ResitypeB{$_})} grep {!$ChainB{$_}} @SurfaceResidueB;
s#(Surface Resitype chainB:)[\w\s,]*#$1$SR\n#;

    open (OUT,">8catAB") or die $!;
    print OUT;
0
 

Author Comment

by:sarahJo
ID: 10818696
Hi Ozo,

Thats still not removing those numbers and now my output is like this wit the surface residue chainB numbers on a different line

3mdsAB
Interfacing Residues Chain A:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cA:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Interfacing Residues Chain B:23 ,27 ,31 ,32 ,36 ,75 ,128,129,130,150,151,168,169
,170,173,174,177,178
Interface Residue matched cB:K  ,I  ,K  ,H  ,Y  ,N  ,F  ,G  ,S  ,N  ,Q  ,W  ,E
,H  ,Y  ,L  ,Q  ,N
Neighboring Residues Chain A:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cA:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R
Neighboring Residues Chain B:22 ,24 ,26 ,28 ,30 ,33 ,35 ,37 ,74 ,76 ,127,131,149
,152,167,171,172,175,176,179
Neighboring Residue match cB:A  ,T  ,E  ,H  ,Q  ,H  ,A  ,V  ,R  ,N  ,R  ,G  ,P
,D  ,V  ,A  ,Y  ,K  ,Y  ,R

3mdsAB
Surface Residues chainA:1  ,2  ,3  ,5  ,7  ,8  ,10 ,12 ,13 ,14 ,15 ,17 ,18 ,19 ,
23 ,26 ,30 ,31 ,35 ,38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,
67 ,68 ,70 ,71 ,72 ,74 ,88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,
111,114,115,118,119,122,125,126,139,140,141,142,144,147,149,150,156,157,158,160,
175,178,179,181,182,185,189,194,198,201,202,203
Surface Resitype chainA:P  ,Y  ,P  ,K  ,P  ,D  ,G  ,P  ,Y  ,E  ,A  ,E  ,P  ,H  ,
K  ,E  ,Q  ,K  ,A  ,T  ,N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,
Q  ,D  ,Q  ,T  ,A  ,R  ,R  ,T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,
G  ,Q  ,A  ,E  ,K  ,Q  ,M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,P  ,N  ,M  ,E  ,G  ,T  ,
K  ,N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,K  ,K  ,A
Surface Residues chainB
:1  ,3  ,5  ,6  ,7  ,8  ,10 ,12 ,14 ,15 ,17 ,18 ,19 ,23 ,26 ,30 ,31 ,35 ,38 ,39
,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,68 ,70 ,71 ,72 ,74 ,88
,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,114,115,117,118,119,121
,122,125,126,139,140,141,142,144,147,149,157,158,160,175,178,179,181,182,185,189
,194,198,201,202,203
Surface Resitype chainB:P  ,P  ,K  ,L  ,P  ,D  ,G  ,P  ,E  ,A  ,E  ,P  ,H  ,K  ,
E  ,Q  ,K  ,A  ,T  ,N  ,A  ,E  ,K  ,P  ,Y  ,G  ,E  ,E  ,V  ,R  ,H  ,A  ,A  ,Q  ,
D  ,Q  ,T  ,A  ,R  ,R  ,T  ,P  ,G  ,K  ,E  ,V  ,G  ,E  ,K  ,K  ,D  ,E  ,Q  ,G  ,
Q  ,A  ,K  ,E  ,K  ,T  ,Q  ,M  ,G  ,P  ,F  ,G  ,K  ,H  ,S  ,P  ,E  ,G  ,T  ,K  ,
N  ,R  ,A  ,D  ,Q  ,N  ,D  ,E  ,K  ,K  ,A
0
 
LVL 84

Expert Comment

by:ozo
ID: 10818724
What is wrong with the output you're getting now?
0
 

Author Comment

by:sarahJo
ID: 10818856
Im getting as above......"surface Residues ChainB" residues are moved onto a different line ie:

Surface Residues chainB
:1  ,3  ,5  ,6  ,7  ,8  ,10 ,12 ,14 ,15 ,17 ,18 ,19 ,23 ,26 ,30 ,31 ,35 ,38 ,39  (like this) plus I'm still seeing numbers eg 178 in the Surface Residues chainA and surface residues chainB
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 10819131
I'm not getting 178 in Surface Residues chain[AB]
I get
Surface Residues chainA:1  ,2  ,3  ,5  ,7  ,8  ,10 ,12 ,13 ,14 ,15 ,17 ,18 ,19 ,38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,68 ,70 ,71 ,72 ,88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,114,115,118,119,122,125,126,139,140,141,142,144,147,156,157,158,160,181,182,185,189,194,198,201,202,203

Surface Residues chainB:1  ,3  ,5  ,6  ,7  ,8  ,10 ,12 ,14 ,15 ,17 ,18 ,19 ,38 ,39 ,42 ,45 ,46 ,48 ,49 ,52 ,54 ,56 ,57 ,60 ,61 ,63 ,64 ,67 ,68 ,70 ,71 ,72 ,88 ,91 ,92 ,93 ,96 ,97 ,99 ,100,101,103,104,107,108,109,111,114,115,117,118,119,121,122,125,126,139,140,141,142,144,147,157,158,160,181,182,185,189,194,198,201,202,203

I think the other problem is that the S in "Surface Residues chainB" looks like more of ([\s,\w]*)
That can be fixed with

if( m#Surface Resitype chainA:\s*((\w\s+,\s*)*\w)# ){push@SurfaceResitypeA,split/\s*,\s*/,$1 };
if( m#Surface Resitype chainB:\s*((\w\s+,\s*)*\w)# ){push@SurfaceResitypeB,split/\s*,\s*/,$1 };

chomp @ChainA;
chomp @ChainB;
chomp @SurfaceResidueA;
chomp @SurfaceResidueB;
chomp @SurfaceResitypeA;
chomp @SurfaceResitypeB;

@ResitypeA{@SurfaceResidueA} = @SurfaceResitypeA;
@ResitypeB{@SurfaceResidueB} = @SurfaceResitypeB;
@ChainA{@ChainA}=(1)x@ChainA;
$SRA=join(",", map{sprintf("%-3s", $_)} grep {!$ChainA{$_}} @SurfaceResidueA);
s#(Surface Residues chainA:)[\d\s,]*#$1$SRA\n#;
@ChainB{@ChainB}=(1)x@ChainB;
$SRB=join(",", map{sprintf("%-3s", $_)} grep {!$ChainB{$_}} @SurfaceResidueB);
s#(Surface Residues chainB:)[\d\s,]*#$1$SRB\n#;
$SR = join",",map{sprintf("%-3s",$ResitypeA{$_})} grep {!$ChainA{$_}} @SurfaceResidueA;
s#(Surface Resitype chainA:\s*)(\w\s+,\s*)*\w#$1$SR\n#;

$SR = join",",map{sprintf("%-3s",$ResitypeB{$_})} grep {!$ChainB{$_}} @SurfaceResidueB;
s#(Surface Resitype chainB:\s*)(\w\s+,\s*)*\w#$1$SR\n#;
0
 

Author Comment

by:sarahJo
ID: 10819875
You're brilliant Ozo....many thanks...sleepless nights are over! Sarah
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now