3
/* Get MMDB-derived Kinemages, PDB Files, Summaries using PDB acession numbers */
7
#include <mmdbapi.h> /* the MMDBAPI header */
13
Args myargs[NUMARGS] = {
14
{"Input PDB Accession ",NULL,NULL,NULL,FALSE,'i',ARG_STRING,0.0,0,NULL},
15
{"OUTPUT Type \n0 = Summary File \n1 = PDB File, \n2 = Kinemage File",
16
"1","0","2",FALSE,'t',ARG_INT,0.0,0,NULL},
17
{"Output File Name",NULL,NULL,NULL,TRUE,'o',ARG_FILE_OUT,0.0,0,NULL},
18
{"Model Level \n0 = All Atom; 1=BackBone; 2=PDB models; 3=Vector; ","0","0","3",TRUE,'m',ARG_INT,0.0,0,NULL},
19
{"Kinemage Color Type \n0=Default, 1=By Number, 2=By Type, 3=By Temp, 4=By Atom",
20
"0","0","4",FALSE,'c',ARG_INT,0.0,0,NULL},
21
{"Kinemage Rendering \n0=V+HET; 11=...+BB; 15=...+RES; 31=...+ALT; 63=...+NMR ",
22
"0","0","63",FALSE,'r',ARG_INT,0.0,0,NULL}
34
PDNMS pdnmsModelstruc;
35
BiostrucPtr pbsBiostruc;
39
ErrSetFatalLevel(SEV_MAX);
41
if (! GetArgs("GetMMDB",NUMARGS,myargs))
44
/* Initialize MMDBAPI */
46
if (! OpenMMDBAPI(0, NULL))
48
printf("Have not opened mmdbapi");
52
/* load an ASN.1 Biostruc */
53
/* Any other method of obtaining a Biostruc is fine... */
54
/* This one does a built-in lookup of PDB accesion numbers */
55
/* then fetches the file using the Entrez clinet-server interface */
56
pbsBiostruc = FetchBiostrucPDB(myargs[0].strvalue, myargs[3].intvalue, 100);
57
if (pbsBiostruc == NULL)
59
printf("Have not fetched Biostruc");
63
/* convert it into a Modelstruc pointed to by pdnmsModelstruc */
64
pdnmsModelstruc= MakeAModelstruc(pbsBiostruc);
65
if ( pdnmsModelstruc == NULL )
67
printf("Have not converted Biostruc");
71
if (myargs[1].intvalue == 0) /* Summary */
73
if (!myargs[2].strvalue)
75
sprintf(cOut,"%s.sum", myargs[0].strvalue);
76
pFile = fopen(cOut, "w");
79
pFile = fopen(myargs[2].strvalue,"w");
80
iTest = WriteStructSummary(pdnmsModelstruc,pFile);
83
if (myargs[1].intvalue == 2) /* Kinemage */
85
bRender = (Byte) myargs[5].intvalue;
86
iColor = (Int2) myargs[4].intvalue;
87
if (!myargs[2].strvalue)
89
sprintf(cOut,"%s.kin", myargs[0].strvalue);
90
pFile = fopen(cOut, "w");
93
pFile = fopen(myargs[2].strvalue,"w");
94
iTest = WriteKinAllModel(pdnmsModelstruc,pFile,
99
if (myargs[1].intvalue == 1) /* PDB */
101
if (!myargs[2].strvalue)
103
sprintf(cOut,"%s.pdb", myargs[0].strvalue);
104
pFile = fopen(cOut, "w");
107
pFile = fopen(myargs[2].strvalue,"w");
108
iTest = WritePDBAllModel(pdnmsModelstruc,pFile);
111
/* Free the Modelstruc (and its enclosed Biostruc) */
112
/* FreeAModelstruc(PDNMS pdnmsThis); not necessary */
113
/* This can be done individually - but all Modelstrucs */
114
/* remaining are freed in CloseMMDBAPI() */
116
/* Shut Down MMDBAPI */