本文整理汇总了C++中PDBFile::read方法的典型用法代码示例。如果您正苦于以下问题:C++ PDBFile::read方法的具体用法?C++ PDBFile::read怎么用?C++ PDBFile::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDBFile
的用法示例。
在下文中一共展示了PDBFile::read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
CommandlineParser parpars("PoseIndices2PDB", "converts pose indices into PDB files ", VERSION, String(__DATE__), "Convert, combine and store");
parpars.registerMandatoryInputFile("i_clust", "input cluster index file");
parpars.registerMandatoryInputFile("i_trans", "input tranformation file");
parpars.registerMandatoryInputFile("i_pdb", "input reference pdb file");
parpars.registerMandatoryOutputFile("o", "output file name prefix for resulting pdb files");
parpars.setParameterAsHidden("o");
// parameters for galaxy for handling multiple output files
parpars.registerOptionalGalaxyOutputId("o_id", "output file name prefix for 2nd to last pdb file", "$o.id");
// need to be hidden in command line mode
parpars.setParameterAsHidden("o_id");
parpars.setParameterAsAdvanced("o_id");
// parameters for galaxy for handling multiple output files
parpars.registerOptionalGalaxyOutputFolder("o_dir", "output directory for 2nd to last pdb file", "$__new_file_path__");
// need to be hidden in command line mode
parpars.setParameterAsHidden("o_dir");
parpars.setParameterAsAdvanced("o_dir");
// the manual
String man = "This tool converts all pose indices from a given transformation file and the corresponding reference PDBFile into separate PDBFiles.\n\nParameters are the input pose index file (-i_clust), the original transformation file (-i_trans), the corresponding reference pdb file (-i_pdb) and a naming schema for the resulting pdb files (-o). \n\nOutput of this tool is a set of PDBFiles representing the docking poses belonging to the given input cluster.";
parpars.setToolManual(man);
// here we set the types of I/O files
parpars.setSupportedFormats("i_clust","txt");
parpars.setSupportedFormats("i_trans","dcd");
parpars.setSupportedFormats("i_pdb","pdb");
parpars.setSupportedFormats("o","pdb");
parpars.parse(argc, argv);
//////////////////////////////////////////////////
// read the input
PDBFile pdb;
pdb.open(parpars.get("i_pdb"));
System sys;
pdb.read(sys);
PoseClustering pc;
if (parpars.has("i_trans"))
{
pc.options.set(PoseClustering::Option::RMSD_TYPE, PoseClustering::RIGID_RMSD);
pc.setBaseSystemAndTransformations(sys, parpars.get("i_trans"));
}
//std::vector< std::set<Index> > clusters;
LineBasedFile file(parpars.get("i_clust"), std::ios::in);
vector<String> fields;
String cluster_id = -1;
String pose_id = -1;
// called as command line or e.g. via galaxy?
bool is_cmd = !parpars.has("env")
|| ((parpars.has("env") && parpars.get("env")=="cmdline"));
bool first_sol = true;
while (file.LineBasedFile::readLine())
{
// get the line
String current_cluster = file.getLine();
if (current_cluster.getField(1) == "cluster")
{
cluster_id = current_cluster.getField(2);
pose_id = -1;
if (file.LineBasedFile::readLine())
{
current_cluster = file.getLine();
fields.clear();
current_cluster.split(fields);
for (Size i=0; i < fields.size(); i++)
{
System new_pose_sys(sys);
pose_id = fields[i];
pc.applyTransformation2System(pose_id.toInt(), new_pose_sys);
// create the output name
String outfile_name = String(parpars.get("o"))
+ "_clust_" + cluster_id
+ "_pose_" + String(pose_id) + ".pdb";
if (parpars.has("o_dir") && is_cmd && (parpars.get("o_dir") != "$__new_file_path__"))
{
outfile_name = String(parpars.get("o_dir")) + "/" + outfile_name;
}
// NOTE: Galaxy requires this strange naming convention
// including the fact, that zero-th element has a different name
if (!is_cmd)
{
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
parpars.setSupportedFormats("i_dcd","dcd");
parpars.setSupportedFormats("i_pdb","pdb");
parpars.setSupportedFormats("i_trans","txt");
parpars.setSupportedFormats("o_index_list","txt");
parpars.setSupportedFormats("o_score_matrix","txt");
parpars.setSupportedFormats("o_dcd","dcd");
parpars.setSupportedFormats("o_red_dcd","dcd");
parpars.setSupportedFormats("o_cluster_tree","dat");
parpars.parse(argc, argv);
//////////////////////////////////////////////////
if (parpars.has("o_dcd"))
{
if (!parpars.has("o_dcd_dir") || !parpars.has("o_dcd_id"))
{
Log << "Output type \"dcd\" requires setting the options \"o_dir\" \"o_id\"! Abort!" << endl;
return 1;
}
}
if ( parpars.has("o_cluster_tree")
&& (!parpars.has("alg") || parpars.get("alg") != "NEAREST_NEIGHBOR_CHAIN_WARD"))
{
Log << "Output of cluster tree requires Ward algorithm! Abort!" << endl;
return 1;
}
// read the input
PDBFile pdb;
pdb.open(parpars.get("i_pdb"));
System sys;
pdb.read(sys);
ConformationSet cs;
cs.setup(sys);
if (parpars.has("i_dcd"))
{
cs.readDCDFile(parpars.get("i_dcd"));
}
cs.resetScoring();
PoseClustering pc;
if (parpars.has("i_trans"))
{
pc.setBaseSystemAndTransformations(sys, parpars.get("i_trans"));
}
if (parpars.has("rmsd_cutoff"))
{
float rmsd = parpars.get("rmsd_cutoff").toInt();
pc.options.setReal(PoseClustering::Option::DISTANCE_THRESHOLD, rmsd);
}
if (parpars.has("scope"))
{
String scope = parpars.get("scope");
if (scope == "C_ALPHA")
pc.options.set(PoseClustering::Option::RMSD_LEVEL_OF_DETAIL, PoseClustering::C_ALPHA);
else if (scope == "BACKBONE")
pc.options.set(PoseClustering::Option::RMSD_LEVEL_OF_DETAIL, PoseClustering::BACKBONE);
else if (scope == "ALL_ATOMS")