Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ACRMGroup/bioplib
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewCRMartin committed Sep 29, 2017
2 parents 428698e + e40d06c commit 8e28b84
Showing 1 changed file with 64 additions and 15 deletions.
79 changes: 64 additions & 15 deletions src/rsc.c
Expand Up @@ -3,11 +3,11 @@
\file rsc.c
\version V1.16
\date 14.12.16
\version V1.17
\date 23.03.17
\brief Modify sequence of a PDB linked list
\copyright (c) UCL / Dr. Andrew C. R. Martin 1992-2016
\copyright (c) UCL / Dr. Andrew C. R. Martin 1992-2017
\author Dr. Andrew C. R. Martin
\par
Institute of Structural & Molecular Biology,
Expand Down Expand Up @@ -75,6 +75,7 @@
offset By: ACRM
- V1.15 25.02.15 Sets the element type for new atoms
- V1.16 14.12.16 FixTorsions() checks return from blCalcChi()
- V1.17 23.03.17 Better handling of missing atoms in the PDB file
*************************************************************************/
/* Defines required for includes
Expand Down Expand Up @@ -121,11 +122,12 @@
/************************************************************************/
/* Defines and macros
*/
#define NUMAAKNOWN 20
#define MAXBUFF 80 /* Used by ReadRefCoords() */
#define ERROR_OK 0
#define ERROR_NOMEM 1
#define ERROR_ATOMS 2
#define NUMAAKNOWN 20
#define MAXBUFF 80 /* Used by ReadRefCoords() */
#define ERROR_OK 0
#define ERROR_NOMEM 1
#define ERROR_ATOMS 2
#define ERROR_UNKNOWNAA 3

/************************************************************************/
/* Globals
Expand Down Expand Up @@ -154,6 +156,8 @@ static PDB *FixTorsions(PDB *pdb, PDB *ResStart, PDB *NextRes,
int **chitab);
static BOOL doRepOneSChain(PDB *pdb, char *ResSpec, char aa,
char *ChiTable, char *RefCoords, BOOL force);
static BOOL gotCBeta(PDB *ResStart, PDB *NextRes);


/************************************************************************/
/*>BOOL blRepSChain(PDB *pdb, char *sequence, char *ChiTable,
Expand Down Expand Up @@ -526,13 +530,30 @@ static PDB *DoReplace(PDB *ResStart, /* Pointer to start of residue */
/* if(seq == blThrone(ResStart->resnam)) return(NULL); */

if(!strncmp(ResStart->resnam,"GLY",3)) /* Replace Gly with X */
{
retval = ReplaceGly(ResStart,NextRes,seq,fp_RefCoords);
else if(seq == 'G') /* Replace X with Gly */
retval = ReplaceWithGly(ResStart, NextRes);
else if(seq == 'A') /* Replace X with Ala */
retval = ReplaceWithAla(ResStart, NextRes);
else /* Replace X with Y */
retval = Replace(ResStart,NextRes,seq,chitab,fp_RefCoords);
}
else
{
/* The original is not gly, so we need to check that the CBeta is
there
*/
if(gotCBeta(ResStart, NextRes))
{
if(seq == 'G') /* Replace X with Gly */
retval = ReplaceWithGly(ResStart, NextRes);
else if(seq == 'A') /* Replace X with Ala */
retval = ReplaceWithAla(ResStart, NextRes);
else /* Replace X with Y */
retval = Replace(ResStart,NextRes,seq,chitab,fp_RefCoords);
}
else /* No CBeta, so treat it as if it were a glycine */
{
retval = ReplaceGly(ResStart,NextRes,seq,fp_RefCoords);
}

}


if(retval) /* Problem */
{
Expand All @@ -545,6 +566,9 @@ static PDB *DoReplace(PDB *ResStart, /* Pointer to start of residue */
strcpy(gRSCError, "Could not build sidechain as backbone atoms \
were missing");
break;
case ERROR_UNKNOWNAA:
strcpy(gRSCError, "Unknown replacement amino acid");
break;
default:
strcpy(gRSCError, "Undefined error");
}
Expand All @@ -559,6 +583,31 @@ were missing");
}


/************************************************************************/
/*>static BOOL gotCBeta(PDB *ResStart, PDB *NextRes)
-------------------------------------------------
*//**
\param[in,out] *ResStart Start of residue to be modified
\param[in] *NextRes Pointer to start of next residue
\return TRUE: CB present; FALST; not present
Checks if the residue has a CBeta atom
- 23.03.17 Original By: ACRM
*/
static BOOL gotCBeta(PDB *ResStart, PDB *NextRes)
{
PDB *p;

for(p=ResStart; p!=NextRes; NEXT(p))
{
if(!strncmp(p->atnam, "CB ", 4))
return(TRUE);
}
return(FALSE);
}


/************************************************************************/
/*>static int ReplaceWithGly(PDB *ResStart, PDB *NextRes)
------------------------------------------------------
Expand Down Expand Up @@ -959,7 +1008,7 @@ static int Replace(PDB *ResStart,
reference = ReadRefCoords(fp_RefCoords, seq);
if(reference == NULL)
{
retval = ERROR_NOMEM;
retval = ERROR_UNKNOWNAA;
goto Cleanup;
}

Expand Down

0 comments on commit 8e28b84

Please sign in to comment.