Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
FNam2PDB.c File Reference

Extract a PDB code from a filename. More...

#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "macros.h"

Go to the source code of this file.

Functions

char * blFNam2PDB (char *filename)
 

Detailed Description

Extract a PDB code from a filename.

Version
V1.2
Date
07.07.14
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:

Usage:

Revision History:

Definition in file FNam2PDB.c.

Function Documentation

char* blFNam2PDB ( char *  filename)
Parameters
[in]*filenameA PDB filename containing a PDB code
Returns
The PDB code (lower case) NULL if memory allocation fails XXXX if filename blank or NULL or if unable to find PDB code

This routine attempts to convert a filename stem to a PDB code.

All the following inputs should produce the same output of 1fbj:

  $A:[PDB]PDB1FBJ.ENT
  C:\P1FBJ.PDB
  /pdb/p1fbj.pdb
  /pdb/pdb1fbj.pdb
  1fbj.pdb
  1fbjL

The routine first removes characters from the start of the filename up to the last : ] / or . It then searches for the following possible patterns (where N is a digit and X is an alphanumeric)

  pdbNXXX
  pNXXX
  NXXX
  XXXX.pdb
  XXXX.ent

This should cover just about any filename which includes a legal PDB code.

  • 24.07.95 Original By: ACRM
  • 26.07.95 Corrected a NULL to '\0'
  • 07.07.14 Use bl prefix for functions By: CTP

Definition at line 123 of file FNam2PDB.c.