File: PDB2discover.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 239,924 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (55 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: PDB2discover.C,v 1.9 2004/05/27 19:49:57 oliver Exp $
//

#include <BALL/STRUCTURE/fragmentDB.h>
#include <BALL/FORMAT/PDBFile.h>

using namespace BALL;
using namespace std;

int main(int argc, char** argv) 
{

	// check for command line arguments
	if (argc != 3)
	{
		Log.error() << argv[0] << " <PDB file> <new PDB file>" << endl;
		Log.error() << "  read a PDB file from <PDB file>, add hydrogen atoms where needed" << endl;
		Log.error() << "  convert the atom names to the Discover naming scheme, and write" << endl;
		Log.error() << "  everything to <new PDB file>." << endl << endl;
		return 1;
	}
	
	PDBFile	in_file(argv[1]);
	if (in_file.bad())
	{
		Log.error() << "cannot read PDB file " << argv[1] << endl;
		return 2;
	}

	// read the contents of the file into a System
	Log << "reading file " << argv[1] << endl;
	System S;
	in_file >> S;
	in_file.close();

	Log << "opening fragment database" << endl;
	FragmentDB	db("");

	Log << "adding hydrogens..." << endl;
	S.apply(db.add_hydrogens);

	Log << "normalizing atom names" << endl;
	db.normalize_names.setNamingStandard("Discover");
	S.apply(db.normalize_names);

	Log << "writing file " << argv[2] << endl;
	PDBFile out_file(argv[2], ios::out);
	out_file << S;
	out_file.close();

	return 0;
}