-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateProtein.cpp
More file actions
85 lines (72 loc) · 2.86 KB
/
CreateProtein.cpp
File metadata and controls
85 lines (72 loc) · 2.86 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/***********************************************************************
CreateProtein - Functions to create protein structures from amino acid
sequences and secondary structure prediction sequences.
Copyright (c) 2002-2024 Oliver Kreylos
Copyright (c) 2002 Nelson Max
***********************************************************************/
#include <string.h>
#include <vector>
#include <Misc/StdError.h>
#include <Misc/StandardValueCoders.h>
#include <Misc/ConfigurationFile.h>
#include <Math/Math.h>
#include "Protein.h"
#include "ParsePdbFile.h"
#include "CreateProtein.h"
namespace MD {
double proteinCreatorHphi;
double proteinCreatorHpsi;
double proteinCreatorEphi;
double proteinCreatorEpsi;
double proteinCreatorCphi;
double proteinCreatorCpsi;
double proteinCreatorProlinePhi;
bool proteinCreatorCreateTerminatorResidues;
void initializeProteinCreation(const Misc::ConfigurationFileSection& configFileSection)
{
/* Read default angles for alpha helices: */
proteinCreatorHphi=Math::rad(configFileSection.retrieveValue<double>("./alphaHelixPhi",-60.0));
proteinCreatorHpsi=Math::rad(configFileSection.retrieveValue<double>("./alphaHelixPsi",-40.0));
/* Read default angles for beta strands: */
proteinCreatorEphi=Math::rad(configFileSection.retrieveValue<double>("./betaStrandPhi",-120.0));
proteinCreatorEpsi=Math::rad(configFileSection.retrieveValue<double>("./betaStrandPsi",140.0));
/* Read default angles for coil regions: */
proteinCreatorCphi=Math::rad(configFileSection.retrieveValue<double>("./coilPhi",-182.0));
proteinCreatorCpsi=Math::rad(configFileSection.retrieveValue<double>("./coilPsi",-182.0));
/* Set fixed phi angle for proline: */
proteinCreatorProlinePhi=Math::rad(configFileSection.retrieveValue<double>("./prolinePhi",-60.0));
/* Read setting for creation of terminator residues: */
proteinCreatorCreateTerminatorResidues=configFileSection.retrieveValue<bool>("./createTerminatorResidues",true);
}
void setCreateTerminatorResidues(bool newCreateTerminatorResidues)
{
proteinCreatorCreateTerminatorResidues=newCreateTerminatorResidues;
}
Protein* loadProtein(const char* inputFileName)
{
/* Find input file extension: */
const char* extension=0;
for(const char* cPtr=inputFileName;*cPtr!='\0';++cPtr)
if(*cPtr=='.')
extension=cPtr+1;
/* Determine input file type based on extension: */
if(extension!=0&&strcasecmp(extension,"pdb")==0)
{
/* Load a PDB file and return only the first polypeptide chain: */
std::vector<Protein*> chains=parsePdbFile(inputFileName);
while(chains.size()>1)
{
delete chains.back();
chains.pop_back();
}
return chains.front();
}
else if(extension!=0&&strcasecmp(extension,"pred")==0)
{
/* Create protein from prediction file: */
return ReadPredictionFile(inputFileName);
}
else
throw Misc::makeStdErr(__PRETTY_FUNCTION__,"Unknown file extension in input file %s",inputFileName);
}
}