The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Macros | Functions
WritePDB.c File Reference

Write a PDB file from a linked list. More...

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include "MathType.h"
#include "pdb.h"
#include "macros.h"
#include "hash.h"
#include "fsscanf.h"

Go to the source code of this file.

Macros

#define WRITEPDB_MAIN
 

Functions

int blWritePDB (FILE *fp, PDB *pdb)
 
BOOL blFormatCheckWritePDB (PDB *pdb)
 
int blWritePDBAsPDBorGromos (FILE *fp, PDB *pdb, BOOL doGromos)
 
void blWriteTerCard (FILE *fp, PDB *p)
 
void blWritePDBRecord (FILE *fp, PDB *pdb)
 
void blWritePDBRecordAtnam (FILE *fp, PDB *pdb)
 
BOOL blWritePDBAsPDBML (FILE *fp, PDB *pdb)
 
void blSetElementSymbolFromAtomName (char *element, char *atom_name)
 
void blWriteGromosPDB (FILE *fp, PDB *pdb)
 
void blWriteGromosPDBRecord (FILE *fp, PDB *pdb)
 
BOOL blWriteWholePDB (FILE *fp, WHOLEPDB *wpdb)
 
void blWriteWholePDBHeader (FILE *fp, WHOLEPDB *wpdb)
 
void blWriteWholePDBTrailer (FILE *fp, WHOLEPDB *wpdb, int numTer)
 
void blWriteWholePDBHeaderNoRes (FILE *fp, WHOLEPDB *wpdb)
 

Detailed Description

Write a PDB file from a linked list.

Version
V1.29
Date
29.07.15
Author
Dr. Andrew C. R. Martin
Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk

This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.

The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.

The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.

Description:

This routine will write a .PDB file of any size from a linked list of the protein structure. This list is contained in a linked set of structures of type pdb_entry. The structure is set up by including the file "pdb.h". For details of the structure, see this file.

Usage:

blWritePDB(fp, pdb)
Parameters
[in]*fpA pointer to the file to write
[in]*pdbThe start of the PDB linked list.

Revision History:

Definition in file WritePDB.c.

Macro Definition Documentation

#define WRITEPDB_MAIN

Definition at line 173 of file WritePDB.c.

Function Documentation

BOOL blFormatCheckWritePDB ( PDB pdb)
Parameters
[in]*pdbPDB linked list to write

Checks PDB linked list is compatible with PDB-formatted text file.

  • 21.06.14 Original By: CTP

Definition at line 269 of file WritePDB.c.

void blSetElementSymbolFromAtomName ( char *  element,
char *  atom_name 
)
Parameters
[out]*elementElement symbol
[in]*atom_nameAtom name

Set the element symbol (columns 77-78 of a pdb file) based on the atom name (columns 13-16 of a pdb file).

The atom name is stored in the PDB data stucture as atnam_raw.

  • 17.07.14 Original. By: CTP

Definition at line 1433 of file WritePDB.c.

void blWriteGromosPDB ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list to write

Write a PDB linked list by calls to WritePDBRecord()

  • 08.03.89 Original
  • 01.06.92 ANSIed and autodoc'd
  • 10.06.93 Uses NEXT macro; void type
  • 08.07.93 Added insertion of TER cards
  • 22.02.94 And a TER card at the end of the file
  • 15.02.01 This is the old WritePDB()
  • 04.02.14 Use CHAINMATCH macro. By: CTP
  • 07.07.14 Use bl prefix for functions By: CTP
  • 23.02.15 Proper TER card support By: ACRM
  • 24.02.15 Now just uses blWritePDBAsPDBorGromos()

Definition at line 1491 of file WritePDB.c.

void blWriteGromosPDBRecord ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list record to write

Write a PDB record

  • 08.03.89 Original
  • 28.03.90 Changed to match ReadPDB() V1.2 for column widths
  • 01.06.92 ANSIed and autodoc'd
  • 10.06.93 void type
  • 22.06.93 Changed to lf. Ljust strings
  • 11.03.94 lf back to f (!)
  • 12.02.01 This is the old WritePDBRecord()
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 1517 of file WritePDB.c.

int blWritePDB ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list to write
Returns
int Number of TER cards written (0 indicates error)

Write a PDB linked list...

  • 21.06.14 Original By: CTP
  • 18.08.14 Added XML_SUPPORT option. Return error if attempting to write PDBML format. By: CTP
  • 23.02.15 Now returns an int
  • 24.02.15 Changed to call blWritePDBAsPDBorGromos() and blWritePDBAsPDBML()

Definition at line 223 of file WritePDB.c.

BOOL blWritePDBAsPDBML ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list to write
Returns
Success

Write a PDB linked list in PDBML format.

  • 02.06.14 Original. By: CTP
  • 21.06.14 Renamed blWriteAsPDBML() and updated symbol handling. By: CTP
  • 17.07.14 Use blSetElementSymbolFromAtomName() By: CTP
  • 16.08.14 Use element and charge data. By: CTP
  • 17.02.15 Added segid support By: ACRM
  • 24.02.15 Changed name to blWritePDBAsPDBML()
  • 25.02.15 Changed to type BOOL and checks all memory allocations
  • 29.04.15 Updated to write CONECT records. By: CTP
  • 11.05.15 Made function into wrapper for blDoWritePDBAsPDBML(). By: CTP
  • 10.07.15 Added return value for no XML_SUPPORT By: ACRM

Definition at line 525 of file WritePDB.c.

int blWritePDBAsPDBorGromos ( FILE *  fp,
PDB pdb,
BOOL  doGromos 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list to write
Returns
Number of TER cards written (0=error)

Write a PDB linked list by calls to WritePDBRecord()

  • 08.03.89 Original
  • 01.06.92 ANSIed and autodoc'd
  • 10.06.93 Uses NEXT macro; void type
  • 08.07.93 Added insertion of TER cards
  • 22.02.94 And a TER card at the end of the file
  • 04.02.14 Use CHAINMATCH macro. By: CTP
  • 17.06.14 Renamed to blWriteAsPDB() By: CTP
  • 07.07.14 Use blWritePDBRecord() By: CTP
  • 23.02.15 Write correct format TER cards. Now returns int By: ACRM
  • 24.02.15 Renamed to blWritePDBAsPDBorGromos() and added doGromos flag

Definition at line 308 of file WritePDB.c.

void blWritePDBRecord ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list record to write

Write a PDB record

  • 08.03.89 Original
  • 28.03.90 Changed to match ReadPDB() V1.2 for column widths
  • 01.06.92 ANSIed and autodoc'd
  • 10.06.93 void type
  • 22.06.93 Changed to lf. Ljust strings
  • 11.03.94 lf back to f (!)
  • 15.02.01 Modified to use atnam_raw
  • 03.06.05 Modified to use altpos
  • 07.07.14 Renamed to blWritePDBRecord() By: CTP
  • 16.08.14 Write element and formal charge. By: CTP
  • 17.02.15 Added segid support By: ACRM

Definition at line 415 of file WritePDB.c.

void blWritePDBRecordAtnam ( FILE *  fp,
PDB pdb 
)
Parameters
[in]*fpPDB file pointer to be written
[in]*pdbPDB linked list record to write

Write a PDB record using the data in atnam rather than atnam_raw

  • 08.03.89 Original
  • 28.03.90 Changed to match ReadPDB() V1.2 for column widths
  • 01.06.92 ANSIed and autodoc'd
  • 10.06.93 void type
  • 22.06.93 Changed to lf. Ljust strings
  • 11.03.94 lf back to f (!)
  • 15.02.01 Modified to use atnam_raw
  • 03.06.05 Modified to use altpos
  • 22.09.05 This is like the old version which used atnam rather than atnam_raw
  • 07.07.14 Renamed to blWritePDBRecordAtnam() By: CTP
  • 17.02.15 Added element, formalcharge and segid support By: ACRM

Definition at line 471 of file WritePDB.c.

void blWriteTerCard ( FILE *  fp,
PDB p 
)
Parameters
[in]*fpFile pointer
[in]*pPDB record pointer

Prints a TER card in the new PDB format - i.e. with the residue information for the previous ATOM/HETATM, rather than just printing TER

  • 23.02.15 Original By: ACRM
  • 02.03.15 Added space padding

Definition at line 382 of file WritePDB.c.

BOOL blWriteWholePDB ( FILE *  fp,
WHOLEPDB wpdb 
)
Parameters
[in]*fpFile pointer
[in]*wpdbWhole PDB structure pointer

Writes a PDB file including header and trailer information. Output in PDBML-format if flags set.

  • 21.06.14 Original By: CTP
  • 18.08.14 Added XML_SUPPORT option. Return error if attempting to write PDBML format. By: CTP
  • 12.02.15 Now a wrapper to blDoWriteWhilePDB()
  • 24.02.15 blWriteAsPDBML() changed to blWritePDBAsPDBML() blWriteAsPDB() changed to blWritePDBAsPDBorGromos()
  • 25.02.15 No longer a wrapper
  • 04.03.15 Added check on wpdb and wpdb->pdb being non-NULL
  • 11.05.15 Updated to use blDoWritePDBAsPDBML(). By: CTP

Definition at line 1557 of file WritePDB.c.

void blWriteWholePDBHeader ( FILE *  fp,
WHOLEPDB wpdb 
)
Parameters
[in]*fpFile pointer
[in]*wpdbWhole PDB structure pointer

Writes the header of a PDB file

  • 30.05.02 Original By: ACRM
  • 21.06.14 Renamed to blWriteWholePDBHeader() By: CTP
  • 12.02.15 Added XML check By: ACRM
  • 06.08.15 Updated XML check. By: CTP

Definition at line 1608 of file WritePDB.c.

void blWriteWholePDBHeaderNoRes ( FILE *  fp,
WHOLEPDB wpdb 
)
Parameters
[in]*fpFile pointer
[in]*wpdbWhole PDB structure pointer

Writes the header of a PDB file, but skips any records that include residue numbers for cases where these may have changed.

Skips: REMARK 500 DBREF HELIX SHEET SSBOND CISPEP SEQADV MODRES HET SITE REMARK 465 REMARK 470 REMARK 475 REMARK 480 REMARK 525 REMARK 610 REMARK 615 REMARK 620 REMARK 630 REMARK 3

  • 02.03.15 Original By: ACRM
  • 09.03.15 Additionally skips SEQADV, MODRES, HET, SITE
  • 10.03.15 Additionally skips REMARK 3,465,470,475,480,525,610,615,620,630
  • 06.08.15 Updated XML check. By: CTP

Definition at line 1809 of file WritePDB.c.

void blWriteWholePDBTrailer ( FILE *  fp,
WHOLEPDB wpdb,
int  numTer 
)
Parameters
[in]*fpFile pointer
[in]*wpdbWhole PDB structure pointer
[in]numTerNumber of TER cards

Writes the trailer of a PDB file

  • 30.05.02 Original By: ACRM
  • 21.06.14 Renamed to blWriteWholePDBTrailer() By: CTP
  • 12.02.15 Added XML check By: ACRM
  • 18.02.15 Complete rewrite to use the parsed CONECT data rather than simply rewriting what was read in
  • 23.02.15 Added numTer parameter
  • 02.03.15 Padded END and CONECT
  • 06.08.15 Updated XML check. By: CTP

Definition at line 1643 of file WritePDB.c.