From 759d7aa004f3d4f73592197b8b083584e0872ece Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Wed, 26 Jul 2017 16:26:00 +0200 Subject: [PATCH 01/22] Preparing for method name changes --- CLASS_NAMES_PYTHON | 21 ++++ METHOD_NAMES | 69 ++++++++++++ METHOD_NAMES_TXN | 69 ++++++++++++ NAMES | 267 +++++++++++++++++++++++++++++++++++++++++++++ NAMES_WITH_CONTEXT | 250 ++++++++++++++++++++++++++++++++++++++++++ README_NAMES | 57 ++++++++++ names.py | 105 ++++++++++++++++++ 7 files changed, 838 insertions(+) create mode 100644 CLASS_NAMES_PYTHON create mode 100644 METHOD_NAMES create mode 100644 METHOD_NAMES_TXN create mode 100644 NAMES create mode 100644 NAMES_WITH_CONTEXT create mode 100644 README_NAMES create mode 100644 names.py diff --git a/CLASS_NAMES_PYTHON b/CLASS_NAMES_PYTHON new file mode 100644 index 0000000..2382c56 --- /dev/null +++ b/CLASS_NAMES_PYTHON @@ -0,0 +1,21 @@ +Extractor +AttractPairList +AttractRigidbody +Rigidbody +BasePair +DNA +BDNA +Twist +Rise +Roll +Tilt +Screw +Shift +Twist +Surface +Coord3D +Matrix +FillAtom +NamedTemporaryFile +OptionParser +StringIO diff --git a/METHOD_NAMES b/METHOD_NAMES new file mode 100644 index 0000000..f48ec86 --- /dev/null +++ b/METHOD_NAMES @@ -0,0 +1,69 @@ +ABrotate +Add +AddAtom +AddCoord +addfinalizer +AddLigand +ApplyLocal +ApplyMatrix +Apply +AttractEulerRotate +Backbone +CA +ChangeRepresentation +ChangeType +CopyAtom +createRigid +CreateRigid +FindCenter +GetAtomProperty +GetChainId +getCoords +GetCoords +GetMatrix +GetMinimizedVarsAtIter +GetMinimizedVars +GetNumberIter +GetResidId +GetRigidBody +getStructure +GetType +getVdw +MatTrans2screw +Print +PrintMatrix +PrintParam +PrintPDB +Radius +RadiusGyration +Reduce +Reducer +removeclosest +rigidXMat44 +Rmsd +SelectAllAtoms +SelectAtomID +SelectAtomType +SelectChainId +SelectResidType +SelectResRange +SetAtom +SetAtomProperty +SetChainId +setCoords +SetCoords +setdefault +SetResidId +SetRestraint +SetRigid +setRotation +setTranslation +Size +surfpointParams +syncCoords +toatom +ToPdbString +toString +Translate +unsafeGetCoords +WritePDB diff --git a/METHOD_NAMES_TXN b/METHOD_NAMES_TXN new file mode 100644 index 0000000..5863aff --- /dev/null +++ b/METHOD_NAMES_TXN @@ -0,0 +1,69 @@ +ABrotate rotate +AddAtom add_atom +AddCoord add_coord +Add add +addfinalizer add_finalizer +AddLigand add_ligand +ApplyLocal apply_local +ApplyMatrix apply_matrix +Apply apply +AttractEulerRotate euler_rotate +Backbone backbone +CA get_CA +ChangeRepresentation change_representation +ChangeType change_type +CopyAtom copy_atom +createRigid create_rigid +CreateRigid create_rigid +FindCenter find_center +GetAtomProperty get_atom_property +GetChainId get_chainid +getCoords get_coords +GetCoords get_coords +GetMatrix get_matrix +GetMinimizedVarsAtIter get_minimized_vars_at_iter +GetMinimizedVars get_minimized_vars +GetNumberIter get_number_iter +GetResidId get_resid +GetRigidBody get_rigid +getStructure get_structure +GetType get_type +getVdw get_vdw +MatTrans2screw mat44_to_screw +PrintMatrix print_matrix +PrintParam print_param +PrintPDB print_pdb +Print print +RadiusGyration radius_of_gyration +Radius radius +Reducer reducer +Reduce reduce +removeclosest remove_closest +rigidXMat44 rigidXMat44_CHANGEMANUALLY +Rmsd rmsd +SelectAllAtoms select_all_atoms +SelectAtomID select_atomid +SelectAtomType select_atomtype +SelectChainId select_chainid +SelectResidType select_restype +SelectResRange select_resid_range +SetAtomProperty set_atom_property +SetAtom set_atom +SetChainId set_chainid +setCoords set_coords +SetCoords set_coords +setdefault set_default +SetResidId set_resid +SetRestraint set_restraint +SetRigid set_rigid +setRotation set_rotation +setTranslation set_translation +Size size +surfpointParams surfpoint_params +syncCoords sync_coords +toatom to_atom +ToPdbString to_pdb_string +toString to_string +Translate translate +unsafeGetCoords unsafe_get_coords +WritePDB write_pdb diff --git a/NAMES b/NAMES new file mode 100644 index 0000000..77e1987 --- /dev/null +++ b/NAMES @@ -0,0 +1,267 @@ +ABrotate +abspath +add +Add +AddAtom +AddCoord +addfinalizer +AddLigand +add_argument +add_mutually_exclusive_group +add_option +add_parser +add_subparsers +ADNA +append +Apply +ApplyLocal +ApplyMatrix +apply_matrix +ArgumentParser +assertAlmostEqual +assertEqual +assertFalse +assertLess +assertListEqual +assertMatrixAlmostEqual +assertNotEqual +assertRaises +assertRaisesRegexp +assertSameDimensions +assertTrue +assert_equal +atan +Atom +AttractEulerRotate +AttractPairList +AttractRigidbody +b64decode +b64encode +Backbone +BasePair +BDNA +CA +ceil +center_to_origin +ChangeRepresentation +ChangeType +check_composition +check_ff_version_match +check_file_exists +close +cmp +compile +compress +compress_file +Coord3D +CopyAtom +copyfile +cos +Counter +create +createRigid +CreateRigid +create_subparser +critical +decompress +dedent +deepcopy +degrees +detach +dirname +DNA +endswith +error +exception_names_to_exception_list +exists +exit +exp +extend +Extractor +fabs +FillAtom +finalize_options +FindCenter +floor +flush +format +format_matrix +from_file +from_stream +from_string +func +get +GetAtomProperty +GetChainId +getCoords +GetCoords +getcwd +GetMatrix +getmembers +GetMinimizedVars +GetMinimizedVarsAtIter +GetNumberIter +getopt +GetResidId +GetRigidBody +getStructure +GetType +get_atom_charges_map +get_atom_radii_map +get_config_vars +get_group +get_matrix +get_rotation +get_tag_delimiter +get_translation +glob +group +groupby +groupdict +groups +has_duplicate_atoms +index +info +initialize_options +insert +isclass +is_incomplete +items +iteritems +join +keys +load +main +match +Matrix +MatTrans2screw +minimize +Movement +NamedTemporaryFile +nonbon8 +Normalize +not_ +now +number_of_minimizations +number_of_rotations +number_of_translations +open +optimize +optimize_charges +OptionParser +outergrid +parse_args +parse_attract_output +parse_command_line +pop +Popen +Print +PrintMatrix +PrintParam +PrintPDB +print_help +print_output_model +radians +Radius +RadiusGyration +random +randrange +read +readline +readlines +readouterr +read_aminon +read_attract_output +read_attract_parameters +read_forcefield_from_reduced +read_name_conversion_file +read_reduction_parameters +read_rotations +read_rotdat +read_topology +read_translations +realpath +reduce +Reduce +Reducer +remove +removeclosest +rename_atoms_and_residues +replace +residuetag +residue_reduction_errors +reverse +Rigidbody +rigidXMat44 +Rise +Rmsd +Roll +run_attract +Screw +search +seed +seek +SelectAllAtoms +SelectAtomID +SelectAtomType +SelectChainId +SelectResidType +SelectResRange +SetAtom +SetAtomProperty +SetChainId +SetCoords +setCoords +setdefault +SetResidId +SetRestraint +SetRigid +setRotation +setTranslation +set_coords +set_defaults +set_verbosity +Shift +sin +size +Size +skipif +Slide +sort +split +splitlines +sqrt +start +startswith +stat +strftime +StringIO +strip +sub +subDNA +SubDNA +submit +superpose +Surface +surfpoint +surfpointParams +syncCoords +system +tan +Tilt +toatom +ToPdbString +toString +Translate +Twist +uniform +unsafeGetCoords +upper +urlopen +values +walk +warn +warning +write +writelines +WritePDB diff --git a/NAMES_WITH_CONTEXT b/NAMES_WITH_CONTEXT new file mode 100644 index 0000000..7e4a65a --- /dev/null +++ b/NAMES_WITH_CONTEXT @@ -0,0 +1,250 @@ +ABrotate : #bestok.ABrotate( hp.point, hp.point + hp.unitVector, hp.angle ) +abspath : return os.path.abspath(dirname) +add : tot.add(d2) +Add : dna.Add(new,mov) +AddAtom : newRig.AddAtom(a) +AddCoord : c.AddCoord(coo2) +addfinalizer : request.addfinalizer(teardown) +AddLigand : forcefield.AddLigand(lig) +add_argument : parser.add_argument('-o', '--output', +add_mutually_exclusive_group : group = parser.add_mutually_exclusive_group() +add_parser : parser = parent.add_parser('extract', help=__doc__) +add_subparsers : subparsers = parser.add_subparsers() +append : axislist.append(model) +Apply : newPB.Apply(m) +ApplyLocal : dna.ApplyLocal(Roll(30), dna.Size() / 2) +ApplyMatrix : mobil.ApplyMatrix(m) +apply_matrix : ligand.apply_matrix(m) +assertAlmostEqual : self.assertAlmostEqual(ener, -51.6955215854) +assertEqual : self.assertEqual(dna.Size(), 231) +assertFalse : self.assertFalse(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work +assertLess : self.assertLess(abs(dz + 5.0), tolerance) +assertListEqual : self.assertListEqual(ref, res) +assertMatrixAlmostEqual : self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) +assertNotEqual : self.assertNotEqual(s, '') +assertRaises : self.assertRaises(RuntimeError, Rmsd, "hello", self.rigid1) +assertRaisesRegexp : with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): +assertSameDimensions : self.assertSameDimensions(source, target) +assertTrue : self.assertTrue(filecmp.cmp(TEST_LIGAND_RED_SCORPION_CGOPT, self.output_name)) +assert_equal : errors += trans1.assert_equal(trans2) +atan : #beta = math.atan(hpori.normtranslation*2*math.pi/(2*rayon*hpori.angle)) +Atom : return ptools.Atom(self, self.coords) +AttractEulerRotate : output.AttractEulerRotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) +b64decode : compressed = base64.b64decode(f) +b64encode : encoded = base64.b64encode(compressed) +Backbone : ligBBInterface = ligprobe.Backbone() & selectListOfResidues(ligprobe,ligResidues) #interface bb residues of docked ligand +CA : refca = ref.CA() +ceil : if enerk(rec,templig,1+math.ceil(nbmono),144) > 10: +center_to_origin : self.r.center_to_origin() +ChangeRepresentation : dna.ChangeRepresentation(PB_AA) +ChangeType : dna.ChangeType(0, "A", TEST_BP_RED) +check_composition : coarse_res.check_composition() +check_ff_version_match : ff_name = ptools.io.check_ff_version_match(args.receptor_name, args.ligand_name) +check_file_exists : ptools.io.check_file_exists(args.ligand) +close : #f.close() +cmp : assert filecmp.cmp(TEST_SINGLEMINIM_MINIMIZATION_OUT, output_name) is True +compile : regexp = re.compile("[0-9]+:[0-9]+") # filter keys of the form "23:356" +compress : compressed = bz2.compress(all) +compress_file : print(docking.compress_file('attract.inp')) +CopyAtom : ABrotate( model.CopyAtom(0).GetCoords(), model.CopyAtom(1).GetCoords(), bp, math.radians(angle) ) +copyfile : shutil.copyfile(TEST_DOCKING_TRANSLATION, 'translation.dat') +cos : #axn = math.cos(beta) * axe + -math.sin(beta) * vectn/Norm(vectn) +Counter : counter = collections.Counter(self.found_atoms) +create : bead = beadcreator.create() +createRigid : rtot = tot.createRigid() +CreateRigid : #dnaRig= dnaRig + dna.CreateRigid() +create_subparser : extract_cmd.create_subparser(subparsers) +critical : ptools.io.critical("option --delgrid requires --ff=scorpion", +decompress : file = bz2.decompress(compressed) +dedent : content = textwrap.dedent(""" +deepcopy : self._lstofAtoms = copy.deepcopy(lstofAtoms) +degrees : pitch = abs(hp.normtranslation*(360./(abs(math.degrees(hp.angle))))) +detach : self.mat.detach() +dirname : project_root = os.path.dirname(cwd) +endswith : if filename.endswith(suffix): +error : parser.error("please specify molecule type (--prot or --dna) and atomic file") +exception_names_to_exception_list : ignore_exceptions = ptools.exceptions.exception_names_to_exception_list(args.ignore_error) +exists : if not os.path.exists(name): +exit : sys.exit(1) +exp : #print >>sys.stderr, "*", i, oldener, newener, Rmsd(ref,ligTemp), fpib, delta, math.exp(-delta/ftemp) +extend : boolean_options.extend(['use_legacy_boost']) +Extractor : e = extract.Extractor(outputfile) # extracts output structures or reuse the generated database +fabs : nbb = 2*math.pi/math.fabs(hp.angle) +finalize_options : _build_ext.finalize_options(self) +FindCenter : pj = monoj.FindCenter() +floor : listn = [int(math.floor(nbb)), int(math.ceil(nbb))] +flush : file.flush() +format : copyright = u"{}, {}".format(datetime.datetime.now().year, AUTHORS) +format_matrix : other.format_matrix()) +from_file : return AttractOutput.from_file(path) +from_string : return AttractOutput.from_string(content) +func : args.func(args) +get : descriptions = beadCorresp.get(residname, []) +GetAtomProperty : ires = rtot.GetAtomProperty(i).GetResidId() +GetChainId : cc = at.GetChainId() +getCoords : coord = outergrid.getCoords(i) +GetCoords : X= Atom(at,proj.GetCoords()+(AB*distX)) +getcwd : cwd = os.getcwd() +GetMatrix : m=(Twist( 35.9063052632 )+Roll( -2.66592947368 )+Tilt( -1.80234789474 )+Slide( -1.34487389474 )+Shift( -0.425181378947 )).GetMatrix(); +getmembers : return [name for name, obj in inspect.getmembers(sys.modules[__name__]) +GetMinimizedVars : X = lbfgs_minimizer.GetMinimizedVars() # optimized freedom variables after minimization +GetMinimizedVarsAtIter : traj = lbfgs_minimizer.GetMinimizedVarsAtIter(iteration) +GetNumberIter : ntraj = lbfgs_minimizer.GetNumberIter() +getopt : options, patterns = getopt.getopt(sys.argv[1:], 'o:r:', +GetResidId : jres = ati.GetResidId() +GetRigidBody : bp = dna[i].GetRigidBody() +getStructure : lig3 = e.getStructure(lig, "%i:%i" % (transNB, rotNB)) +GetType : nami = ati.GetType() +get_atom_charges_map : aa_charges_map = self.get_atom_charges_map() +get_atom_radii_map : aa_radii_map = self.get_atom_radii_map() +get_config_vars : vars = sysconfig.get_config_vars() +get_group : translations = docking.get_group(translations, args.ngroups, args.ngroup) +get_matrix : m = docking_result.get_matrix(args.transid, args.rotid) +get_rotation : r = t.get_rotation(rotid) +get_tag_delimiter : tag_delimiter = ptools.Atomproperty.get_tag_delimiter() +get_translation : t = self.get_translation(transid) +glob : patternFiles = glob.glob(pathName) +group : addTest(suite, m.group(2), lineNo) +groupby : residue_list = itertools.groupby(self.atoms, +groupdict : minim = match.groupdict() +groups : g = m.groups() +has_duplicate_atoms : elif self.has_duplicate_atoms(): +index : print nb/2.,min(ldist),int(round(dmin+(dmax-dmin)/2))+ldist.index(min(ldist)) +info : log.info("{:s} found at {:s}".format(fortran_library_name, fortlib)) +initialize_options : _build_ext.initialize_options(self) +insert : sys.path.insert(0, project_root) +isclass : if inspect.isclass(obj) and issubclass(obj, ResidueReductionError)] +is_incomplete : if not bead.is_incomplete()] +items : for residname, cgnames in residNames.items(): +iteritems : for key, value in minim.iteritems(): +join : prgname = os.path.join(thispath, "reduce_attract2.py") +keys : if namo in equiv.keys(): +load : data = yaml.load(f) +main : unittest.main() +match : if regexp.match(k): +Matrix : self.mat = ptools.Matrix(self.nrows, self.ncols) +MatTrans2screw : s = ptools.MatTrans2screw(m) +minimize : lbfgs_minimizer.minimize(niter) +Movement : mov = ptools.Movement() +nonbon8 : ener = forcefield.nonbon8(rec,lig,pl) +Normalize : AB.Normalize() +not_ : sel_not_ca = sel_ca.not_() # operator NOT +now : now = datetime.datetime.now() +number_of_minimizations : other.number_of_minimizations()) +number_of_rotations : return [t.number_of_rotations() for t in self.translations] +number_of_translations : other.number_of_translations()) +open : d = shelve.open(databasefile, flag='r') +optimize : optimized = cgopt.optimize(self.number_of_atoms, +optimize_charges : reducer.optimize_charges(args.delgrid) +outergrid : outergrid = surf.outergrid(grid, rec, distance_to_receptor) +parse_args : (options, args) = parser.parse_args() +parse_attract_output : output_test = ptools.io.parse_attract_output(out) +parse_command_line : cmd_args = ptools_cli.parse_command_line(args) +pop : line = clean.pop(0).split() +Popen : return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0] +Print : self.mat.Print() +PrintMatrix : print lig.PrintMatrix() +PrintParam : for i in dna.PrintParam().split("\n"): +PrintPDB : print d.PrintPDB() +print_help : parser.print_help() +print_output_model : reducer.print_output_model(args.output) +radians : ABrotate (p, p+choice([vecti,vectj,vectk]), ligTemp, math.radians(uniform(-5, 5))) +Radius : radmax = rec.Radius() +RadiusGyration : radg = rec.RadiusGyration() +random : if random.random() <= math.exp(-delta) : +randrange : return random.randrange(-max_float, +max_float) +read : all = fobject.read() +readline : line = rotdat.readline().split() +readlines : lines = f.readlines() +readouterr : out, err = capfd.readouterr() +read_aminon : params = io.read_aminon(tmpfile.name) +read_attract_output : docking_result = ptools.io.read_attract_output(args.attract_output) +read_attract_parameters : nbminim, lignames, minimlist, rstk = ptools.io.read_attract_parameters(args.conf) +read_forcefield_from_reduced : io.read_forcefield_from_reduced(tmpfile.name) +read_name_conversion_file : self.read_name_conversion_file() +read_reduction_parameters : self.read_reduction_parameters() +read_rotations : rotations = docking.read_rotations() +read_rotdat : self.read_rotdat() +read_topology : self.read_topology() +read_translations : translations = docking.read_translations() +realpath : thisscript = os.path.realpath(__file__) +reduce : reducer.reduce(ignore_exceptions=ignore_exceptions) +Reduce : coarseRes = coarseResList[i].Reduce(resName, resId) +Reducer : reducer = ptools.reduce.Reducer(atomicname, redname) +remove : self._lstofAtoms.remove(atomtype) +removeclosest : outergrid = surf.removeclosest(outergrid, options.density) +rename_atoms_and_residues : self.rename_atoms_and_residues() +replace : return '"' + string.replace(str, '\\', '\\\\') + '"' +residuetag : key=lambda atom: atom.residuetag()) +residue_reduction_errors : args.ignore_error = ptools.exceptions.residue_reduction_errors() +reverse : cgch.reverse() +Rigidbody : ligand = ptools.Rigidbody(args.ligand) +rigidXMat44 : structure = extract.rigidXMat44(lig, s.ext.matrix) +Rise : mov = ptools.Rise(self.alpha) +Rmsd : return ptools.Rmsd(l1.CA().CreateRigid(), l2.CA().CreateRigid()) +Roll : mov = ptools.Roll(self.alpha) +run_attract : docking.run_attract(lig, rec, translations, rotations, minimlist, ff_specs, args, ref, ftraj) +Screw : self.s = ptools.Screw() +search : elif world_re.search(line): +seed : random.seed(42) +seek : tmpfile.seek(0) +SelectAllAtoms : monoTest = mono1.SelectAllAtoms().CreateRigid() +SelectAtomID : # lastpoint = axpdb.SelectAtomID(407).CreateRigid() # +SelectAtomType : sseg2 = seg2.SelectAtomType("C1'").CreateRigid() +SelectChainId : #m1= groove.SelectChainId("A").CreateRigid() +SelectResidType : met1A = self.rig.SelectResidType("MET") & self.rig.SelectResRange(1, 5) & self.rig.SelectChainId("A") +SelectResRange : seg2= lig.SelectResRange(4,7).CreateRigid () +SetAtom : self.r.SetAtom(3, atom) +SetAtomProperty : proch.SetAtomProperty(j,at) +SetChainId : at.SetChainId(letter) +SetCoords : ato.SetCoords(coo) +setCoords : out.setCoords(i, coords2) +setdefault : residuMap.setdefault(residueIdentifier, []).append(at) +SetResidId : atto.SetResidId(i+1) +SetRestraint : # forcefield.SetRestraint(rstk) +SetRigid : atsel.SetRigid(rigidbody) +setRotation : rec.setRotation(False) +setTranslation : rec.setTranslation(False) +set_defaults : parser.set_defaults(func=run) +set_verbosity : log.set_verbosity(log.INFO) +Shift : mov = ptools.Shift(self.alpha) +sin : raynew = rayon*math.sin(hpori.angle/2)/math.sin(angnew/2) +size : k2 = d2.size() +Size : bp = dna[dna.Size()-1].GetRigidBody() +skipif : #skip_on_osx = pytest.mark.skipif(sys.platform == 'darwin', +Slide : mov = ptools.Slide(self.alpha) +sort : lChain.sort() +split : shift +=float(i.split()[20]) +splitlines : lines = content.splitlines() +sqrt : distX = math.sqrt((D**2)-(startProj**2))#V +start : line = line[:e.start()] +startswith : elif ligne.startswith("MAT") : +stat : statout = os.stat(filename) +strftime : print "Finished at: ",now.strftime("%A %B %d %Y, %H:%M") +strip : if line.strip() and not line.startswith('#'): +sub : return re.sub(r'\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(', +submit : beadcreator.submit(atom) +superpose : sup = ptools.superpose(self.prot1, prot2) # superpose(reference, mobile) +Surface : surf = ptools.Surface(30, 30, SOLVATION_PARAMETER_FILE) +surfpoint : grid = surf.surfpoint(rec, 1.4) +surfpointParams : surf.surfpointParams(5000, distance_to_receptor) +syncCoords : r2.syncCoords() +system : os.system("python applyscrew.py X2.pdb X4.pdb ABC_5.pdb --ch %s --nb 1 > pentamer.pdb" %letter) +tan : #print "beta ", beta*180./math.pi, "tg(beta) ", math.tan(beta) +Tilt : mov = ptools.Tilt(self.alpha) +toatom : return self.toatom().ToPdbString() +ToPdbString : #print a.ToPdbString(), +toString : print >> sys.stderr,"P:\t"+screw.point.toString()+"omega:\t"+screw.unitVector.toString()+"theta angle:\t [radian] "+str(screw.angle)+"\t [degree] "+ str(math.degrees(screw.angle))+"\ntrans:\t"+str(screw.normtranslation) +Translate : ligTemp.Translate(choice([vecti,vectj,vectk])*(uniform(-3, 3))) +Twist : mov = ptools.Twist(self.alpha) +uniform : raytmp = raynew + random.uniform(-3, 3) +unsafeGetCoords : r2.unsafeGetCoords(i, co2) +upper : ff = get_header_tokens()[1].upper() +urlopen : pdb = urllib2.urlopen("http://www.rcsb.org/pdb/files/%s.pdb" % pdbname) +values : for atom_parameters in self.atom_reduction_parameters.values()] +walk : # editing the 'dirnames' list will stop os.walk() from recursing into there. +warn : warnings.warn("only check the call, not the result") +warning : ptools.io.warning(msg) +write : sys.stderr.write("The bead %i of residue %s is incomplete. Please check your pdb!\n" +writelines : output.writelines(["static ", suite['name'], " ", suite['object'], ";\n\n"]) +WritePDB : final.WritePDB(writefile) diff --git a/README_NAMES b/README_NAMES new file mode 100644 index 0000000..9e429a2 --- /dev/null +++ b/README_NAMES @@ -0,0 +1,57 @@ +CHR 24 juillet 2017 + +Making more canonical identifiers in ptools (après discussion avec Chantal et Benoist) + +A. Goals + +1. Method and function names should start with a small letter +2. Underscores between words lowercase) should be preferred to camelCase + + +B. "Domains" + +1. Python modules and scripts +2. Cython bindings +3. C/C++ code +4. Fortran code + + +C. Guiding principles + +1. All work should be done in a branch ("renames") +2. To eliminate a manual step for distinguishing C++ and python calls, both C++ and python names will be changed +3. Python scripts alone will be searched in identify names to be changed. This means it is possible that some naming inconsistencies may result on the C++ side. This won't matter in a python-only future. +4. No fortran names will be changed; no fortran subroutines/functions are called directly by python anyway. +4. Automated tools will be used as much as possible to find candidates for renaming and to do the renaming (see "names.py") + + +D. Detailed protocol: + +1. Find names using regular expressions: any name with letters and numbers and _, preceded by '.' and followed by '(' + + $ sed --in-place 's/CONTEXT = True/CONTEXT = False/' names.py + $ python names.py find ../ptools ../ptools-vrac > NAMES + + $ sed --in-place 's/CONTEXT = False/CONTEXT = True/' names.py + $ python names.py find ../ptools ../ptools-vrac > NAMES_WITH_CONTEXT + +2. Eliminate as many known PTools class names as possible + + $ grep -vf CLASS_NAMES_PYTHON NAMES > METHOD_NAMES + +3. Manually eliminate any names referring to external modules, classes, or names that are already OK. It helps to look in NAMES_WITH_CONTEXT, or grep other context examples if in doubt. + + $ vi METHOD_NAMES + +4. Add 2nd column with new method names (translations) + + $ cp METHOD_NAMES METHOD_NAMES_TXN + $ vi !$ + +5. Verify that no old names are present in multiple locations in the names list + + $ grep -f METHOD_NAMES METHOD_NAMES_TXN + $ grep -cf METHOD_NAMES METHOD_NAMES_TXN (compare count to wc METHOD_NAMES) + + + diff --git a/names.py b/names.py new file mode 100644 index 0000000..8ab4816 --- /dev/null +++ b/names.py @@ -0,0 +1,105 @@ +import sys +import os +import re + +# Set CONTEXT True to print latest context line for each match found +CONTEXT = False + +def find_names_in_file(filename, names={}, context=CONTEXT): + """Find all class.method and module.class names in one file, return as keys in names dict.""" + #e = re.compile('\.[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*') + #e = re.compile('\.[a-zA-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*\(') + e = re.compile('\.[a-zA-Z]+[a-zA-Z0-9_]*\(') + with open(filename) as fin: + for linee in fin.readlines(): + line = linee.strip() + match = e.search(line) + try: + # group includes leading "." and trailing "(" + name = match.group()[1:-1] + if context: + names[name] = line + else: + names[name] = None + except AttributeError: + # Failure to match returns an object without a group() method + pass + pass + return names + + +def find_names(searchdirs='./', suffix=".py"): + """Find all class.method and module.class names in all files in searchdirs, return as keys in names dict.""" + names = {} + + for searchdir in searchdirs: + + # From the os.walk example at https://stackoverflow.com/a/120701 + for dirname, dirnames, filenames in os.walk(searchdir): + + for filename in filenames: + if filename.endswith(suffix): + fullname = os.path.join(dirname, filename) + find_names_in_file(fullname, names=names) + + # Advanced usage: + # editing the 'dirnames' list will stop os.walk() from recursing into there. + if '.git' in dirnames: + # don't go into any .git directories. + dirnames.remove('.git') + + return names + + +def print_names(names, key=lambda x: x.upper(), print_values=CONTEXT): + for name in sorted(names.keys(), key=key): + if print_values: + print name, " : ", names[name] + else: + print name + + +def read_names_data(filename): + """Read data from file to create names dict.""" + names = {} + with open(filename) as fin: + for line in fin.readlines(): + #print filename, line.strip() + entries = line.strip().split() + if len(entries) == 2: + old, new = line.strip().split() + names[old] = new + else: + print entries + return names + + +def rename_all(names): + """Use unix sed command to rename identifiers in all relevant files.""" + # find . -name \*.h -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # find . -name \*.cpp -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # find . -name \*.pyx -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # find . -name \*.py -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # find . -name \*.rst -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # make clean + # make install + # make test + for old in sorted(names.keys(), key=lambda x: x.upper()): + print old, " --> ", names[old] + return + + +if __name__ == "__main__": + + task = sys.argv[1] + + if task.startswith('find'): + searchdirs = sys.argv[2:] + names = find_names(searchdirs) + print_names(names) + + elif task.startswith('rename'): + namesfile = sys.argv[2] + names = read_names_data(namesfile) + rename_all(names) + From b22f8a52c95bdec5da9157459bf4dae43adcbba9 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Wed, 26 Jul 2017 18:46:15 +0200 Subject: [PATCH 02/22] More name change preparation. --- CLASS_NAMES_PYTHON | 2 ++ METHOD_NAMES | 2 ++ METHOD_NAMES_TXN | 4 ++++ NAMES_WITH_CONTEXT | 31 ++++++++++++++++++++---- README_NAMES | 4 +++- TEST_TXN | 2 ++ names.py | 60 ++++++++++++++++++++++++++++++++++------------ test.T | 1 + test.T_ori | 1 + 9 files changed, 87 insertions(+), 20 deletions(-) create mode 100644 TEST_TXN create mode 100644 test.T create mode 100644 test.T_ori diff --git a/CLASS_NAMES_PYTHON b/CLASS_NAMES_PYTHON index 2382c56..d9639cc 100644 --- a/CLASS_NAMES_PYTHON +++ b/CLASS_NAMES_PYTHON @@ -15,6 +15,8 @@ Twist Surface Coord3D Matrix +Atom +Atomproperty FillAtom NamedTemporaryFile OptionParser diff --git a/METHOD_NAMES b/METHOD_NAMES index f48ec86..e70e5bd 100644 --- a/METHOD_NAMES +++ b/METHOD_NAMES @@ -15,6 +15,8 @@ ChangeType CopyAtom createRigid CreateRigid +Dist +Dist2 FindCenter GetAtomProperty GetChainId diff --git a/METHOD_NAMES_TXN b/METHOD_NAMES_TXN index 5863aff..8f8fc48 100644 --- a/METHOD_NAMES_TXN +++ b/METHOD_NAMES_TXN @@ -15,6 +15,10 @@ ChangeType change_type CopyAtom copy_atom createRigid create_rigid CreateRigid create_rigid +crossproduct cross_product +Dist2 dist2 +Dist dist +dotproduct dot_product FindCenter find_center GetAtomProperty get_atom_property GetChainId get_chainid diff --git a/NAMES_WITH_CONTEXT b/NAMES_WITH_CONTEXT index 7e4a65a..829f76e 100644 --- a/NAMES_WITH_CONTEXT +++ b/NAMES_WITH_CONTEXT @@ -8,13 +8,16 @@ addfinalizer : request.addfinalizer(teardown) AddLigand : forcefield.AddLigand(lig) add_argument : parser.add_argument('-o', '--output', add_mutually_exclusive_group : group = parser.add_mutually_exclusive_group() +add_option : parser.add_option("--after", action="store", type="string", dest="chaft", help="sequence to be added at the 3-extremity of the DNA") add_parser : parser = parent.add_parser('extract', help=__doc__) add_subparsers : subparsers = parser.add_subparsers() +ADNA : mov = ptools.ADNA() append : axislist.append(model) Apply : newPB.Apply(m) ApplyLocal : dna.ApplyLocal(Roll(30), dna.Size() / 2) ApplyMatrix : mobil.ApplyMatrix(m) apply_matrix : ligand.apply_matrix(m) +ArgumentParser : parser = argparse.ArgumentParser(description=__doc__, assertAlmostEqual : self.assertAlmostEqual(ener, -51.6955215854) assertEqual : self.assertEqual(dna.Size(), 231) assertFalse : self.assertFalse(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work @@ -29,10 +32,15 @@ assertTrue : self.assertTrue(filecmp.cmp(TEST_LIGAND_RED_SCORPION_CGOPT, sel assert_equal : errors += trans1.assert_equal(trans2) atan : #beta = math.atan(hpori.normtranslation*2*math.pi/(2*rayon*hpori.angle)) Atom : return ptools.Atom(self, self.coords) +Atomproperty : at = ptools.Atomproperty() AttractEulerRotate : output.AttractEulerRotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) +AttractPairList : pl = ptools.AttractPairList(receptor, ligand, surreal(500)) +AttractRigidbody : lig = ptools.AttractRigidbody(lig) b64decode : compressed = base64.b64decode(f) b64encode : encoded = base64.b64encode(compressed) Backbone : ligBBInterface = ligprobe.Backbone() & selectListOfResidues(ligprobe,ligResidues) #interface bb residues of docked ligand +BasePair : bp = ptools.BasePair(self.dna[0].GetRigidBody()) +BDNA : mov = ptools.BDNA() CA : refca = ref.CA() ceil : if enerk(rec,templig,1+math.ceil(nbmono),144) > 10: center_to_origin : self.r.center_to_origin() @@ -46,6 +54,7 @@ cmp : assert filecmp.cmp(TEST_SINGLEMINIM_MINIMIZATION_OUT, output_name) is compile : regexp = re.compile("[0-9]+:[0-9]+") # filter keys of the form "23:356" compress : compressed = bz2.compress(all) compress_file : print(docking.compress_file('attract.inp')) +Coord3D : axe = ptools.Coord3D(0, 0, 1) CopyAtom : ABrotate( model.CopyAtom(0).GetCoords(), model.CopyAtom(1).GetCoords(), bp, math.radians(angle) ) copyfile : shutil.copyfile(TEST_DOCKING_TRANSLATION, 'translation.dat') cos : #axn = math.cos(beta) * axe + -math.sin(beta) * vectn/Norm(vectn) @@ -53,14 +62,18 @@ Counter : counter = collections.Counter(self.found_atoms) create : bead = beadcreator.create() createRigid : rtot = tot.createRigid() CreateRigid : #dnaRig= dnaRig + dna.CreateRigid() -create_subparser : extract_cmd.create_subparser(subparsers) +create_subparser : translate_cmd.create_subparser(subparsers) critical : ptools.io.critical("option --delgrid requires --ff=scorpion", +crossproduct : res = ptools.crossproduct(self.coo1, self.coo2) decompress : file = bz2.decompress(compressed) dedent : content = textwrap.dedent(""" deepcopy : self._lstofAtoms = copy.deepcopy(lstofAtoms) degrees : pitch = abs(hp.normtranslation*(360./(abs(math.degrees(hp.angle))))) detach : self.mat.detach() dirname : project_root = os.path.dirname(cwd) +Dist : tempdist = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(k)) +DNA : dna = ptools.DNA(PDB_BASE_PAIR, PDB_DNA) +dotproduct : s = ptools.dotproduct(v, hp.unitVector) endswith : if filename.endswith(suffix): error : parser.error("please specify molecule type (--prot or --dna) and atomic file") exception_names_to_exception_list : ignore_exceptions = ptools.exceptions.exception_names_to_exception_list(args.ignore_error) @@ -70,6 +83,7 @@ exp : #print >>sys.stderr, "*", i, oldener, newener, Rmsd(ref,ligTemp), fpib extend : boolean_options.extend(['use_legacy_boost']) Extractor : e = extract.Extractor(outputfile) # extracts output structures or reuse the generated database fabs : nbb = 2*math.pi/math.fabs(hp.angle) +FillAtom : coarseResList[id].FillAtom(atom.atomType, atom.coords.x, atom.coords.y, atom.coords.z) finalize_options : _build_ext.finalize_options(self) FindCenter : pj = monoj.FindCenter() floor : listn = [int(math.floor(nbb)), int(math.ceil(nbb))] @@ -77,6 +91,7 @@ flush : file.flush() format : copyright = u"{}, {}".format(datetime.datetime.now().year, AUTHORS) format_matrix : other.format_matrix()) from_file : return AttractOutput.from_file(path) +from_stream : return cls.from_stream(StringIO.StringIO(content)) from_string : return AttractOutput.from_string(content) func : args.func(args) get : descriptions = beadCorresp.get(residname, []) @@ -123,10 +138,12 @@ load : data = yaml.load(f) main : unittest.main() match : if regexp.match(k): Matrix : self.mat = ptools.Matrix(self.nrows, self.ncols) -MatTrans2screw : s = ptools.MatTrans2screw(m) +MatTrans2screw : hp = ptools.MatTrans2screw(ptools.superpose(mono2, mono1).matrix) minimize : lbfgs_minimizer.minimize(niter) Movement : mov = ptools.Movement() +NamedTemporaryFile : tmpfile = tempfile.NamedTemporaryFile(mode, **kwargs) nonbon8 : ener = forcefield.nonbon8(rec,lig,pl) +norm : return ptools.norm(ptools.crossproduct(a, b)) Normalize : AB.Normalize() not_ : sel_not_ca = sel_ca.not_() # operator NOT now : now = datetime.datetime.now() @@ -136,6 +153,7 @@ number_of_translations : other.number_of_translations()) open : d = shelve.open(databasefile, flag='r') optimize : optimized = cgopt.optimize(self.number_of_atoms, optimize_charges : reducer.optimize_charges(args.delgrid) +OptionParser : parser = optparse.OptionParser(description='Process some integers.') outergrid : outergrid = surf.outergrid(grid, rec, distance_to_receptor) parse_args : (options, args) = parser.parse_args() parse_attract_output : output_test = ptools.io.parse_attract_output(out) @@ -148,6 +166,7 @@ PrintParam : for i in dna.PrintParam().split("\n"): PrintPDB : print d.PrintPDB() print_help : parser.print_help() print_output_model : reducer.print_output_model(args.output) +print_pdb : print(final.print_pdb()) radians : ABrotate (p, p+choice([vecti,vectj,vectk]), ligTemp, math.radians(uniform(-5, 5))) Radius : radmax = rec.Radius() RadiusGyration : radg = rec.RadiusGyration() @@ -197,14 +216,15 @@ SelectResRange : seg2= lig.SelectResRange(4,7).CreateRigid () SetAtom : self.r.SetAtom(3, atom) SetAtomProperty : proch.SetAtomProperty(j,at) SetChainId : at.SetChainId(letter) -SetCoords : ato.SetCoords(coo) setCoords : out.setCoords(i, coords2) +SetCoords : ato.SetCoords(coo) setdefault : residuMap.setdefault(residueIdentifier, []).append(at) SetResidId : atto.SetResidId(i+1) SetRestraint : # forcefield.SetRestraint(rstk) SetRigid : atsel.SetRigid(rigidbody) setRotation : rec.setRotation(False) setTranslation : rec.setTranslation(False) +set_coords : self.atom.set_coords(Coord3D(-12, 12, 17)) set_defaults : parser.set_defaults(func=run) set_verbosity : log.set_verbosity(log.INFO) Shift : mov = ptools.Shift(self.alpha) @@ -221,10 +241,13 @@ start : line = line[:e.start()] startswith : elif ligne.startswith("MAT") : stat : statout = os.stat(filename) strftime : print "Finished at: ",now.strftime("%A %B %d %Y, %H:%M") +StringIO : fileobj = StringIO.StringIO(content) strip : if line.strip() and not line.startswith('#'): sub : return re.sub(r'\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(', +subDNA : dnat = tot.subDNA(k1, k1+kd) # ok +SubDNA : #ato13 = dna2.SubDNA(10,11).CreateRigid().CopyAtom(1) submit : beadcreator.submit(atom) -superpose : sup = ptools.superpose(self.prot1, prot2) # superpose(reference, mobile) +superpose : m = ptools.superpose(Zaxis, Protaxis).matrix Surface : surf = ptools.Surface(30, 30, SOLVATION_PARAMETER_FILE) surfpoint : grid = surf.surfpoint(rec, 1.4) surfpointParams : surf.surfpointParams(5000, distance_to_receptor) diff --git a/README_NAMES b/README_NAMES index 9e429a2..9cb005f 100644 --- a/README_NAMES +++ b/README_NAMES @@ -22,7 +22,8 @@ C. Guiding principles 2. To eliminate a manual step for distinguishing C++ and python calls, both C++ and python names will be changed 3. Python scripts alone will be searched in identify names to be changed. This means it is possible that some naming inconsistencies may result on the C++ side. This won't matter in a python-only future. 4. No fortran names will be changed; no fortran subroutines/functions are called directly by python anyway. -4. Automated tools will be used as much as possible to find candidates for renaming and to do the renaming (see "names.py") +5. Automated tools will be used as much as possible to find candidates for renaming and to do the renaming (see "names.py") +6. Attention to the order of the substitutions -- any shorter word should be translated AFTER longer words containing it. D. Detailed protocol: @@ -53,5 +54,6 @@ D. Detailed protocol: $ grep -f METHOD_NAMES METHOD_NAMES_TXN $ grep -cf METHOD_NAMES METHOD_NAMES_TXN (compare count to wc METHOD_NAMES) +6. Verify the order of the substitutions list! Any shorter word should be translated AFTER longer words containing it. Note that the translations are thus processed as a list, not a dictionary. diff --git a/TEST_TXN b/TEST_TXN new file mode 100644 index 0000000..7ced2c9 --- /dev/null +++ b/TEST_TXN @@ -0,0 +1,2 @@ +ApplyMatrix apply_matrix +Apply apply diff --git a/names.py b/names.py index 8ab4816..50f0b49 100644 --- a/names.py +++ b/names.py @@ -1,9 +1,11 @@ import sys import os +import subprocess +import time import re # Set CONTEXT True to print latest context line for each match found -CONTEXT = False +CONTEXT = True def find_names_in_file(filename, names={}, context=CONTEXT): """Find all class.method and module.class names in one file, return as keys in names dict.""" @@ -52,6 +54,7 @@ def find_names(searchdirs='./', suffix=".py"): def print_names(names, key=lambda x: x.upper(), print_values=CONTEXT): + """Print in sorted order. Must re-order as necessary to avoid renaming problems.""" for name in sorted(names.keys(), key=key): if print_values: print name, " : ", names[name] @@ -59,22 +62,30 @@ def print_names(names, key=lambda x: x.upper(), print_values=CONTEXT): print name -def read_names_data(filename): - """Read data from file to create names dict.""" - names = {} +def print_translations(tlist, print_values=CONTEXT): + for entry in tlist: + if print_values: + old, new = entry + print old, " : ", new + else: + print entry[0] + + +def read_translations(filename): + """Read data from file to create translations list.""" + translations = [] with open(filename) as fin: for line in fin.readlines(): #print filename, line.strip() - entries = line.strip().split() - if len(entries) == 2: - old, new = line.strip().split() - names[old] = new + entry = line.strip().split() + if len(entry) == 2: + translations.append(entry) else: - print entries - return names + print entry + return translations -def rename_all(names): +def rename_all(translations): """Use unix sed command to rename identifiers in all relevant files.""" # find . -name \*.h -exec sed --in-place 's/ABrotate/rotate/g' {} \; # find . -name \*.cpp -exec sed --in-place 's/ABrotate/rotate/g' {} \; @@ -84,8 +95,27 @@ def rename_all(names): # make clean # make install # make test - for old in sorted(names.keys(), key=lambda x: x.upper()): - print old, " --> ", names[old] + + ## TEST: Use .T suffix and a file named "test.T" for testing + #suffixes = [".T"] + suffixes = [".h", ".cpp", ".py", ".pyx"] + #suffixes = [".rst"] + + name_arg_template = "*%s" + sed_command_template = "s/%s/%s/g" + + for entry in translations: + if len(entry) != 2: + continue + old, new = entry + print "Renaming %s --> %s" % (old, new) + for suffix in suffixes: + name_arg = name_arg_template % (suffix) + sed_command = sed_command_template % (old, new) + args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') + print args + subprocess.Popen(args) + time.sleep(1) return @@ -100,6 +130,6 @@ def rename_all(names): elif task.startswith('rename'): namesfile = sys.argv[2] - names = read_names_data(namesfile) - rename_all(names) + translations = read_translations(namesfile) + rename_all(translations) diff --git a/test.T b/test.T new file mode 100644 index 0000000..d48e9ae --- /dev/null +++ b/test.T @@ -0,0 +1 @@ +First apply_matrix and now a little apply_matrix(a,b) diff --git a/test.T_ori b/test.T_ori new file mode 100644 index 0000000..9d8eb03 --- /dev/null +++ b/test.T_ori @@ -0,0 +1 @@ +First ApplyMatrix and now a little ApplyMatrix(a,b) From 8015f6e8750834f89eaa37e19ab8cc346576a184 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 12:15:55 +0200 Subject: [PATCH 03/22] More prep --- TEST_TXN | 4 ++-- names.py | 60 +++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/TEST_TXN b/TEST_TXN index 7ced2c9..6bd9494 100644 --- a/TEST_TXN +++ b/TEST_TXN @@ -1,2 +1,2 @@ -ApplyMatrix apply_matrix -Apply apply +.ApplyMatrix( apply_matrix( +.Apply( apply( diff --git a/names.py b/names.py index 50f0b49..14a7471 100644 --- a/names.py +++ b/names.py @@ -6,9 +6,11 @@ # Set CONTEXT True to print latest context line for each match found CONTEXT = True +DRY_RUN = True +STRIP_TERMINALS = False def find_names_in_file(filename, names={}, context=CONTEXT): - """Find all class.method and module.class names in one file, return as keys in names dict.""" + """Use regex to find all class.method and module.class names in one file, return as keys in names dict.""" #e = re.compile('\.[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*') #e = re.compile('\.[a-zA-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*\(') e = re.compile('\.[a-zA-Z]+[a-zA-Z0-9_]*\(') @@ -17,8 +19,8 @@ def find_names_in_file(filename, names={}, context=CONTEXT): line = linee.strip() match = e.search(line) try: - # group includes leading "." and trailing "(" - name = match.group()[1:-1] + # Note: matching group includes leading "." and trailing "(" + name = match.group() if context: names[name] = line else: @@ -53,17 +55,18 @@ def find_names(searchdirs='./', suffix=".py"): return names -def print_names(names, key=lambda x: x.upper(), print_values=CONTEXT): - """Print in sorted order. Must re-order as necessary to avoid renaming problems.""" - for name in sorted(names.keys(), key=key): +def print_names(namesdict, key=lambda x: x.upper(), print_values=CONTEXT): + """Print names dictionary in sorted order. May need to re-order some entries to avoid renaming problems.""" + for name in sorted(namesdict.keys(), key=key): if print_values: - print name, " : ", names[name] + print name, " : ", namesdict[name] else: print name -def print_translations(tlist, print_values=CONTEXT): - for entry in tlist: +def print_substitutions(subslist, print_values=CONTEXT): + """Print substitutions list in order.""" + for entry in subslist: if print_values: old, new = entry print old, " : ", new @@ -71,21 +74,28 @@ def print_translations(tlist, print_values=CONTEXT): print entry[0] -def read_translations(filename): - """Read data from file to create translations list.""" - translations = [] +def read_substitutions(filename): + """Read data from file to create substitutions list.""" + substitutions = [] with open(filename) as fin: for line in fin.readlines(): #print filename, line.strip() entry = line.strip().split() if len(entry) == 2: - translations.append(entry) + substitutions.append(entry) else: print entry - return translations + return substitutions -def rename_all(translations): +def parse_entry(entry, strip_terminals=False): + """Return target and new value for substitution entry with or without terminal "." and "(" characters.""" + target = entry[0] if not strip_terminals else entry[0][1:-1] + newvalue = entry[1] if not strip_terminals else entry[1][1:-1] + return target, newvalue + + +def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): """Use unix sed command to rename identifiers in all relevant files.""" # find . -name \*.h -exec sed --in-place 's/ABrotate/rotate/g' {} \; # find . -name \*.cpp -exec sed --in-place 's/ABrotate/rotate/g' {} \; @@ -104,15 +114,25 @@ def rename_all(translations): name_arg_template = "*%s" sed_command_template = "s/%s/%s/g" - for entry in translations: + for entry in substitutions: if len(entry) != 2: continue - old, new = entry + old, new = parse_entry(entry, strip_terminals=strip_terminals) print "Renaming %s --> %s" % (old, new) for suffix in suffixes: name_arg = name_arg_template % (suffix) sed_command = sed_command_template % (old, new) - args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') + print "sed command is: ", sed_command + if dry_run: + if strip_terminals: + target = old + else: + # Escape the metacharacters + olde = "\\%s\\%s" % (old[:-1], old[-1]) + print "Escaping ", old, olde + args = ('find', '.', '-name', name_arg, '-exec', 'egrep', '-Hs', olde, '{}', ';') + else: + args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') print args subprocess.Popen(args) time.sleep(1) @@ -130,6 +150,6 @@ def rename_all(translations): elif task.startswith('rename'): namesfile = sys.argv[2] - translations = read_translations(namesfile) - rename_all(translations) + substitutions = read_substitutions(namesfile) + rename_all(substitutions) From 3a2593253ddd1388d7c8527903a6bdd4a934de59 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 14:58:03 +0200 Subject: [PATCH 04/22] More prep. --- TEST_TXN | 4 ++-- names.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TEST_TXN b/TEST_TXN index 6bd9494..ec5e53e 100644 --- a/TEST_TXN +++ b/TEST_TXN @@ -1,2 +1,2 @@ -.ApplyMatrix( apply_matrix( -.Apply( apply( +.ApplyMatrix( .apply_matrix( +.Apply( .apply( diff --git a/names.py b/names.py index 14a7471..d054eee 100644 --- a/names.py +++ b/names.py @@ -6,7 +6,7 @@ # Set CONTEXT True to print latest context line for each match found CONTEXT = True -DRY_RUN = True +DRY_RUN = False STRIP_TERMINALS = False def find_names_in_file(filename, names={}, context=CONTEXT): @@ -134,7 +134,7 @@ def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): else: args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') print args - subprocess.Popen(args) + #subprocess.Popen(args) time.sleep(1) return From e06c18d1b11442235d416f38da271276f74066b1 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 15:01:21 +0200 Subject: [PATCH 05/22] more --- TEST_TXN | 4 ++-- names.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TEST_TXN b/TEST_TXN index ec5e53e..3505fd9 100644 --- a/TEST_TXN +++ b/TEST_TXN @@ -1,2 +1,2 @@ -.ApplyMatrix( .apply_matrix( -.Apply( .apply( +\.ApplyMatrix( .apply_matrix( +\.Apply( .apply( diff --git a/names.py b/names.py index d054eee..9fe3d29 100644 --- a/names.py +++ b/names.py @@ -134,7 +134,7 @@ def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): else: args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') print args - #subprocess.Popen(args) + subprocess.Popen(args) time.sleep(1) return From b0555012d02000f5f60cc74b12796d8ba186191b Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 15:08:01 +0200 Subject: [PATCH 06/22] mo --- names.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/names.py b/names.py index 9fe3d29..a8cbe24 100644 --- a/names.py +++ b/names.py @@ -6,8 +6,8 @@ # Set CONTEXT True to print latest context line for each match found CONTEXT = True -DRY_RUN = False -STRIP_TERMINALS = False +DRY_RUN = True +STRIP_TERMINALS = True def find_names_in_file(filename, names={}, context=CONTEXT): """Use regex to find all class.method and module.class names in one file, return as keys in names dict.""" @@ -125,7 +125,7 @@ def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): print "sed command is: ", sed_command if dry_run: if strip_terminals: - target = old + olde = old else: # Escape the metacharacters olde = "\\%s\\%s" % (old[:-1], old[-1]) From fbe827ee618f57a1241a5a96ef58774559406102 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 15:12:09 +0200 Subject: [PATCH 07/22] renames (2) --- TEST_TXN | 4 ++-- Tests/cpp/ptoolstest.h | 4 ++-- bindings/movement.pyx | 6 +++--- bindings/rigidbody.pyx | 4 ++-- headers/BasePair.h | 4 ++-- headers/DNA.h | 4 ++-- headers/Movement.h | 2 +- headers/rigidbody.h | 2 +- names.py | 4 ++-- src/BasePair.cpp | 8 ++++---- src/DNA.cpp | 38 +++++++++++++++++++------------------- src/Movement.cpp | 8 ++++---- src/rigidbody.cpp | 2 +- src/superpose.cpp | 2 +- 14 files changed, 46 insertions(+), 46 deletions(-) diff --git a/TEST_TXN b/TEST_TXN index 3505fd9..2b8f6cf 100644 --- a/TEST_TXN +++ b/TEST_TXN @@ -1,2 +1,2 @@ -\.ApplyMatrix( .apply_matrix( -\.Apply( .apply( +ApplyMatrix( apply_matrix( +Apply( apply( diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index 47cbf15..1e63555 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -284,7 +284,7 @@ Rigidbody prot1; Superpose_t sup = superpose(prot1,prot2); //# superpose(reference, mobile) Matrix matrix = sup.matrix; - prot2.ApplyMatrix(matrix); + prot2.apply_matrix(matrix); TS_ASSERT(Rmsd(prot2,prot1)<1e-6); } @@ -340,7 +340,7 @@ class TestRot: public CxxTest::TestSuite Superpose_t s = superpose(r1,r2); - r2.ApplyMatrix(s.matrix); + r2.apply_matrix(s.matrix); TS_ASSERT( Rmsd(r1,r2) < 1e-4 ); diff --git a/bindings/movement.pyx b/bindings/movement.pyx index 581a0ea..a77b291 100644 --- a/bindings/movement.pyx +++ b/bindings/movement.pyx @@ -22,7 +22,7 @@ cdef extern from "Movement.h" namespace "PTools": CppMovement() except+ CppMovement(Array2D[double] &) Array2D[double] m - void Apply(CppRigidbody&) + void apply(CppRigidbody&) void Print() const string toString() const; @@ -64,8 +64,8 @@ cdef class Movement: if self.thisptr: del self.thisptr - def Apply(self, Rigidbody rigid): - self.thisptr.Apply(deref(rigid.thisptr)) + def apply(self, Rigidbody rigid): + self.thisptr.apply(deref(rigid.thisptr)) def Print(self): self.thisptr.Print() diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index cc05b52..9e1071e 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -26,7 +26,7 @@ cdef extern from "rigidbody.h" namespace "PTools": CppCoord3D FindCenter() void syncCoords() void AttractEulerRotate(double, double, double) - void ApplyMatrix(Array2D[double] &) + void apply_matrix(Array2D[double] &) CppAtom CopyAtom(unsigned int) void AddAtom(CppAtomproperty &, CppCoord3D) void AddAtom(CppAtom &) @@ -161,7 +161,7 @@ cdef class Rigidbody: self.thisptr.syncCoords() def apply_matrix(self, Matrix mat): - self.thisptr.ApplyMatrix(deref(mat.thisptr)) + self.thisptr.apply_matrix(deref(mat.thisptr)) def CopyAtom(self, unsigned int atid): cdef CppAtom cpp_at = self.thisptr.CopyAtom(atid) diff --git a/headers/BasePair.h b/headers/BasePair.h index 5bbae60..7c6f5fc 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -32,9 +32,9 @@ namespace PTools void SetChainID(); /// apply a Movement to the BasePair - void Apply(const Movement& ); + void apply(const Movement& ); /// apply a Matrix to the BasePair - void Apply(const Matrix&); + void apply(const Matrix&); /// return the Matrix of the BasePair Matrix GetMatrix()const; diff --git a/headers/DNA.h b/headers/DNA.h index a5b0fba..4bfd3be 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -55,8 +55,8 @@ namespace PTools void ApplyGlobal(const Movement&,int posAnchor); ///apply a Matrix/Movement to the DNA as a rigidbody - void Apply(const Matrix&); - void Apply(const Movement&); + void apply(const Matrix&); + void apply(const Movement&); ///apply a vector to the DNA as a rigidbody diff --git a/headers/Movement.h b/headers/Movement.h index 2c90794..9e1d349 100644 --- a/headers/Movement.h +++ b/headers/Movement.h @@ -27,7 +27,7 @@ namespace PTools Movement operator+ (const Movement&) const; /// apply the Matrix to a Rigidbody - void Apply(Rigidbody& rigbody)const; + void apply(Rigidbody& rigbody)const; ///return the Matrix const Matrix& GetMatrix() const; diff --git a/headers/rigidbody.h b/headers/rigidbody.h index 3617afe..a6ef624 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -144,7 +144,7 @@ class Rigidbody:private CoordsArray void Translate(const Coord3D& tr); /// apply a 4x4 matrix - void ApplyMatrix(const Matrix & mat); + void apply_matrix(const Matrix & mat); /// get the 4x4 matrix Matrix GetMatrix() const diff --git a/names.py b/names.py index a8cbe24..764c048 100644 --- a/names.py +++ b/names.py @@ -6,8 +6,8 @@ # Set CONTEXT True to print latest context line for each match found CONTEXT = True -DRY_RUN = True -STRIP_TERMINALS = True +DRY_RUN = False +STRIP_TERMINALS = False def find_names_in_file(filename, names={}, context=CONTEXT): """Use regex to find all class.method and module.class names in one file, return as keys in names dict.""" diff --git a/src/BasePair.cpp b/src/BasePair.cpp index e703cc2..5edfc4f 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -58,15 +58,15 @@ void BasePair::SetChainID(){ } } -void BasePair::Apply( const Movement& m) +void BasePair::apply( const Movement& m) { - m.Apply(rigbody); + m.apply(rigbody); } -void BasePair::Apply(const Matrix& m) +void BasePair::apply(const Matrix& m) { - Apply(Movement (m)); + apply(Movement (m)); } Matrix BasePair::GetMatrix() const diff --git a/src/DNA.cpp b/src/DNA.cpp index 4d33b32..8b9e5c4 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -80,7 +80,7 @@ void DNA::PlaceBasePairs( Rigidbody& model) for ( unsigned int i = 0; i < strandSize; i++ )// strandSize { Rigidbody modelOfBasePair = GetModelOfBasePair( model, i, DNASize-i); - strand[i].Apply(GetMatBetwenBasePair ( modelOfBasePair,i )); + strand[i].apply(GetMatBetwenBasePair ( modelOfBasePair,i )); } } @@ -514,8 +514,8 @@ void DNA::ApplyInitialMov(const Movement& mov) unsigned int strandSize = strand.size(); for (unsigned int i=1; i 1){ nextlocal = GetLocalMatrix(1); } - strand[0].Apply(mov); + strand[0].apply(mov); for (unsigned int i=1; i 0) { - bp.Apply(matrixMultiply(strand[strand.size()-1].GetMatrix(),mov.GetMatrix())); + bp.apply(matrixMultiply(strand[strand.size()-1].GetMatrix(),mov.GetMatrix())); } - else bp.Apply(mov.GetMatrix()); + else bp.apply(mov.GetMatrix()); strand.push_back(bp); this->ChangeFormat(); } @@ -863,7 +863,7 @@ void DNA::ChangeType(int pos, std::string type, std::string filename) { Movement mov = Movement(strand[pos].GetMatrix()); strand[pos] = BasePair(dataBase.SelectChainId(type).CreateRigid()); - strand[pos].Apply(mov); + strand[pos].apply(mov); ChangeFormat(); } diff --git a/src/Movement.cpp b/src/Movement.cpp index bc957ae..0d5fc09 100644 --- a/src/Movement.cpp +++ b/src/Movement.cpp @@ -28,12 +28,12 @@ Movement::~Movement() } -void Movement::Apply(Rigidbody& rigbody)const +void Movement::apply(Rigidbody& rigbody)const { Matrix oldmouvement = rigbody.GetMatrix (); - //rigbody.ApplyMatrix(inverseTranformationMatrixPlusPlus(oldmouvement)); - rigbody.ApplyMatrix(inverseMatrix44 (oldmouvement)); - rigbody.ApplyMatrix(matrixMultiply(oldmouvement,m)); + //rigbody.apply_matrix(inverseTranformationMatrixPlusPlus(oldmouvement)); + rigbody.apply_matrix(inverseMatrix44 (oldmouvement)); + rigbody.apply_matrix(matrixMultiply(oldmouvement,m)); } diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index cfa71c0..5dbf241 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -318,7 +318,7 @@ std::string Rigidbody::PrintPDB() const } -void Rigidbody::ApplyMatrix(const Matrix& mat) +void Rigidbody::apply_matrix(const Matrix& mat) { dbl mat44[4][4]; diff --git a/src/superpose.cpp b/src/superpose.cpp index 5e8737b..a30f1dd 100644 --- a/src/superpose.cpp +++ b/src/superpose.cpp @@ -489,7 +489,7 @@ Superpose_t superpose(const Rigidbody& ref, const Rigidbody& mob, int verbosity) sup.matrix = output; Rigidbody probe(mob); - probe.ApplyMatrix(output); + probe.apply_matrix(output); sup.rmsd = Rmsd(ref,probe); return sup; From e710a4490367e9cdb2008bf3b68568d7b2471948 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 16:13:47 +0200 Subject: [PATCH 08/22] mo --- NAMES_TXN | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ NAMES_TXN_all | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ README_NAMES | 5 ++++ names.py | 4 ++- 4 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 NAMES_TXN create mode 100644 NAMES_TXN_all diff --git a/NAMES_TXN b/NAMES_TXN new file mode 100644 index 0000000..8704bb2 --- /dev/null +++ b/NAMES_TXN @@ -0,0 +1,73 @@ +ABrotate( rotate( +AddAtom( add_atom( +AddCoord( add_coord( +Add( add( +addfinalizer( add_finalizer( +AddLigand( add_ligand( +ApplyLocal( apply_local( +ApplyMatrix( apply_matrix( +Apply( apply( +AttractEulerRotate( euler_rotate( +Backbone( backbone( +CA( get_CA( +ChangeRepresentation( change_representation( +ChangeType( change_type( +CopyAtom( copy_atom( +createRigid( create_rigid( +CreateRigid create_rigid( +crossproduct( cross_product( +Dist2( dist2( +Dist( dist( +dotproduct( dot_product( +FindCenter( find_center( +GetAtomProperty( get_atom_property( +GetChainId( get_chainid( +getCoords( get_coords( +GetCoords( get_coords( +GetMatrix( get_matrix( +GetMinimizedVarsAtIter( get_minimized_vars_at_iter( +GetMinimizedVars( get_minimized_vars( +GetNumberIter( get_number_iter( +GetResidId( get_resid( +GetRigidBody( get_rigid( +getStructure( get_structure( +GetType( get_type( +getVdw( get_vdw( +MatTrans2screw( mat44_to_screw( +PrintMatrix( print_matrix( +PrintParam( print_param( +PrintPDB( print_pdb( +Print( print( +RadiusGyration radius_of_gyration( +Radius( radius( +Reducer( reducer( +Reduce( reduce( +removeclosest remove_closest( +rigidXMat44( rigidXMat44_CHANGEMANUALLY( +Rmsd( rmsd( +SelectAllAtoms( select_all_atoms( +SelectAtomID( select_atomid( +SelectAtomType( select_atomtype( +SelectChainId( select_chainid( +SelectResidType( select_restype( +SelectResRange select_resid_range( +SetAtomProperty( set_atom_property( +SetAtom( set_atom( +SetChainId( set_chainid( +setCoords( set_coords( +SetCoords( set_coords( +setdefault( set_default( +SetResidId( set_resid( +SetRestraint( set_restraint( +SetRigid( set_rigid( +setRotation( set_rotation( +setTranslation( set_translation( +Size( size( +surfpointParams( surfpoint_params( +syncCoords( sync_coords( +toatom( to_atom( +ToPdbString( to_pdb_string( +toString( to_string( +Translate( translate( +unsafeGetCoords( unsafe_get_coords( +WritePDB( write_pdb( diff --git a/NAMES_TXN_all b/NAMES_TXN_all new file mode 100644 index 0000000..8704bb2 --- /dev/null +++ b/NAMES_TXN_all @@ -0,0 +1,73 @@ +ABrotate( rotate( +AddAtom( add_atom( +AddCoord( add_coord( +Add( add( +addfinalizer( add_finalizer( +AddLigand( add_ligand( +ApplyLocal( apply_local( +ApplyMatrix( apply_matrix( +Apply( apply( +AttractEulerRotate( euler_rotate( +Backbone( backbone( +CA( get_CA( +ChangeRepresentation( change_representation( +ChangeType( change_type( +CopyAtom( copy_atom( +createRigid( create_rigid( +CreateRigid create_rigid( +crossproduct( cross_product( +Dist2( dist2( +Dist( dist( +dotproduct( dot_product( +FindCenter( find_center( +GetAtomProperty( get_atom_property( +GetChainId( get_chainid( +getCoords( get_coords( +GetCoords( get_coords( +GetMatrix( get_matrix( +GetMinimizedVarsAtIter( get_minimized_vars_at_iter( +GetMinimizedVars( get_minimized_vars( +GetNumberIter( get_number_iter( +GetResidId( get_resid( +GetRigidBody( get_rigid( +getStructure( get_structure( +GetType( get_type( +getVdw( get_vdw( +MatTrans2screw( mat44_to_screw( +PrintMatrix( print_matrix( +PrintParam( print_param( +PrintPDB( print_pdb( +Print( print( +RadiusGyration radius_of_gyration( +Radius( radius( +Reducer( reducer( +Reduce( reduce( +removeclosest remove_closest( +rigidXMat44( rigidXMat44_CHANGEMANUALLY( +Rmsd( rmsd( +SelectAllAtoms( select_all_atoms( +SelectAtomID( select_atomid( +SelectAtomType( select_atomtype( +SelectChainId( select_chainid( +SelectResidType( select_restype( +SelectResRange select_resid_range( +SetAtomProperty( set_atom_property( +SetAtom( set_atom( +SetChainId( set_chainid( +setCoords( set_coords( +SetCoords( set_coords( +setdefault( set_default( +SetResidId( set_resid( +SetRestraint( set_restraint( +SetRigid( set_rigid( +setRotation( set_rotation( +setTranslation( set_translation( +Size( size( +surfpointParams( surfpoint_params( +syncCoords( sync_coords( +toatom( to_atom( +ToPdbString( to_pdb_string( +toString( to_string( +Translate( translate( +unsafeGetCoords( unsafe_get_coords( +WritePDB( write_pdb( diff --git a/README_NAMES b/README_NAMES index 9cb005f..b08accf 100644 --- a/README_NAMES +++ b/README_NAMES @@ -56,4 +56,9 @@ D. Detailed protocol: 6. Verify the order of the substitutions list! Any shorter word should be translated AFTER longer words containing it. Note that the translations are thus processed as a list, not a dictionary. +7. To overwrite just the source file changes with the committed version + + - all changes: git checkout -- . + + - specific filetypes: git checkout -- "*.py" "*.pyx" "*.cpp" "*.h" diff --git a/names.py b/names.py index 764c048..11159f2 100644 --- a/names.py +++ b/names.py @@ -80,6 +80,8 @@ def read_substitutions(filename): with open(filename) as fin: for line in fin.readlines(): #print filename, line.strip() + if line.startswith("#"): + pass entry = line.strip().split() if len(entry) == 2: substitutions.append(entry) @@ -88,7 +90,7 @@ def read_substitutions(filename): return substitutions -def parse_entry(entry, strip_terminals=False): +def parse_entry(entry, strip_terminals=False): """Return target and new value for substitution entry with or without terminal "." and "(" characters.""" target = entry[0] if not strip_terminals else entry[0][1:-1] newvalue = entry[1] if not strip_terminals else entry[1][1:-1] From 8b502272c0c77f7f87393748c33e53ba884ca593 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 17:01:45 +0200 Subject: [PATCH 09/22] rename A-B --- Makefile | 5 ++ NAMES_TXN | 146 +++++++++++++++---------------- Tests/cpp/cxxtest/Win32Gui.h | 2 +- Tests/cpp/cxxtestgen.py | 8 +- Tests/cpp/ptoolstest.h | 18 ++-- Tests/functional/test_attract.py | 4 +- Tests/heligeom/test_heligeom.py | 6 +- Tests/test_atomselection.py | 4 +- Tests/test_attract_misc.py | 10 +-- Tests/test_attractforcefield.py | 4 +- Tests/test_coordsarray.py | 6 +- Tests/test_dna.py | 18 ++-- Tests/test_misc.py | 16 ++-- Tests/test_pairlist.py | 8 +- Tests/test_rigidbody.py | 30 +++---- Tests/test_superpose.py | 2 +- bindings/atomselection.pyx | 2 +- bindings/attractforcefield.pyx | 12 +-- bindings/attractrigidbody.pyx | 4 +- bindings/coordsarray.pyx | 12 +-- bindings/dna.pyx | 24 ++--- bindings/rigidbody.pyx | 26 +++--- bindings/scorpionforcefield.pyx | 6 +- docs/source/conf.py | 12 +-- headers/DNA.h | 18 ++-- headers/atomselection.h | 2 +- headers/attractforcefield.h | 2 +- headers/coordsarray.h | 4 +- headers/geometry.h | 2 +- headers/mcopff.h | 6 +- headers/pairlist.h | 2 +- headers/rigidbody.h | 14 +-- names.py | 10 +-- ptools/commands/attract_cmd.py | 2 +- ptools/commands/heligeom_cmd.py | 14 +-- ptools/docking.py | 8 +- src/DNA.cpp | 46 +++++----- src/Parameter.cpp | 16 ++-- src/Stacking.cpp | 12 +-- src/atomselection.cpp | 4 +- src/attractforcefield.cpp | 4 +- src/coordsarray.cpp | 2 +- src/geometry.cpp | 2 +- src/mcopff.cpp | 8 +- src/pdbio.cpp | 2 +- src/rigidbody.cpp | 38 ++++---- src/surface.cpp | 8 +- 47 files changed, 308 insertions(+), 303 deletions(-) diff --git a/Makefile b/Makefile index ac2a62f..e0e0809 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,11 @@ build: clean install: python setup.py install --record $(MANIFEST_OUT) +undo: + git checkout -- "*.py" "*.pyx" "*.cpp" "*.h" + +rename: + python names.py rename NAMES_TXN uninstall: cat $(MANIFEST_OUT) | xargs rm -f diff --git a/NAMES_TXN b/NAMES_TXN index 8704bb2..70fad5b 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -1,73 +1,73 @@ -ABrotate( rotate( -AddAtom( add_atom( -AddCoord( add_coord( -Add( add( -addfinalizer( add_finalizer( -AddLigand( add_ligand( -ApplyLocal( apply_local( -ApplyMatrix( apply_matrix( -Apply( apply( -AttractEulerRotate( euler_rotate( -Backbone( backbone( -CA( get_CA( -ChangeRepresentation( change_representation( -ChangeType( change_type( -CopyAtom( copy_atom( -createRigid( create_rigid( -CreateRigid create_rigid( -crossproduct( cross_product( -Dist2( dist2( -Dist( dist( -dotproduct( dot_product( -FindCenter( find_center( -GetAtomProperty( get_atom_property( -GetChainId( get_chainid( -getCoords( get_coords( -GetCoords( get_coords( -GetMatrix( get_matrix( -GetMinimizedVarsAtIter( get_minimized_vars_at_iter( -GetMinimizedVars( get_minimized_vars( -GetNumberIter( get_number_iter( -GetResidId( get_resid( -GetRigidBody( get_rigid( -getStructure( get_structure( -GetType( get_type( -getVdw( get_vdw( -MatTrans2screw( mat44_to_screw( -PrintMatrix( print_matrix( -PrintParam( print_param( -PrintPDB( print_pdb( -Print( print( -RadiusGyration radius_of_gyration( -Radius( radius( -Reducer( reducer( -Reduce( reduce( -removeclosest remove_closest( -rigidXMat44( rigidXMat44_CHANGEMANUALLY( -Rmsd( rmsd( -SelectAllAtoms( select_all_atoms( -SelectAtomID( select_atomid( -SelectAtomType( select_atomtype( -SelectChainId( select_chainid( -SelectResidType( select_restype( -SelectResRange select_resid_range( -SetAtomProperty( set_atom_property( -SetAtom( set_atom( -SetChainId( set_chainid( -setCoords( set_coords( -SetCoords( set_coords( -setdefault( set_default( -SetResidId( set_resid( -SetRestraint( set_restraint( -SetRigid( set_rigid( -setRotation( set_rotation( -setTranslation( set_translation( -Size( size( -surfpointParams( surfpoint_params( -syncCoords( sync_coords( -toatom( to_atom( -ToPdbString( to_pdb_string( -toString( to_string( -Translate( translate( -unsafeGetCoords( unsafe_get_coords( -WritePDB( write_pdb( +ABrotate rotate +AddAtom add_atom +AddCoord add_coord +Add add +addfinalizer add_finalizer +AddLigand add_ligand +ApplyLocal apply_local +ApplyMatrix apply_matrix +Apply apply +AttractEulerRotate euler_rotate +Backbone backbone +# CA( get_CA( +# ChangeRepresentation( change_representation( +# ChangeType( change_type( +# CopyAtom( copy_atom( +# createRigid( create_rigid( +# CreateRigid create_rigid( +# crossproduct( cross_product( +# Dist2( dist2( +# Dist( dist( +# dotproduct( dot_product( +# FindCenter( find_center( +# GetAtomProperty( get_atom_property( +# GetChainId( get_chainid( +# getCoords( get_coords( +# GetCoords( get_coords( +# GetMatrix( get_matrix( +# GetMinimizedVarsAtIter( get_minimized_vars_at_iter( +# GetMinimizedVars( get_minimized_vars( +# GetNumberIter( get_number_iter( +# GetResidId( get_resid( +# GetRigidBody( get_rigid( +# getStructure( get_structure( +# GetType( get_type( +# getVdw( get_vdw( +# MatTrans2screw( mat44_to_screw( +# PrintMatrix( print_matrix( +# PrintParam( print_param( +# PrintPDB( print_pdb( +# Print( print( +# RadiusGyration radius_of_gyration( +# Radius( radius( +# Reducer( reducer( +# Reduce( reduce( +# removeclosest remove_closest( +# rigidXMat44( rigidXMat44_CHANGEMANUALLY( +# Rmsd( rmsd( +# SelectAllAtoms( select_all_atoms( +# SelectAtomID( select_atomid( +# SelectAtomType( select_atomtype( +# SelectChainId( select_chainid( +# SelectResidType( select_restype( +# SelectResRange select_resid_range( +# SetAtomProperty( set_atom_property( +# SetAtom( set_atom( +# SetChainId( set_chainid( +# setCoords( set_coords( +# SetCoords( set_coords( +# setdefault( set_default( +# SetResidId( set_resid( +# SetRestraint( set_restraint( +# SetRigid( set_rigid( +# setRotation( set_rotation( +# setTranslation( set_translation( +# Size( size( +# surfpointParams( surfpoint_params( +# syncCoords( sync_coords( +# toatom( to_atom( +# ToPdbString( to_pdb_string( +# toString( to_string( +# Translate( translate( +# unsafeGetCoords( unsafe_get_coords( +# WritePDB( write_pdb( diff --git a/Tests/cpp/cxxtest/Win32Gui.h b/Tests/cpp/cxxtest/Win32Gui.h index 6b3e758..a071914 100644 --- a/Tests/cpp/cxxtest/Win32Gui.h +++ b/Tests/cpp/cxxtest/Win32Gui.h @@ -189,7 +189,7 @@ namespace CxxTest return; typedef void (WINAPI *FUNC)( void ); - FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); + FUNC func = (FUNC)GetProcaddress( dll, "InitCommonControls" ); if ( !func ) return; diff --git a/Tests/cpp/cxxtestgen.py b/Tests/cpp/cxxtestgen.py index 800d4a4..8c39997 100755 --- a/Tests/cpp/cxxtestgen.py +++ b/Tests/cpp/cxxtestgen.py @@ -304,7 +304,7 @@ def scanLineForTest(suite, lineNo, line): def addTest(suite, name, line): - '''Add a test function to the current suite''' + '''add a test function to the current suite''' test = {'name': name, 'suite': suite, 'class': 'TestDescription_%s_%s' % (suite['name'], name), @@ -356,7 +356,7 @@ def cstr(str): def addSuiteCreateDestroy(suite, which, line): - '''Add createSuite()/destroySuite() to current suite''' + '''add createSuite()/destroySuite() to current suite''' if which in suite: abort('%s:%s: %sSuite() already declared' % (suite['file'], str(line), which)) suite[which] = line @@ -383,7 +383,7 @@ def verifySuite(suite): def rememberSuite(suite): - '''Add current suite to list''' + '''add current suite to list''' global suites suites.append(suite) @@ -539,7 +539,7 @@ def isDynamic(suite): def writeInclude(output, file): - '''Add #include "file" statement''' + '''add #include "file" statement''' global lastIncluded if file == lastIncluded: return diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index 1e63555..cf8947a 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -100,8 +100,8 @@ Coord3D A, B; r2 = Rigidbody(TEST_1FIN_R_PDB); A = Coord3D(4.23, 5.72, 99.02); B = Coord3D(1.23, 6.33, 1.234); - r.ABrotate(A,B, 2.2345); - r2.ABrotate(A,B, 2.2345); + r.rotate(A,B, 2.2345); + r2.rotate(A,B, 2.2345); r.Translate(Coord3D(34.23, 123.45,11.972)); r2.Translate(Coord3D(34.23, 123.45,11.972)); @@ -179,8 +179,8 @@ class TestCoordsArray: public CxxTest::TestSuite c = CoordsArray(); coo1 = Coord3D(3.0, 4.0, 5.0); coo2 = Coord3D(1.0, 2.0, 7.5); - c.AddCoord(coo1); - c.AddCoord(coo2); + c.add_coord(coo1); + c.add_coord(coo2); //c = c; tr = Coord3D(3.0, 4.5, -3.0); } @@ -214,7 +214,7 @@ class TestCoordsArray: public CxxTest::TestSuite this means: 'change the current coordinates of atom i' and not 'change the initial coordinates of atom i' so here we check that this is the case"""*/ c.Translate(tr); //#do some translation - c.AttractEulerRotate(2.0,4.0,5.0); // # do a rotation + c.euler_rotate(2.0,4.0,5.0); // # do a rotation Coord3D co = Coord3D(3,2,1); // #new coordinates to be added c.SetCoords(0,co); Coord3D co2=Coord3D(); @@ -280,7 +280,7 @@ Rigidbody prot1; a = (random.random()-0.5)*50.0; b = (random.random()-0.5)*50.0; c = (random.random()-0.5)*50.0; - prot2.AttractEulerRotate(a,b,c); + prot2.euler_rotate(a,b,c); Superpose_t sup = superpose(prot1,prot2); //# superpose(reference, mobile) Matrix matrix = sup.matrix; @@ -334,7 +334,7 @@ class TestRot: public CxxTest::TestSuite double y = (randfloat()-0.5)*50.0; double z = (randfloat()-0.5)*50.0; - r2.ABrotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); + r2.rotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); r2.Translate(Coord3D(x,y,z)); @@ -359,7 +359,7 @@ class TestRot: public CxxTest::TestSuite double y = (randfloat()-0.5)*50.0; double z = (randfloat()-0.5)*50.0; - r2.ABrotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); + r2.rotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); r2.Translate(Coord3D(x,y,z)); @@ -369,7 +369,7 @@ class TestRot: public CxxTest::TestSuite // v.Print(); Rigidbody r3; - r3.ABrotate(v.point, v.point+v.unitVector, v.angle); + r3.rotate(v.point, v.point+v.unitVector, v.angle); r3.Translate(v.normtranslation*v.unitVector); diff --git a/Tests/functional/test_attract.py b/Tests/functional/test_attract.py index eee35bf..06e92f3 100644 --- a/Tests/functional/test_attract.py +++ b/Tests/functional/test_attract.py @@ -55,7 +55,7 @@ def minim_traj(request): def teardown(): os.remove(traj) traj = 'minimization.trj' # hard-coded in attract_cmd.py - request.addfinalizer(teardown) + request.add_finalizer(teardown) return traj @@ -79,7 +79,7 @@ def docking_trans_rot(request): def teardown(): os.remove('rotation.dat') os.remove('translation.dat') - request.addfinalizer(teardown) + request.add_finalizer(teardown) # Copy rotation.dat and translation.dat to current directory # (those names are hard-coded in attract). shutil.copyfile(TEST_DOCKING_ROTATION, 'rotation.dat') diff --git a/Tests/heligeom/test_heligeom.py b/Tests/heligeom/test_heligeom.py index 21fce0b..ff33e55 100644 --- a/Tests/heligeom/test_heligeom.py +++ b/Tests/heligeom/test_heligeom.py @@ -38,17 +38,17 @@ def testBasicManipulation(self): # add a base Pair bp = BasePair(dna[0].GetRigidBody()) - dna.Add(bp) + dna.add(bp) # add itself new = DNA(dna) - dna.Add(new, BDNA()) + dna.add(new, BDNA()) # change the type of a base dna.ChangeType(0, "A", TEST_BP_RED) # turn the center base - dna.ApplyLocal(Roll(30), dna.Size() / 2) + dna.apply_local(Roll(30), dna.Size() / 2) # trim the extremities dna = dna.SubDNA(2, dna.Size() - 3) diff --git a/Tests/test_atomselection.py b/Tests/test_atomselection.py index 834992e..90736ed 100644 --- a/Tests/test_atomselection.py +++ b/Tests/test_atomselection.py @@ -29,8 +29,8 @@ def testSelectAtomType_wildcard(self): CAatoms = self.rig.SelectAtomType("C*") self.assertEqual(len(CAatoms), 3379) - def testSelectBackbone(self): - bbAtoms = self.rig.Backbone() + def testSelectbackbone(self): + bbAtoms = self.rig.backbone() self.assertEqual(len(bbAtoms), 2572) def testSelectResRange(self): diff --git a/Tests/test_attract_misc.py b/Tests/test_attract_misc.py index 95ff982..2c4392f 100644 --- a/Tests/test_attract_misc.py +++ b/Tests/test_attract_misc.py @@ -58,7 +58,7 @@ def test_for_different_nonexact_division_last_group_should_have_expected_length( class MinimizationTests(unittest.TestCase): - """CHR April 2017 Add simple geometric minimization tests. + """CHR April 2017 add simple geometric minimization tests. Test 1: ligand L in test1 starts +5A along Y above the optimum, which is equidistant from the two CA atoms 1 and 2 forming the receptor. @@ -94,8 +94,8 @@ def test_find_analytical_solution_when_displaced_along_Y(self): # Minimum-energy ligand position is 5.0, 0.0, 0.0 print "Ligand starting position: %s" % atom.ToPdbString() - self.forcefield.AddLigand(receptor) - self.forcefield.AddLigand(ligand) + self.forcefield.addLigand(receptor) + self.forcefield.addLigand(ligand) lbfgs_minimizer = Lbfgs(self.forcefield) lbfgs_minimizer.minimize(self.niter) @@ -122,8 +122,8 @@ def test_find_analytical_solution_when_displaced_along_X_Y_Z(self): atom = ligand.CopyAtom(0) print "Ligand starting position: %s" % atom.ToPdbString() - self.forcefield.AddLigand(receptor) - self.forcefield.AddLigand(ligand) + self.forcefield.addLigand(receptor) + self.forcefield.addLigand(ligand) lbfgs_minimizer = Lbfgs(self.forcefield) lbfgs_minimizer.minimize(self.niter) diff --git a/Tests/test_attractforcefield.py b/Tests/test_attractforcefield.py index 4d566bc..0f835a3 100644 --- a/Tests/test_attractforcefield.py +++ b/Tests/test_attractforcefield.py @@ -19,8 +19,8 @@ def testFF2k(self): a.setRotation(False) a.setTranslation(False) FF = AttractForceField2(TEST_FF_MBEST1K, 20.0) - FF.AddLigand(a) - FF.AddLigand(c) + FF.addLigand(a) + FF.addLigand(c) x = [] for i in range(6): x.append(0.0) diff --git a/Tests/test_coordsarray.py b/Tests/test_coordsarray.py index ba266d4..4b2aa48 100644 --- a/Tests/test_coordsarray.py +++ b/Tests/test_coordsarray.py @@ -12,8 +12,8 @@ def setUp(self): coo1 = Coord3D(3.0, 4.0, 5.0) coo2 = Coord3D(1.0, 2.0, 7.5) - c.AddCoord(coo1) - c.AddCoord(coo2) + c.add_coord(coo1) + c.add_coord(coo2) self.c = c self.tr = Coord3D(3.0, 4.5, -3.0) @@ -41,7 +41,7 @@ def testSetCoords(self): coordinates of atom i' and not 'change the initial coordinates of atom i' so here we check that this is the case""" self.c.Translate(self.tr) # do some translation - self.c.AttractEulerRotate(2.0, 4.0, 5.0) # do a rotation + self.c.euler_rotate(2.0, 4.0, 5.0) # do a rotation co = Coord3D(3, 2, 1) # new coordinates to be added self.c.SetCoords(0, co) co2 = Coord3D() diff --git a/Tests/test_dna.py b/Tests/test_dna.py index 3dcd454..02f43e3 100644 --- a/Tests/test_dna.py +++ b/Tests/test_dna.py @@ -23,14 +23,14 @@ def test_has_Size(self): def test_has_len(self): self.assertTrue(hasattr(DNA, '__len__')) - def test_has_Add(self): - self.assertTrue(hasattr(DNA, 'Add')) + def test_has_add(self): + self.assertTrue(hasattr(DNA, 'add')) def test_has_ChangeType(self): self.assertTrue(hasattr(DNA, 'ChangeType')) - def test_has_ApplyLocal(self): - self.assertTrue(hasattr(DNA, 'ApplyLocal')) + def test_has_apply_local(self): + self.assertTrue(hasattr(DNA, 'apply_local')) def test_has_SubDNA(self): self.assertTrue(hasattr(DNA, 'SubDNA')) @@ -56,22 +56,22 @@ def test_len(self): self.assertEqual(len(self.dna), 16) self.assertEqual(len(self.dna), self.dna.Size()) - def test_Add(self): + def test_add(self): bp = ptools.BasePair(self.dna[0].GetRigidBody()) - self.dna.Add(bp) + self.dna.add(bp) self.assertEqual(self.dna.Size(), 17) dna = ptools.DNA(self.dna) - self.dna.Add(dna) + self.dna.add(dna) self.assertEqual(self.dna.Size(), 34) def test_ChangeType(self): warnings.warn("only check the call, not the result") self.dna.ChangeType(0, "A", PDB_BASE_PAIR) - def test_ApplyLocal(self): + def test_apply_local(self): warnings.warn("only check the call, not the result") - self.dna.ApplyLocal(ptools.Roll(30), self.dna.Size() / 2) + self.dna.apply_local(ptools.Roll(30), self.dna.Size() / 2) def test_SubDNA(self): warnings.warn("only check the call, not the result") diff --git a/Tests/test_misc.py b/Tests/test_misc.py index d0f5b18..db8eaf4 100644 --- a/Tests/test_misc.py +++ b/Tests/test_misc.py @@ -68,15 +68,15 @@ def setUp(self): at4 = Atom(Atomproperty(), Coord3D(1, 1, 1)) rig = Rigidbody() - rig.AddAtom(at1) - rig.AddAtom(at2) - rig.AddAtom(at3) - rig.AddAtom(at4) + rig.add_atom(at1) + rig.add_atom(at2) + rig.add_atom(at3) + rig.add_atom(at4) self.rig = rig def testRotZ(self): - self.rig.ABrotate(Coord3D(0, 0, 0), Coord3D(0, 0, 1), math.pi / 2) + self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 0, 1), math.pi / 2) # i should now be j co1 = self.rig.CopyAtom(0).coords self.assertAlmostEqual(co1.x, 0) @@ -96,7 +96,7 @@ def testRotZ(self): self.assertAlmostEqual(co3.z, 1) def testRotX(self): - self.rig.ABrotate(Coord3D(0, 0, 0), Coord3D(1, 0, 0), math.pi / 2) + self.rig.rotate(Coord3D(0, 0, 0), Coord3D(1, 0, 0), math.pi / 2) # i is still i co1 = self.rig.CopyAtom(0).coords @@ -117,7 +117,7 @@ def testRotX(self): self.assertAlmostEqual(co3.z, 0) def testRotY(self): - self.rig.ABrotate(Coord3D(0, 0, 0), Coord3D(0, 1, 0), math.pi / 2) + self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 1, 0), math.pi / 2) # i becomes -j co1 = self.rig.CopyAtom(0).coords @@ -138,7 +138,7 @@ def testRotY(self): self.assertAlmostEqual(co3.z, 0) def testRotZ_trans(self): - self.rig.ABrotate(Coord3D(1, 1, 1), Coord3D(1, 1, 3), math.pi / 2) + self.rig.rotate(Coord3D(1, 1, 1), Coord3D(1, 1, 3), math.pi / 2) co1 = self.rig.CopyAtom(0).coords self.assertAlmostEqual(co1.x, 2) diff --git a/Tests/test_pairlist.py b/Tests/test_pairlist.py index b360a54..86cfd20 100644 --- a/Tests/test_pairlist.py +++ b/Tests/test_pairlist.py @@ -21,15 +21,15 @@ def setUp(self): r = Rigidbody() at = Atom() at.coords = Coord3D(1, 0, 0) - r.AddAtom(at) + r.add_atom(at) at.coords = Coord3D(2, 0, 0) - r.AddAtom(at) + r.add_atom(at) l = Rigidbody() at.coords = Coord3D(4, 0, 0) - l.AddAtom(at) + l.add_atom(at) at.coords = Coord3D(5, 0, 0) - l.AddAtom(at) + l.add_atom(at) self.ar = AttractRigidbody(r) self.al = AttractRigidbody(l) diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index 5424431..f7a1d0d 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -38,11 +38,11 @@ def test_Rigidbody_has_Translate(self): def test_Rigidbody_has_FindCenter(self): self.assertTrue(hasattr(Rigidbody, 'FindCenter')) - def test_Rigidbody_has_ABrotate(self): - self.assertTrue(hasattr(Rigidbody, 'ABrotate')) + def test_Rigidbody_has_rotate(self): + self.assertTrue(hasattr(Rigidbody, 'rotate')) - def test_Rigidbody_has_AttractEulerRotate(self): - self.assertTrue(hasattr(Rigidbody, 'AttractEulerRotate')) + def test_Rigidbody_has_euler_rotate(self): + self.assertTrue(hasattr(Rigidbody, 'euler_rotate')) def test_Rigidbody_has_syncCoords(self): self.assertTrue(hasattr(Rigidbody, 'syncCoords')) @@ -53,8 +53,8 @@ def test_Rigidbody_has_apply_matrix(self): def test_Rigidbody_has_CopyAtom(self): self.assertTrue(hasattr(Rigidbody, 'CopyAtom')) - def test_Rigidbody_has_AddAtom(self): - self.assertTrue(hasattr(Rigidbody, 'AddAtom')) + def test_Rigidbody_has_add_atom(self): + self.assertTrue(hasattr(Rigidbody, 'add_atom')) def test_Rigidbody_has_SetAtom(self): self.assertTrue(hasattr(Rigidbody, 'SetAtom')) @@ -89,8 +89,8 @@ def test_Rigidbody_has_SelectResRange(self): def test_Rigidbody_has_CA(self): self.assertTrue(hasattr(Rigidbody, 'CA')) - def test_Rigidbody_has_Backbone(self): - self.assertTrue(hasattr(Rigidbody, 'Backbone')) + def test_Rigidbody_has_backbone(self): + self.assertTrue(hasattr(Rigidbody, 'backbone')) def test_has_operator_add(self): self.assertTrue(hasattr(Rigidbody, '__add__')) @@ -105,11 +105,11 @@ def setUp(self): self.r2 = Rigidbody() at = Atom() at.coords = Coord3D(1, 0, 0) - self.r2.AddAtom(at) + self.r2.add_atom(at) at.coords = Coord3D(0, 1, 0) - self.r2.AddAtom(at) + self.r2.add_atom(at) at.coords = Coord3D(0, 0, 1) - self.r2.AddAtom(at) + self.r2.add_atom(at) def testCopy(self): s = Rigidbody(self.r) @@ -187,8 +187,8 @@ def testUnsafeGetCoords(self): r2 = Rigidbody(TEST_LIGAND_PDB) A = Coord3D(4.23, 5.72, 99.02) B = Coord3D(1.23, 6.33, 1.234) - self.r.ABrotate(A, B, 2.2345) - r2.ABrotate(A, B, 2.2345) + self.r.rotate(A, B, 2.2345) + r2.rotate(A, B, 2.2345) self.r.Translate(Coord3D(34.23, 123.45, 11.972)) r2.Translate(Coord3D(34.23, 123.45, 11.972)) @@ -202,12 +202,12 @@ def testUnsafeGetCoords(self): r2.unsafeGetCoords(i, co2) assertCoordsAlmostEqual(self, co1, co2) - def testAddAtoms(self): + def testadd_atoms(self): r = Rigidbody() self.assertEqual(len(r), 0) at = Atom() at.coords = Coord3D(2, 3, 4) - r.AddAtom(at) + r.add_atom(at) self.assertAlmostEqual(len(r), 1) def testGetAtomProperty(self): diff --git a/Tests/test_superpose.py b/Tests/test_superpose.py index 1b9dd4f..d6e6826 100644 --- a/Tests/test_superpose.py +++ b/Tests/test_superpose.py @@ -48,7 +48,7 @@ def testTransRot(self): a = (random.random() - 0.5) * 50.0 b = (random.random() - 0.5) * 50.0 c = (random.random() - 0.5) * 50.0 - prot2.AttractEulerRotate(a, b, c) + prot2.euler_rotate(a, b, c) sup = ptools.superpose(self.prot1, prot2) # superpose(reference, mobile) matrix = sup.matrix diff --git a/bindings/atomselection.pyx b/bindings/atomselection.pyx index 63f82d6..a8fbe3b 100644 --- a/bindings/atomselection.pyx +++ b/bindings/atomselection.pyx @@ -12,7 +12,7 @@ cdef extern from "atomselection.h" namespace "PTools": void SetRigid(CppRigidbody&) CppAtom operator[] CppAtom CopyAtom(unsigned int) - void AddAtomIndex(unsigned int) + void add_atomIndex(unsigned int) CppRigidbody CreateRigid() CppAtomSelection non(CppAtomSelection &) diff --git a/bindings/attractforcefield.pyx b/bindings/attractforcefield.pyx index a600ccc..8f88f7c 100644 --- a/bindings/attractforcefield.pyx +++ b/bindings/attractforcefield.pyx @@ -27,7 +27,7 @@ cdef extern from "attractforcefield.h" namespace "PTools": cdef cppclass CppBaseAttractForceField "PTools::BaseAttractForceField" (CppForceField): unsigned int ProblemSize() double Function(vector[double]&) - void AddLigand(CppAttractRigidbody &) + void addLigand(CppAttractRigidbody &) double getVdw() double getCoulomb() double nonbon8(CppAttractRigidbody& , CppAttractRigidbody& , CppAttractPairList & , int) @@ -61,9 +61,9 @@ cdef class AttractForceField2(BaseAttractForceField): def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): + def addLigand(self, AttractRigidbody rig): self.rigidlist.append(rig) - self.thisptr.AddLigand(deref(rig.thisptr)) + self.thisptr.addLigand(deref(rig.thisptr)) def Function(self, vec): cdef vector[double] v @@ -85,7 +85,7 @@ cdef class AttractForceField2(BaseAttractForceField): cdef extern from "attractforcefield.h" namespace "PTools": cdef cppclass CppAttractForceField1 "PTools::AttractForceField1"(CppBaseAttractForceField): CppAttractForceField1(string&, double) - void AddLigand(CppAttractRigidbody&) + void addLigand(CppAttractRigidbody&) double Function(vector[double]&) double getVdw() double getCoulomb() @@ -109,8 +109,8 @@ cdef class AttractForceField1(BaseAttractForceField): def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): - self.thisptr.AddLigand(deref(rig.thisptr)) + def addLigand(self, AttractRigidbody rig): + self.thisptr.addLigand(deref(rig.thisptr)) def Function(self, vec): cdef vector[double] v diff --git a/bindings/attractrigidbody.pyx b/bindings/attractrigidbody.pyx index 13942e1..49f97c7 100644 --- a/bindings/attractrigidbody.pyx +++ b/bindings/attractrigidbody.pyx @@ -123,9 +123,9 @@ cdef class AttractRigidbody (Rigidbody) : cdef CppRigidbody* rig = self.thisptr rig.Translate(deref(co.thisptr)) - def AttractEulerRotate(self, double phi, double ssi, double rot): + def euler_rotate(self, double phi, double ssi, double rot): cdef CppRigidbody* rig = self.thisptr - rig.AttractEulerRotate(phi, ssi, rot) + rig.euler_rotate(phi, ssi, rot) #these function should be defined only in Rigdibody object and attractrigdbody should inherit from it:œ diff --git a/bindings/coordsarray.pyx b/bindings/coordsarray.pyx index 296ba62..cc90557 100644 --- a/bindings/coordsarray.pyx +++ b/bindings/coordsarray.pyx @@ -3,12 +3,12 @@ cdef extern from "coordsarray.h" namespace "PTools": CppCoordsArray() CppCoordsArray( CppCoordsArray & ) void unsafeGetCoords(unsigned int , CppCoord3D& ) - void AddCoord(CppCoord3D& co) + void add_coord(CppCoord3D& co) unsigned int Size() void GetCoords(unsigned int, CppCoord3D&) void SetCoords(unsigned int, CppCoord3D&) void Translate(CppCoord3D&) - void AttractEulerRotate(double , double, double) + void euler_rotate(double , double, double) cdef class CoordsArray: @@ -40,8 +40,8 @@ cdef class CoordsArray: def unsafeGetCoords(self, int i, Coord3D co): self.thisptr.unsafeGetCoords(i, deref(co.thisptr)) - def AddCoord(self, Coord3D co): - self.thisptr.AddCoord( deref(co.thisptr) ) + def add_coord(self, Coord3D co): + self.thisptr.add_coord( deref(co.thisptr) ) def GetCoords(self, i, Coord3D co): self.thisptr.GetCoords(i, deref(co.thisptr)) @@ -52,5 +52,5 @@ cdef class CoordsArray: def Translate(self, Coord3D co): self.thisptr.Translate(deref(co.thisptr)) - def AttractEulerRotate(self, double phi, double ssi, double rot): - self.thisptr.AttractEulerRotate(phi, ssi, rot) \ No newline at end of file + def euler_rotate(self, double phi, double ssi, double rot): + self.thisptr.euler_rotate(phi, ssi, rot) \ No newline at end of file diff --git a/bindings/dna.pyx b/bindings/dna.pyx index d8c7670..fc176b6 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -10,12 +10,12 @@ cdef extern from "DNA.h" namespace "PTools": CppDNA SubDNA(int, int) CppBasePair operator[](int) unsigned int Size() - void Add(CppBasePair, const CppMovement &) - void Add(CppBasePair) - void Add(CppDNA, const CppMovement &) - void Add(CppDNA) + void add(CppBasePair, const CppMovement &) + void add(CppBasePair) + void add(CppDNA, const CppMovement &) + void add(CppDNA) void ChangeType(int, string, string) - void ApplyLocal(const CppMovement&, int) + void apply_local(const CppMovement&, int) void ChangeRepresentation(string) string PrintPDB() @@ -68,7 +68,7 @@ cdef class DNA: ret.thisptr = new CppDNA(cdna) return ret - def Add(self, bp_or_dna, mov=None): + def add(self, bp_or_dna, mov=None): if isinstance(bp_or_dna, DNA): self._add_dna(bp_or_dna, mov) else: @@ -76,23 +76,23 @@ cdef class DNA: def _add_bp(self, BasePair bp, Movement mov=None): if mov == None: - self.thisptr.Add(deref(bp.thisptr)) + self.thisptr.add(deref(bp.thisptr)) else: - self.thisptr.Add(deref(bp.thisptr), deref(mov.thisptr)) + self.thisptr.add(deref(bp.thisptr), deref(mov.thisptr)) def _add_dna(self, DNA dna, Movement mov=None): if mov == None: - self.thisptr.Add(deref(dna.thisptr)) + self.thisptr.add(deref(dna.thisptr)) else: - self.thisptr.Add(deref(dna.thisptr), deref(mov.thisptr)) + self.thisptr.add(deref(dna.thisptr), deref(mov.thisptr)) def ChangeType(self, int pos, bytes basetype, bytes filename): cdef const char * c_basetype = basetype cdef const char * c_filename = filename self.thisptr.ChangeType(pos, str(c_basetype), str(c_filename)) - def ApplyLocal(self, Movement mov, int posMov): - self.thisptr.ApplyLocal(deref(mov.thisptr), posMov) + def apply_local(self, Movement mov, int posMov): + self.thisptr.apply_local(deref(mov.thisptr), posMov) def ChangeRepresentation(self, bytes rep): self.thisptr.ChangeRepresentation(rep) diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index 9e1071e..f04bba1 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -21,15 +21,15 @@ cdef extern from "rigidbody.h" namespace "PTools": CppCoord3D GetCoords(unsigned int) void unsafeGetCoords(unsigned int, CppCoord3D &) void SetCoords(unsigned int, CppCoord3D &) - void ABrotate(CppCoord3D &, CppCoord3D &, double) + void rotate(CppCoord3D &, CppCoord3D &, double) void Translate(CppCoord3D &) CppCoord3D FindCenter() void syncCoords() - void AttractEulerRotate(double, double, double) + void euler_rotate(double, double, double) void apply_matrix(Array2D[double] &) CppAtom CopyAtom(unsigned int) - void AddAtom(CppAtomproperty &, CppCoord3D) - void AddAtom(CppAtom &) + void add_atom(CppAtomproperty &, CppCoord3D) + void add_atom(CppAtom &) void SetAtom(unsigned int, CppAtom &) string PrintPDB() CppRigidbody operator+(CppRigidbody &) @@ -51,7 +51,7 @@ cdef extern from "rigidbody.h" namespace "PTools": CppAtomSelection SelectChainId(string) CppAtomSelection SelectResRange(int, int) CppAtomSelection CA() - CppAtomSelection Backbone() + CppAtomSelection backbone() cdef extern from "pdbio.h" namespace "PTools": @@ -150,12 +150,12 @@ cdef class Rigidbody: c.z = cpp.z return c - def ABrotate(self, Coord3D A, Coord3D B, double theta): - self.thisptr.ABrotate(deref(A.thisptr), deref(B.thisptr), theta) + def rotate(self, Coord3D A, Coord3D B, double theta): + self.thisptr.rotate(deref(A.thisptr), deref(B.thisptr), theta) return None - def AttractEulerRotate(self, double phi, double ssi, double rot): - self.thisptr.AttractEulerRotate(phi, ssi, rot) + def euler_rotate(self, double phi, double ssi, double rot): + self.thisptr.euler_rotate(phi, ssi, rot) def syncCoords(self): self.thisptr.syncCoords() @@ -170,8 +170,8 @@ cdef class Rigidbody: cy_copy_atom(& cpp_at, cpp_dest) return at - def AddAtom(self, Atom at): - self.thisptr.AddAtom(deref(at.thisptr)) + def add_atom(self, Atom at): + self.thisptr.add_atom(deref(at.thisptr)) def SetAtom(self, unsigned int position, Atom at): self.thisptr.SetAtom(position, deref(at.thisptr)) @@ -246,10 +246,10 @@ cdef class Rigidbody: ret.thisptr = new CppAtomSelection(new_sel) return ret - def Backbone(self): + def backbone(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.Backbone() + cdef CppAtomSelection new_sel = self.thisptr.backbone() ret.thisptr = new CppAtomSelection(new_sel) return ret diff --git a/bindings/scorpionforcefield.pyx b/bindings/scorpionforcefield.pyx index 0be6502..500479e 100644 --- a/bindings/scorpionforcefield.pyx +++ b/bindings/scorpionforcefield.pyx @@ -5,7 +5,7 @@ from libcpp.string cimport string cdef extern from "scorpionforcefield.h" namespace "PTools": cdef cppclass CppScorpionForceField "PTools::ScorpionForceField": CppScorpionForceField(string&, double) - void AddLigand(CppAttractRigidbody&) + void addLigand(CppAttractRigidbody&) double Function(vector[double]&) double getVdw() double getCoulomb() @@ -29,8 +29,8 @@ cdef class ScorpionForceField: def __dealloc__(self): del self.thisptr - def AddLigand(self, AttractRigidbody rig): - self.thisptr.AddLigand(deref( rig.thisptr)) + def addLigand(self, AttractRigidbody rig): + self.thisptr.addLigand(deref( rig.thisptr)) def Function(self, vec): cdef vector[double] v diff --git a/docs/source/conf.py b/docs/source/conf.py index 5dbf004..ead6f15 100755 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -42,11 +42,11 @@ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be +# add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] -# Add any paths that contain templates here, relative to this directory. +# add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. @@ -124,7 +124,7 @@ # documentation. #html_theme_options = {} -# Add any paths that contain custom themes here, relative to this directory. +# add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to @@ -144,7 +144,7 @@ # 16x16 or 32x32 pixels large. #html_favicon = None -# Add any paths that contain custom static files (such as style sheets) +# add any paths that contain custom static files (such as style sheets) # here, relative to this directory. They are copied after the builtin # static files, so a file named "default.css" will overwrite the builtin # "default.css". @@ -161,7 +161,7 @@ # Custom sidebar templates, maps document names to template names. #html_sidebars = {} -# Additional templates that should be rendered to pages, maps page names +# additional templates that should be rendered to pages, maps page names # to template names. #html_additional_pages = {} @@ -206,7 +206,7 @@ # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. + # additional stuff for the LaTeX preamble. #'preamble': '', } diff --git a/headers/DNA.h b/headers/DNA.h index 4bfd3be..ba3a3a8 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -47,12 +47,12 @@ namespace PTools void ChangeRepresentation(std::string); ///apply a Matrix/Movement to a specified BasePair. you can specify an anchor - void ApplyLocal(const Matrix&,int posMov, int posAnchor = 0); - void ApplyLocal(const Movement&,int posMov, int posAnchor = 0); + void apply_local(const Matrix&,int posMov, int posAnchor = 0); + void apply_local(const Movement&,int posMov, int posAnchor = 0); ///apply a Matrix/Movement to all the BasePairs and reposition the DNA according to the anchor - void ApplyGlobal(const Matrix&,int posAnchor); - void ApplyGlobal(const Movement&,int posAnchor); + void applyGlobal(const Matrix&,int posAnchor); + void applyGlobal(const Movement&,int posAnchor); ///apply a Matrix/Movement to the DNA as a rigidbody void apply(const Matrix&); @@ -88,9 +88,9 @@ namespace PTools return strand[i];}; /// add the basePairs of a DNA to the strand of this DNA. the specified movement do the liason betwen the two strand - void Add(const DNA & d, const Movement & mov = BDNA()); + void add(const DNA & d, const Movement & mov = BDNA()); /// add a basepair at the end of the strand of this DNA - void Add(BasePair bp, const Movement & mov = BDNA()); + void add(BasePair bp, const Movement & mov = BDNA()); ///return the specified subDNA DNA SubDNA(uint start, uint end)const; @@ -115,15 +115,15 @@ namespace PTools ///construct the strand from the sequence, the chain Ids and a corresponding vector of Rigidbody void BuildStrand(std::string,std::string,const std::vector &); /// apply an initial Movement during the initialisation of the DNA - void ApplyInitialMov(const Movement&); + void applyInitialMov(const Movement&); ///rebuild the DNA from a specified position. useful for taking into account a change in a base. Matrix Reconstruct(int pos,const Matrix&); ///give the BasePair a correct number according to they rank in the strand void ChangeFormat(); ///apply a Movement to a specified BasePair. - void ApplylocalMov(const Movement&,int pos); + void applylocalMov(const Movement&,int pos); ///apply a Movement to all the BasePairs - void ApplyglobalMov(const Movement& ); + void applyglobalMov(const Movement& ); ///reposition the DNA according to the anchor void Relocate(const BasePair& anchor,int posAnchor); diff --git a/headers/atomselection.h b/headers/atomselection.h index b137c57..b2a6015 100644 --- a/headers/atomselection.h +++ b/headers/atomselection.h @@ -39,7 +39,7 @@ class AtomSelection{ return m_rigid->CopyAtom(m_list[i]);}; Atom CopyAtom(uint i) const {return m_rigid->CopyAtom(m_list[i]);} - void AddAtomIndex(int i) {m_list.push_back(i);}; ///< adds an Atom index + void add_atomIndex(int i) {m_list.push_back(i);}; ///< adds an Atom index Rigidbody CreateRigid(); ///< makes a new rigid copy (independant copy) from an AtomsSelection object. AtomSelection non(const AtomSelection& atsel); diff --git a/headers/attractforcefield.h b/headers/attractforcefield.h index 76c35a4..0ca9109 100644 --- a/headers/attractforcefield.h +++ b/headers/attractforcefield.h @@ -27,7 +27,7 @@ class BaseAttractForceField: public ForceField dbl Function(const Vdouble&); ///add a new ligand to the ligand list... - void AddLigand(AttractRigidbody & lig); + void addLigand(AttractRigidbody & lig); ///after a minimization, get minimized ligand 'i' AttractRigidbody GetLigand(uint i); diff --git a/headers/coordsarray.h b/headers/coordsarray.h index 22b0dae..d23848f 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -94,7 +94,7 @@ class CoordsArray /// get the cached coordinates. You must ensure that update() has been called first ! void inline unsafeGetCoords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; - void AddCoord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; + void add_coord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; uint Size() const {return _refcoords.size();}; @@ -105,7 +105,7 @@ class CoordsArray /// Translate the whole object void Translate(const Coord3D& tr); /// Euler Rotation - void AttractEulerRotate(dbl phi, dbl ssi, dbl rot); + void euler_rotate(dbl phi, dbl ssi, dbl rot); void ResetMatrix(); diff --git a/headers/geometry.h b/headers/geometry.h index 7a33180..e38b67b 100644 --- a/headers/geometry.h +++ b/headers/geometry.h @@ -26,7 +26,7 @@ inline void mat44xVect(const dbl mat[ 4 ][ 4 ], const Coord3D& vect, Coord3D& ou void mat44xrigid(const Rigidbody& source, Rigidbody& result, dbl mat[4][4]); -void ABrotate(Coord3D A, Coord3D B, Rigidbody& target, dbl theta); +void rotate(Coord3D A, Coord3D B, Rigidbody& target, dbl theta); // void EulerZYZ(const Rigidbody & source, Rigidbody & cible, dbl theta, dbl phi, dbl psi); // void AttractEuler(const Rigidbody& source, Rigidbody& dest, dbl phi, dbl ssi, dbl rot); diff --git a/headers/mcopff.h b/headers/mcopff.h index 4e5048a..28b8786 100644 --- a/headers/mcopff.h +++ b/headers/mcopff.h @@ -24,11 +24,11 @@ std::vector _copies; public: /* - void AttractEulerRotate(const dbl& phi, const dbl& ssi, const dbl& rot) + void euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot) { for (uint i=0; i<_copies.size(); i++) { - _copies[i].AttractEulerRotate(phi, ssi, rot); + _copies[i].euler_rotate(phi, ssi, rot); } }; @@ -67,7 +67,7 @@ class Mcoprigid //multicopy rigidbody void addEnsemble(const Region& reg){ _vregion.push_back(reg); std::vector v; _weights.push_back(v); }; - void AttractEulerRotate(const dbl& phi, const dbl& ssi, const dbl& rot); + void euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot); void Translate(const Coord3D& c); diff --git a/headers/pairlist.h b/headers/pairlist.h index 91d1dda..3b8c334 100644 --- a/headers/pairlist.h +++ b/headers/pairlist.h @@ -36,7 +36,7 @@ class AttractPairList ///update pairlist void update(); - ///< Add a pair and checks if correct ligand and receptor are provided + ///< add a pair and checks if correct ligand and receptor are provided void addPair(const AttractRigidbody& ligand, const AttractRigidbody& receptor, const AtomPair& pair) ; ///return the current cutoff diff --git a/headers/rigidbody.h b/headers/rigidbody.h index a6ef624..9b0111d 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -52,7 +52,7 @@ class Rigidbody:private CoordsArray std::vector mForces; ///< forces for each atom std::string _description; ///< some string to describe the molecule -// bool isBackbone(const std::string & atomtype); /// mAtomProp; ///< array of atom properties @@ -102,10 +102,10 @@ class Rigidbody:private CoordsArray void SetAtom(uint pos, const Atom& atom); /// add an atom to the molecule (deep copy) - void AddAtom(const Atomproperty& at, Coord3D co); + void add_atom(const Atomproperty& at, Coord3D co); /// add an atom to the molecule - void AddAtom(const Atom& at); + void add_atom(const Atom& at); //returns the coordinates of atom i Coord3D GetCoords(uint i) const @@ -181,12 +181,12 @@ class Rigidbody:private CoordsArray AtomSelection CA(); /// selection of backbone atoms: - AtomSelection Backbone(); + AtomSelection backbone(); /// operator + : merge two Rigdibody by extending the first coordinates with the second coordinates. Rigidbody operator+ (const Rigidbody& rig); - void ABrotate(const Coord3D& A, const Coord3D& B, dbl theta); ///< rotation around (AB) axis. + void rotate(const Coord3D& A, const Coord3D& B, dbl theta); ///< rotation around (AB) axis. /// in some cases atoms may be ignored virtual bool isAtomActive(uint i) const {return true;}; @@ -196,10 +196,10 @@ class Rigidbody:private CoordsArray /// return the object name/description std::string getDescription(){return _description;}; - void AttractEulerRotate(dbl phi, dbl ssi, dbl rot); + void euler_rotate(dbl phi, dbl ssi, dbl rot); //friends - friend void ABrotate( Coord3D A, Coord3D B, Rigidbody& target, dbl theta ); + friend void rotate( Coord3D A, Coord3D B, Rigidbody& target, dbl theta ); friend void XRotation( const Rigidbody& source, Rigidbody& result, dbl alpha ); friend void EulerZYZ(const Rigidbody & source, Rigidbody & cible, dbl theta, dbl phi, dbl psi); diff --git a/names.py b/names.py index 11159f2..e8afc40 100644 --- a/names.py +++ b/names.py @@ -99,11 +99,11 @@ def parse_entry(entry, strip_terminals=False): def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): """Use unix sed command to rename identifiers in all relevant files.""" - # find . -name \*.h -exec sed --in-place 's/ABrotate/rotate/g' {} \; - # find . -name \*.cpp -exec sed --in-place 's/ABrotate/rotate/g' {} \; - # find . -name \*.pyx -exec sed --in-place 's/ABrotate/rotate/g' {} \; - # find . -name \*.py -exec sed --in-place 's/ABrotate/rotate/g' {} \; - # find . -name \*.rst -exec sed --in-place 's/ABrotate/rotate/g' {} \; + # find . -name \*.h -exec sed --in-place 's/rotate/rotate/g' {} \; + # find . -name \*.cpp -exec sed --in-place 's/rotate/rotate/g' {} \; + # find . -name \*.pyx -exec sed --in-place 's/rotate/rotate/g' {} \; + # find . -name \*.py -exec sed --in-place 's/rotate/rotate/g' {} \; + # find . -name \*.rst -exec sed --in-place 's/rotate/rotate/g' {} \; # make clean # make install # make test diff --git a/ptools/commands/attract_cmd.py b/ptools/commands/attract_cmd.py index 7d7b79a..97d343d 100644 --- a/ptools/commands/attract_cmd.py +++ b/ptools/commands/attract_cmd.py @@ -120,7 +120,7 @@ def run(args): # Limit to desired rotation (rotation dictionary is keyed by rotation number) rotations = {args.rotnb: rotations[args.rotnb]} - # CHR Add translation list splitting + # CHR add translation list splitting if args.ngroups > 1: print("Working on translations group {:d} of {:d}".format(args.ngroup, args.ngroups)) translations = docking.get_group(translations, args.ngroups, args.ngroup) diff --git a/ptools/commands/heligeom_cmd.py b/ptools/commands/heligeom_cmd.py index 650c5aa..fe41fc4 100644 --- a/ptools/commands/heligeom_cmd.py +++ b/ptools/commands/heligeom_cmd.py @@ -111,7 +111,7 @@ def getpstart(start, hp, dmin, dmax): pgroove = pmid + (hp.unitVector * (pitch / 2)) pstart = ptools.Rigidbody() - pstart.AddAtom(ptools.Atom(ap, pgroove)) + pstart.add_atom(ptools.Atom(ap, pgroove)) return pstart @@ -146,7 +146,7 @@ def groove_width_calculation(hp, mono1): nbpoint = abs(int(math.degrees(hp.angle)) * 2) for j in xrange(nbpoint): ldist = [] - start.ABrotate(O, O + axe, hp.angle / nbpoint) + start.rotate(O, O + axe, hp.angle / nbpoint) start.Translate(axe * hp.normtranslation / nbpoint) for k in xrange(int(round(dmin + (dmax - dmin) / 2)), int(round(dmax))): pstart = getpstart(start, hp, k, k) @@ -193,13 +193,13 @@ def extend(hp, mono1, nb, Z=False, seq=False): Zaxis = ptools.Rigidbody() O = ptools.Coord3D(0, 0, 0) - Zaxis.AddAtom(ptools.Atom(at, O)) + Zaxis.add_atom(ptools.Atom(at, O)) axe = ptools.Coord3D(0, 0, 1) - Zaxis.AddAtom(ptools.Atom(at, ptools.Coord3D(0, 0, 1))) + Zaxis.add_atom(ptools.Atom(at, ptools.Coord3D(0, 0, 1))) Protaxis = ptools.Rigidbody() - Protaxis.AddAtom(ptools.Atom(at, hp.point)) - Protaxis.AddAtom(ptools.Atom(at, hp.point + hp.unitVector.Normalize())) + Protaxis.add_atom(ptools.Atom(at, hp.point)) + Protaxis.add_atom(ptools.Atom(at, hp.point + hp.unitVector.Normalize())) # 2 superpose and get matrix m = ptools.superpose(Zaxis, Protaxis).matrix # 3 apply matrix to rigidbody @@ -212,7 +212,7 @@ def extend(hp, mono1, nb, Z=False, seq=False): print(final.print_pdb()) i += 1 for j in xrange(nb - 1): - monoTest.ABrotate(O, O + axe, hp.angle) + monoTest.rotate(O, O + axe, hp.angle) monoTest.Translate(axe * hp.normtranslation) monoTest = changeChain(monoTest, string.ascii_uppercase[i % 26]) if seq: diff --git a/ptools/docking.py b/ptools/docking.py index c5e45df..fc91694 100644 --- a/ptools/docking.py +++ b/ptools/docking.py @@ -131,7 +131,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, center = ligand.FindCenter() ligand.Translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 - ligand.AttractEulerRotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) + ligand.euler_rotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) ligand.Translate(trans) for minim in minimlist: @@ -145,8 +145,8 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, receptor.setTranslation(False) receptor.setRotation(False) - forcefield.AddLigand(receptor) - forcefield.AddLigand(ligand) + forcefield.addLigand(receptor) + forcefield.addLigand(ligand) # rstk = minim['rstk'] # restraint force # if rstk > 0.0: # forcefield.SetRestraint(rstk) @@ -161,7 +161,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, center = output.FindCenter() output.Translate(ptools.Coord3D() - center) - output.AttractEulerRotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) + output.euler_rotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) output.Translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) output.Translate(center) diff --git a/src/DNA.cpp b/src/DNA.cpp index 8b9e5c4..16e6dee 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -29,7 +29,7 @@ DNA::DNA(const string& dataBaseFile, const string& seq, const Movement& mov) else { AssembleSeq (dataBaseFile,seq); - ApplyInitialMov(mov); + applyInitialMov(mov); } } @@ -509,7 +509,7 @@ void DNA::ChangeFormat() } -void DNA::ApplyInitialMov(const Movement& mov) +void DNA::applyInitialMov(const Movement& mov) { unsigned int strandSize = strand.size(); for (unsigned int i=1; i Add(d[0], mov); + this->add(d[0], mov); for(uint i =1; i< d.Size();i++) { - this->Add(d[i],Movement(d.GetLocalMatrix(i))); + this->add(d[i],Movement(d.GetLocalMatrix(i))); } } /// add a basepair at the end of the strand of this DNA -void DNA::Add(BasePair bp, const Movement & mov) +void DNA::add(BasePair bp, const Movement & mov) { Matrix oldmouvement = bp.GetMatrix (); bp.apply(inverseMatrix44 (oldmouvement)); @@ -834,10 +834,10 @@ DNA DNA::SubDNA(uint start, uint end)const } DNA newdna = DNA(); - newdna.Add(strand[start],Movement(strand[start].GetMatrix())); + newdna.add(strand[start],Movement(strand[start].GetMatrix())); for (uint i=start+1; iGetLocalMatrix(i))); + newdna.add(strand[i],Movement(this->GetLocalMatrix(i))); } return newdna; } @@ -851,9 +851,9 @@ void DNA::Replace(const DNA & d,int start) strand.clear(); - this->Add(preDNA,initMov); - this->Add(d); - this->Add(postDNA); + this->add(preDNA,initMov); + this->add(d); + this->add(postDNA); } diff --git a/src/Parameter.cpp b/src/Parameter.cpp index b8698d4..a1a24ae 100644 --- a/src/Parameter.cpp +++ b/src/Parameter.cpp @@ -96,13 +96,13 @@ Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) Atomproperty atp; atp.atomType = "OO"; - base3D.AddAtom(atp,origin ); + base3D.add_atom(atp,origin ); atp.atomType = "OX"; - base3D.AddAtom(atp, origin + axeX); + base3D.add_atom(atp, origin + axeX); atp.atomType = "OY"; - base3D.AddAtom(atp, origin + axeY); + base3D.add_atom(atp, origin + axeY); atp.atomType = "OZ"; - base3D.AddAtom(atp, origin + axeZ); + base3D.add_atom(atp, origin + axeZ); return base3D; } @@ -149,13 +149,13 @@ Rigidbody Parameter::BuildAxisAAGeometricCenter( Rigidbody& bp) Atomproperty atp; atp.atomType = "OO"; - base3D.AddAtom(atp,origin ); + base3D.add_atom(atp,origin ); atp.atomType = "OX"; - base3D.AddAtom(atp, origin + axeX); + base3D.add_atom(atp, origin + axeX); atp.atomType = "OY"; - base3D.AddAtom(atp, origin + axeY); + base3D.add_atom(atp, origin + axeY); atp.atomType = "OZ"; - base3D.AddAtom(atp, origin + axeZ1); + base3D.add_atom(atp, origin + axeZ1); return base3D; } diff --git a/src/Stacking.cpp b/src/Stacking.cpp index e87696a..3ca09fb 100644 --- a/src/Stacking.cpp +++ b/src/Stacking.cpp @@ -161,8 +161,8 @@ Rigidbody Stacking::AxisPyrimidine(const Rigidbody& pyr, const Coord3D& centerBa //4 build the Axis for Pyrimidines Rigidbody pyrAxis; - pyrAxis.AddAtom(Atomproperty(),centerBase1); - pyrAxis.AddAtom(Atomproperty(),centerBase1+topOfAxis); + pyrAxis.add_atom(Atomproperty(),centerBase1); + pyrAxis.add_atom(Atomproperty(),centerBase1+topOfAxis); return pyrAxis; @@ -173,8 +173,8 @@ Rigidbody Stacking::AxisPyrimidineCopyPurine( const Coord3D& centerBase1, const Coord3D vectorPlanPur = axisPurine.GetCoords(1)-axisPurine.GetCoords(0); Rigidbody pyrAxis; - pyrAxis.AddAtom(Atomproperty(),centerBase1); - pyrAxis.AddAtom(Atomproperty(),centerBase1+vectorPlanPur); + pyrAxis.add_atom(Atomproperty(),centerBase1); + pyrAxis.add_atom(Atomproperty(),centerBase1+vectorPlanPur); return pyrAxis; } @@ -199,8 +199,8 @@ Rigidbody Stacking::AxisPurine(const Rigidbody& pur, const Coord3D& center)const topOfAxis = topOfAxis.Normalize(); //3 build the Axis for Purine Rigidbody purAxis; - purAxis.AddAtom(Atomproperty(),center); - purAxis.AddAtom(Atomproperty(),center+topOfAxis); + purAxis.add_atom(Atomproperty(),center); + purAxis.add_atom(Atomproperty(),center+topOfAxis); return purAxis; } diff --git a/src/atomselection.cpp b/src/atomselection.cpp index fd53dc7..38b94c2 100644 --- a/src/atomselection.cpp +++ b/src/atomselection.cpp @@ -16,7 +16,7 @@ AtomSelection::AtomSelection(const Rigidbody& rigid) m_rigid=&rigid; for (uint i=0; i < rigid.Size(); i++) { - this->AddAtomIndex(i); + this->add_atomIndex(i); } } @@ -39,7 +39,7 @@ Rigidbody AtomSelection::CreateRigid() for (uint i=0; iSize(); i++) { Atom at = m_rigid->CopyAtom(m_list[i]); - newrigid.AddAtom(at); + newrigid.add_atom(at); } return newrigid; diff --git a/src/attractforcefield.cpp b/src/attractforcefield.cpp index 2970e86..72da094 100644 --- a/src/attractforcefield.cpp +++ b/src/attractforcefield.cpp @@ -363,7 +363,7 @@ dbl BaseAttractForceField::Function(const Vdouble& stateVars ) if (m_movedligand[i].hasrotation) { assert(svptr+2 < stateVars.size()); - m_movedligand[i].AttractEulerRotate(stateVars[svptr], stateVars[svptr+1], stateVars[svptr+2]); + m_movedligand[i].euler_rotate(stateVars[svptr], stateVars[svptr+1], stateVars[svptr+2]); svptr+=3; } @@ -693,7 +693,7 @@ void BaseAttractForceField::Rota(uint molIndex, dbl phi,dbl ssi, dbl rot, Vdoubl -void BaseAttractForceField::AddLigand(AttractRigidbody & lig) +void BaseAttractForceField::addLigand(AttractRigidbody & lig) { setDummyTypeList(lig); // sets the dummy atom type. (virtual function customized for each Attract forcefield) diff --git a/src/coordsarray.cpp b/src/coordsarray.cpp index 62ba07e..d1a6789 100644 --- a/src/coordsarray.cpp +++ b/src/coordsarray.cpp @@ -194,7 +194,7 @@ _modified(); * until the coordinates are really needed. * If coordinates are never asked (why?), then no costly calculation is performed ! */ -void CoordsArray::AttractEulerRotate(dbl phi, dbl ssi, dbl rot) +void CoordsArray::euler_rotate(dbl phi, dbl ssi, dbl rot) { dbl cp, cs, ss, sp, cscp, sscp, sssp, crot, srot, cssp ; diff --git a/src/geometry.cpp b/src/geometry.cpp index 575d8bd..9ea3398 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -103,7 +103,7 @@ void MakeRotationMatrix( Coord3D A, Coord3D B, dbl theta, dbl out[ 4 ][ 4 ] ) -void ABrotate( Coord3D A, Coord3D B, Rigidbody& target, dbl theta ) +void rotate( Coord3D A, Coord3D B, Rigidbody& target, dbl theta ) { dbl matrix[ 4 ][ 4 ]; diff --git a/src/mcopff.cpp b/src/mcopff.cpp index 56b623c..ac847fb 100644 --- a/src/mcopff.cpp +++ b/src/mcopff.cpp @@ -22,20 +22,20 @@ void Mcoprigid::setMain(AttractRigidbody& main) { }; -void Mcoprigid::AttractEulerRotate(const dbl& phi, const dbl& ssi, const dbl& rot) +void Mcoprigid::euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot) { //Warning: makes euler rotation without centering //the Mcoprigid object must be centered //rotates the main body: - _main.AttractEulerRotate(phi, ssi, rot); + _main.euler_rotate(phi, ssi, rot); //for each multicopy region, rotates the copy: for (uint i=0; i < _vregion.size(); i++) for (uint j=0; j<_vregion[i].size(); j++) - _vregion[i][j].AttractEulerRotate(phi, ssi, rot); + _vregion[i][j].euler_rotate(phi, ssi, rot); } @@ -156,7 +156,7 @@ dbl McopForceField::Function(const Vdouble & v) assert(lig._vregion.size()==0); - lig.AttractEulerRotate(v[0],v[1],v[2]); + lig.euler_rotate(v[0],v[1],v[2]); lig.Translate(Coord3D(v[3],v[4],v[5])); diff --git a/src/pdbio.cpp b/src/pdbio.cpp index b1d3fbf..c043bf9 100644 --- a/src/pdbio.cpp +++ b/src/pdbio.cpp @@ -172,7 +172,7 @@ void ReadPDB(istream& file, Rigidbody& protein) { Coord3D pos = pdbToCoords(line); Atomproperty a; pdbToAtomproperty(line, a); - protein.AddAtom(a,pos); + protein.add_atom(a,pos); } } diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index 5dbf241..ba8f7b8 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -59,10 +59,10 @@ Rigidbody::Rigidbody(const Rigidbody& model) } -void Rigidbody::AddAtom(const Atomproperty& at, Coord3D co) +void Rigidbody::add_atom(const Atomproperty& at, Coord3D co) { mAtomProp.push_back(at); - AddCoord(co); + add_coord(co); } @@ -90,11 +90,11 @@ Atom Rigidbody::CopyAtom(uint i) const -void Rigidbody::AddAtom(const Atom& at) +void Rigidbody::add_atom(const Atom& at) { Atomproperty atp(at); Coord3D co = at.coords; - AddAtom(atp,co); + add_atom(atp,co); } @@ -147,9 +147,9 @@ void Rigidbody::Translate(const Coord3D& tr) CoordsArray::Translate(tr); } -void Rigidbody::AttractEulerRotate(dbl phi, dbl ssi, dbl rot) +void Rigidbody::euler_rotate(dbl phi, dbl ssi, dbl rot) { - CoordsArray::AttractEulerRotate(phi, ssi, rot); + CoordsArray::euler_rotate(phi, ssi, rot); } @@ -162,7 +162,7 @@ AtomSelection Rigidbody::SelectAllAtoms() const newsel.SetRigid(*this); for (uint i=0; i < Size(); i++) { - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } @@ -189,7 +189,7 @@ AtomSelection Rigidbody::SelectAtomType(std::string atomtype) std::string & at2 = mAtomProp[i].atomType ; if (at2.substr(0, sub.size()) == sub) //compare sub to the beginning of mAtomProp[i].atomType - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } @@ -200,7 +200,7 @@ AtomSelection Rigidbody::SelectAtomType(std::string atomtype) for (uint i=0; i=start && atp.residId <= stop) newsel.AddAtomIndex(i); + if (atp.residId >=start && atp.residId <= stop) newsel.add_atomIndex(i); } return newsel; } @@ -250,7 +250,7 @@ AtomSelection Rigidbody::CA() { return SelectAtomType("CA"); } -bool isBackbone(const std::string & atomtype) +bool isbackbone(const std::string & atomtype) { const std::string bbtypes[] = {"N", "CA", "C", "O"}; @@ -265,16 +265,16 @@ bool isBackbone(const std::string & atomtype) } -AtomSelection Rigidbody::Backbone() +AtomSelection Rigidbody::backbone() { AtomSelection newsel; newsel.SetRigid(*this); for (uint i=0; iSize(); i++) { - if (isBackbone(CopyAtom(i).atomType) ) + if (isbackbone(CopyAtom(i).atomType) ) { - newsel.AddAtomIndex(i); + newsel.add_atomIndex(i); } } @@ -286,16 +286,16 @@ AtomSelection Rigidbody::Backbone() Rigidbody Rigidbody::operator+(const Rigidbody& rig) { Rigidbody rigFinal(*this); for (uint i=0; i< rig.Size() ; i++) { - rigFinal.AddCoord(rig.GetCoords(i)); + rigFinal.add_coord(rig.GetCoords(i)); rigFinal.mAtomProp.push_back(rig.mAtomProp[i]); } return rigFinal; } -void Rigidbody::ABrotate(const Coord3D& A, const Coord3D& B, dbl theta) +void Rigidbody::rotate(const Coord3D& A, const Coord3D& B, dbl theta) { - PTools::ABrotate(A,B, *this, theta); + PTools::rotate(A,B, *this, theta); } diff --git a/src/surface.cpp b/src/surface.cpp index 0b3d42e..b86721d 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -138,7 +138,7 @@ Rigidbody Surface::surfpoint(const Rigidbody & rigid, dbl srad) { Atom m_atom2 = rigid.CopyAtom(i); m_atom2.coords = coord1 + coord4; - rigidsurf.AddAtom(m_atom2); + rigidsurf.add_atom(m_atom2); } } } @@ -165,7 +165,7 @@ Rigidbody Surface::surfpoint(const Rigidbody & rigid, dbl srad) { Atom m_atom2 = rigid.CopyAtom(i); m_atom2.coords = coord1 + coord4 ; - rigidsurf.AddAtom(m_atom2); + rigidsurf.add_atom(m_atom2); } costh+=2; } @@ -193,7 +193,7 @@ Rigidbody Surface::outergrid(const Rigidbody & grid, const Rigidbody & rigid2, d dbl dist=Norm2(xyz1-xyz2); if (dist < srad) { select = false; } } - if (select) { rigid3.AddAtom(grid.CopyAtom(i)); } + if (select) { rigid3.add_atom(grid.CopyAtom(i)); } } return rigid3; } @@ -220,7 +220,7 @@ Rigidbody Surface::removeclosest(const Rigidbody & rigid, dbl srad) } } for (int i=0; i Date: Thu, 27 Jul 2017 17:08:43 +0200 Subject: [PATCH 10/22] minor mod to names.py --- Makefile | 2 +- NAMES_TXN | 44 ++++++++++++++++++++++---------------------- names.py | 2 -- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index e0e0809..2fec621 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean-build: rm -fr dist/ rm -fr .eggs/ rm -f bindings/_ptools.cpp - rm -f bindings/_cgopt.c + rm -f bindings/_cgopt.cpp rm -f $(MANIFEST_OUT) rm -f headers/gitrev.h find . -name '*.egg-info' -exec rm -fr {} + diff --git a/NAMES_TXN b/NAMES_TXN index 70fad5b..21e64eb 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -1,25 +1,25 @@ -ABrotate rotate -AddAtom add_atom -AddCoord add_coord -Add add -addfinalizer add_finalizer -AddLigand add_ligand -ApplyLocal apply_local -ApplyMatrix apply_matrix -Apply apply -AttractEulerRotate euler_rotate -Backbone backbone -# CA( get_CA( -# ChangeRepresentation( change_representation( -# ChangeType( change_type( -# CopyAtom( copy_atom( -# createRigid( create_rigid( -# CreateRigid create_rigid( -# crossproduct( cross_product( -# Dist2( dist2( -# Dist( dist( -# dotproduct( dot_product( -# FindCenter( find_center( +# ABrotate rotate +# AddAtom add_atom +# AddCoord add_coord +# Add add +# addfinalizer add_finalizer +# AddLigand add_ligand +# ApplyLocal apply_local +# ApplyMatrix apply_matrix +# Apply apply +# AttractEulerRotate euler_rotate +# Backbone backbone +CA( get_CA( +ChangeRepresentation( change_representation( +ChangeType( change_type( +CopyAtom( copy_atom( +createRigid( create_rigid( +CreateRigid( create_rigid( +crossproduct( cross_product( +Dist2( dist2( +Dist( dist( +dotproduct( dot_product( +FindCenter( find_center( # GetAtomProperty( get_atom_property( # GetChainId( get_chainid( # getCoords( get_coords( diff --git a/names.py b/names.py index e8afc40..029331d 100644 --- a/names.py +++ b/names.py @@ -85,8 +85,6 @@ def read_substitutions(filename): entry = line.strip().split() if len(entry) == 2: substitutions.append(entry) - else: - print entry return substitutions From cd542163d605b6468605728309fbc0b8d7b736cf Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 17:29:02 +0200 Subject: [PATCH 11/22] rename C-F --- NAMES_TXN | 20 ++++++++--------- Tests/cpp/ptoolstest.h | 10 ++++----- Tests/heligeom/test_heligeom.py | 4 ++-- Tests/test_atomselection.py | 14 ++++++------ Tests/test_attract_misc.py | 4 ++-- Tests/test_coord3d.py | 8 +++---- Tests/test_dna.py | 16 +++++++------- Tests/test_misc.py | 30 ++++++++++++------------- Tests/test_rigidbody.py | 32 +++++++++++++-------------- bindings/atom.pyx | 12 +++++----- bindings/atomselection.pyx | 8 +++---- bindings/attractrigidbody.pyx | 12 +++++----- bindings/coord3d.pyx | 4 ++-- bindings/dna.pyx | 12 +++++----- bindings/rigidbody.pyx | 18 +++++++-------- headers/BasePair.h | 2 +- headers/DNA.h | 8 +++---- headers/atom.h | 4 ++-- headers/atomselection.h | 6 ++--- headers/rigidbody.h | 6 ++--- ptools/__init__.py | 8 +++---- ptools/commands/attract_cmd.py | 2 +- ptools/commands/heligeom_cmd.py | 22 +++++++++--------- ptools/commands/translate_cmd.py | 2 +- ptools/docking.py | 8 +++---- ptools/reduce.py | 2 +- src/BasePair.cpp | 6 ++--- src/DNA.cpp | 32 +++++++++++++-------------- src/Parameter.cpp | 8 +++---- src/Stacking.cpp | 38 ++++++++++++++++---------------- src/atomselection.cpp | 4 ++-- src/attractforcefield.cpp | 2 +- src/mcopff.cpp | 2 +- src/pdbio.cpp | 2 +- src/rigidbody.cpp | 14 ++++++------ src/rmsd.cpp | 6 ++--- src/superpose.cpp | 6 ++--- src/surface.cpp | 10 ++++----- 38 files changed, 202 insertions(+), 202 deletions(-) diff --git a/NAMES_TXN b/NAMES_TXN index 21e64eb..074ca93 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -10,16 +10,16 @@ # AttractEulerRotate euler_rotate # Backbone backbone CA( get_CA( -ChangeRepresentation( change_representation( -ChangeType( change_type( -CopyAtom( copy_atom( -createRigid( create_rigid( -CreateRigid( create_rigid( -crossproduct( cross_product( -Dist2( dist2( -Dist( dist( -dotproduct( dot_product( -FindCenter( find_center( +ChangeRepresentation change_representation +ChangeType change_type +CopyAtom copy_atom +createRigid create_rigid +CreateRigid create_rigid +crossproduct cross_product +# Dist2( dist2( +Dist dist +dotproduct dot_product +FindCenter find_center # GetAtomProperty( get_atom_property( # GetChainId( get_chainid( # getCoords( get_coords( diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index cf8947a..1fce4f7 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -72,7 +72,7 @@ Coord3D A, B; { s = Rigidbody(r); TS_ASSERT_EQUALS(s.Size(), r.Size()) - TS_ASSERT_EQUALS(r.FindCenter(), s.FindCenter()); + TS_ASSERT_EQUALS(r.find_center(), s.find_center()); } @@ -82,11 +82,11 @@ Coord3D A, B; void testSetAtom() { - Atom atom (r.CopyAtom(3) ) ; + Atom atom (r.copy_atom(3) ) ; atom.coords = Coord3D(3,4,5); r.SetAtom(3,atom); //#test to see if the mofification worked: - Atom atom2 = r.CopyAtom(3); + Atom atom2 = r.copy_atom(3); TS_ASSERT( Norm2(atom2.coords - Coord3D(3,4,5) ) < 1e6 ); } @@ -144,9 +144,9 @@ Rigidbody rigid1, rigid2, rigid3; void testTranslation1() { - Coord3D CoM1 = rigid1.FindCenter() ; + Coord3D CoM1 = rigid1.find_center() ; rigid1.Translate(Coord3D(3.0, -55.67, 1)); - Coord3D CoM2 = rigid1.FindCenter(); + Coord3D CoM2 = rigid1.find_center(); Coord3D diff=CoM2-CoM1; TS_ASSERT( Norm2(diff + Coord3D(-3.0, 55.67, -1.0)) < 1e-6); rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)); //# translate back diff --git a/Tests/heligeom/test_heligeom.py b/Tests/heligeom/test_heligeom.py index ff33e55..9c59938 100644 --- a/Tests/heligeom/test_heligeom.py +++ b/Tests/heligeom/test_heligeom.py @@ -45,7 +45,7 @@ def testBasicManipulation(self): dna.add(new, BDNA()) # change the type of a base - dna.ChangeType(0, "A", TEST_BP_RED) + dna.change_type(0, "A", TEST_BP_RED) # turn the center base dna.apply_local(Roll(30), dna.Size() / 2) @@ -54,7 +54,7 @@ def testBasicManipulation(self): dna = dna.SubDNA(2, dna.Size() - 3) # change to a All Atom representation - dna.ChangeRepresentation(TEST_BP_PDB) + dna.change_representation(TEST_BP_PDB) result = dna.PrintPDB() with open(TEST_BASIC_MANIP_EXPECTED_PDB, 'rt') as f: diff --git a/Tests/test_atomselection.py b/Tests/test_atomselection.py index 90736ed..0a2fb1b 100644 --- a/Tests/test_atomselection.py +++ b/Tests/test_atomselection.py @@ -17,8 +17,8 @@ def testSelectAll(self): allAtoms = self.rig.SelectAllAtoms() self.assertEqual(len(allAtoms), 5067) - def testSelectCA(self): - CAatoms = self.rig.CA() + def testSelectget_CA(self): + CAatoms = self.rig.get_CA() self.assertEqual(len(CAatoms), 643) def testSelectAtomType_simple(self): @@ -39,7 +39,7 @@ def testSelectResRange(self): def testSelectResRangeNegativeResId(self): rigid = Rigidbody(TEST_2AAV_PDB) - selection = rigid.SelectResRange(-4, -1) & rigid.CA() + selection = rigid.SelectResRange(-4, -1) & rigid.get_CA() self.assertEqual(len(selection), 4) def testAnd(self): @@ -59,18 +59,18 @@ def testSelectChainId(self): chainA = self.rig.SelectChainId("A") self.assertEqual(len(chainA), 2638) - def testCreateRigid(self): + def testcreate_rigid(self): met1A = self.rig.SelectResidType("MET") & self.rig.SelectResRange(1, 5) & self.rig.SelectChainId("A") - rigid = met1A.CreateRigid() + rigid = met1A.create_rigid() self.assertEqual(len(rigid), 8) def testNotOperator(self): - sel_ca = self.rig.CA() + sel_ca = self.rig.get_CA() sel_not_ca = ~ sel_ca # operator NOT self.assertEqual(len(sel_ca) + len(sel_not_ca), len(self.rig)) def testAlternateNotOperator(self): - sel_ca = self.rig.CA() + sel_ca = self.rig.get_CA() sel_not_ca = sel_ca.not_() # operator NOT self.assertEqual(len(sel_ca) + len(sel_not_ca), len(self.rig)) diff --git a/Tests/test_attract_misc.py b/Tests/test_attract_misc.py index 2c4392f..f30e019 100644 --- a/Tests/test_attract_misc.py +++ b/Tests/test_attract_misc.py @@ -89,7 +89,7 @@ def test_find_analytical_solution_when_displaced_along_Y(self): receptor.setTranslation(False) receptor.setRotation(False) ligand = AttractRigidbody(TEST_TOYMINIM_LIGAND) - atom = ligand.CopyAtom(0) + atom = ligand.copy_atom(0) # Ligand position in file 5.0, 5.0, 0.0 # Minimum-energy ligand position is 5.0, 0.0, 0.0 print "Ligand starting position: %s" % atom.ToPdbString() @@ -119,7 +119,7 @@ def test_find_analytical_solution_when_displaced_along_X_Y_Z(self): # New starting ligand position 10.0, 5.0, 5.0 # Minimum-energy ligand position is 5.0, 0.0, 0.0 ligand.Translate(Coord3D(5.0, 0.0, 5.0)) - atom = ligand.CopyAtom(0) + atom = ligand.copy_atom(0) print "Ligand starting position: %s" % atom.ToPdbString() self.forcefield.addLigand(receptor) diff --git a/Tests/test_coord3d.py b/Tests/test_coord3d.py index 22853e1..be4579e 100644 --- a/Tests/test_coord3d.py +++ b/Tests/test_coord3d.py @@ -43,12 +43,12 @@ def test_norm2(self): self.assertAlmostEqual(ptools.norm2(self.coo1), 7.0710678118654755 ** 2) self.assertAlmostEqual(ptools.norm2(self.coo2), 7.8262379212492643 ** 2) - def test_dotproduct(self): - res = ptools.dotproduct(self.coo1, self.coo2) + def test_dot_product(self): + res = ptools.dot_product(self.coo1, self.coo2) self.assertAlmostEqual(res, 48.5) - def test_crossproduct(self): - res = ptools.crossproduct(self.coo1, self.coo2) + def test_cross_product(self): + res = ptools.cross_product(self.coo1, self.coo2) self.assertAlmostEqual(res.x, 20.) self.assertAlmostEqual(res.y, -17.5) self.assertAlmostEqual(res.z, 2.) diff --git a/Tests/test_dna.py b/Tests/test_dna.py index 02f43e3..2081ed1 100644 --- a/Tests/test_dna.py +++ b/Tests/test_dna.py @@ -26,8 +26,8 @@ def test_has_len(self): def test_has_add(self): self.assertTrue(hasattr(DNA, 'add')) - def test_has_ChangeType(self): - self.assertTrue(hasattr(DNA, 'ChangeType')) + def test_has_change_type(self): + self.assertTrue(hasattr(DNA, 'change_type')) def test_has_apply_local(self): self.assertTrue(hasattr(DNA, 'apply_local')) @@ -35,8 +35,8 @@ def test_has_apply_local(self): def test_has_SubDNA(self): self.assertTrue(hasattr(DNA, 'SubDNA')) - def test_has_ChangeRepresentation(self): - self.assertTrue(hasattr(DNA, 'ChangeRepresentation')) + def test_has_change_representation(self): + self.assertTrue(hasattr(DNA, 'change_representation')) def test_has_PrintPDB(self): self.assertTrue(hasattr(DNA, 'PrintPDB')) @@ -65,9 +65,9 @@ def test_add(self): self.dna.add(dna) self.assertEqual(self.dna.Size(), 34) - def test_ChangeType(self): + def test_change_type(self): warnings.warn("only check the call, not the result") - self.dna.ChangeType(0, "A", PDB_BASE_PAIR) + self.dna.change_type(0, "A", PDB_BASE_PAIR) def test_apply_local(self): warnings.warn("only check the call, not the result") @@ -77,9 +77,9 @@ def test_SubDNA(self): warnings.warn("only check the call, not the result") self.dna.SubDNA(2, self.dna.Size() - 3) - def test_ChangeRepresentation(self): + def test_change_representation(self): warnings.warn("only check the call, not the result") - self.dna.ChangeRepresentation(PDB_BASE_PAIR2) + self.dna.change_representation(PDB_BASE_PAIR2) def test_PrintPDB(self): s = self.dna.PrintPDB() diff --git a/Tests/test_misc.py b/Tests/test_misc.py index db8eaf4..82eeb76 100644 --- a/Tests/test_misc.py +++ b/Tests/test_misc.py @@ -43,9 +43,9 @@ def testRmsdAtomSelection2(self): self.assertEqual(Rmsd(self.rigid2, atsel), 0) def testTranslation1(self): - CoM1 = self.rigid1.FindCenter() + CoM1 = self.rigid1.find_center() self.rigid1.Translate(Coord3D(3.0, -55.67, 1)) - CoM2 = self.rigid1.FindCenter() + CoM2 = self.rigid1.find_center() diff = CoM2 - CoM1 self.assertAlmostEqual(norm2(diff + Coord3D(-3.0, 55.67, -1.0)), 0.0) self.rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)) # translate back @@ -78,19 +78,19 @@ def setUp(self): def testRotZ(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 0, 1), math.pi / 2) # i should now be j - co1 = self.rig.CopyAtom(0).coords + co1 = self.rig.copy_atom(0).coords self.assertAlmostEqual(co1.x, 0) self.assertAlmostEqual(co1.z, 0) self.assertAlmostEqual(co1.y, 1) # j becomes -i - co2 = self.rig.CopyAtom(1).coords + co2 = self.rig.copy_atom(1).coords self.assertAlmostEqual(co2.x, -1) self.assertAlmostEqual(co2.y, 0) self.assertAlmostEqual(co2.z, 0) # k is still k: - co3 = self.rig.CopyAtom(2).coords + co3 = self.rig.copy_atom(2).coords self.assertAlmostEqual(co3.x, 0) self.assertAlmostEqual(co3.y, 0) self.assertAlmostEqual(co3.z, 1) @@ -99,19 +99,19 @@ def testRotX(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(1, 0, 0), math.pi / 2) # i is still i - co1 = self.rig.CopyAtom(0).coords + co1 = self.rig.copy_atom(0).coords self.assertAlmostEqual(co1.x, 1) self.assertAlmostEqual(co1.z, 0) self.assertAlmostEqual(co1.y, 0) # j becomes k - co2 = self.rig.CopyAtom(1).coords + co2 = self.rig.copy_atom(1).coords self.assertAlmostEqual(co2.x, 0) self.assertAlmostEqual(co2.y, 0) self.assertAlmostEqual(co2.z, 1) # k becomes -j - co3 = self.rig.CopyAtom(2).coords + co3 = self.rig.copy_atom(2).coords self.assertAlmostEqual(co3.x, 0) self.assertAlmostEqual(co3.y, -1) self.assertAlmostEqual(co3.z, 0) @@ -120,19 +120,19 @@ def testRotY(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 1, 0), math.pi / 2) # i becomes -j - co1 = self.rig.CopyAtom(0).coords + co1 = self.rig.copy_atom(0).coords self.assertAlmostEqual(co1.x, 0) self.assertAlmostEqual(co1.z, -1) self.assertAlmostEqual(co1.y, 0) # j is still j - co2 = self.rig.CopyAtom(1).coords + co2 = self.rig.copy_atom(1).coords self.assertAlmostEqual(co2.x, 0) self.assertAlmostEqual(co2.y, 1) self.assertAlmostEqual(co2.z, 0) # k becomes i - co3 = self.rig.CopyAtom(2).coords + co3 = self.rig.copy_atom(2).coords self.assertAlmostEqual(co3.x, 1) self.assertAlmostEqual(co3.y, 0) self.assertAlmostEqual(co3.z, 0) @@ -140,22 +140,22 @@ def testRotY(self): def testRotZ_trans(self): self.rig.rotate(Coord3D(1, 1, 1), Coord3D(1, 1, 3), math.pi / 2) - co1 = self.rig.CopyAtom(0).coords + co1 = self.rig.copy_atom(0).coords self.assertAlmostEqual(co1.x, 2) self.assertAlmostEqual(co1.z, 0) self.assertAlmostEqual(co1.y, 1) - co2 = self.rig.CopyAtom(1).coords + co2 = self.rig.copy_atom(1).coords self.assertAlmostEqual(co2.x, 1) self.assertAlmostEqual(co2.y, 0) self.assertAlmostEqual(co2.z, 0) - co3 = self.rig.CopyAtom(2).coords + co3 = self.rig.copy_atom(2).coords self.assertAlmostEqual(co3.x, 2) self.assertAlmostEqual(co3.y, 0) self.assertAlmostEqual(co3.z, 1) - co4 = self.rig.CopyAtom(3).coords + co4 = self.rig.copy_atom(3).coords self.assertAlmostEqual(co4.x, 1) self.assertAlmostEqual(co4.y, 1) self.assertAlmostEqual(co4.z, 1) diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index f7a1d0d..69dec27 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -35,8 +35,8 @@ def test_Rigidbody_has_setCoords(self): def test_Rigidbody_has_Translate(self): self.assertTrue(hasattr(Rigidbody, 'Translate')) - def test_Rigidbody_has_FindCenter(self): - self.assertTrue(hasattr(Rigidbody, 'FindCenter')) + def test_Rigidbody_has_find_center(self): + self.assertTrue(hasattr(Rigidbody, 'find_center')) def test_Rigidbody_has_rotate(self): self.assertTrue(hasattr(Rigidbody, 'rotate')) @@ -50,8 +50,8 @@ def test_Rigidbody_has_syncCoords(self): def test_Rigidbody_has_apply_matrix(self): self.assertTrue(hasattr(Rigidbody, 'apply_matrix')) - def test_Rigidbody_has_CopyAtom(self): - self.assertTrue(hasattr(Rigidbody, 'CopyAtom')) + def test_Rigidbody_has_copy_atom(self): + self.assertTrue(hasattr(Rigidbody, 'copy_atom')) def test_Rigidbody_has_add_atom(self): self.assertTrue(hasattr(Rigidbody, 'add_atom')) @@ -86,8 +86,8 @@ def test_Rigidbody_has_SelectChainId(self): def test_Rigidbody_has_SelectResRange(self): self.assertTrue(hasattr(Rigidbody, 'SelectResRange')) - def test_Rigidbody_has_CA(self): - self.assertTrue(hasattr(Rigidbody, 'CA')) + def test_Rigidbody_has_get_CA(self): + self.assertTrue(hasattr(Rigidbody, 'get_CA')) def test_Rigidbody_has_backbone(self): self.assertTrue(hasattr(Rigidbody, 'backbone')) @@ -114,7 +114,7 @@ def setUp(self): def testCopy(self): s = Rigidbody(self.r) self.assertEqual(len(s), len(self.r)) - self.assertEqual(self.r.FindCenter(), s.FindCenter()) + self.assertEqual(self.r.find_center(), s.find_center()) def test_len(self): self.assertEqual(len(self.r), 2365) @@ -133,12 +133,12 @@ def coordinates_equal(test, ref): d = abs(test - ref) return d.x < t and d.y < t and d.z < t origin = Coord3D(0, 0, 0) - self.assertFalse(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work + self.assertFalse(coordinates_equal(origin, self.r.find_center())) # assertEqual won't work self.r.center_to_origin() - self.assertTrue(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work + self.assertTrue(coordinates_equal(origin, self.r.find_center())) # assertEqual won't work - def testCopyAtom(self): - atom = self.r.CopyAtom(3) + def testcopy_atom(self): + atom = self.r.copy_atom(3) coords = atom.coords assertCoordsAlmostEqual(self, coords, Coord3D(-16.159, 189.782, 106.402)) self.assertEqual(atom.atomId, 4) @@ -156,17 +156,17 @@ def testTranslate(self): ref = Coord3D(-16.159 + 3.2, 189.782 + 2.98, 106.402 + 14.22) assertCoordsAlmostEqual(self, coords, ref) - def testFindCenter(self): - cen = self.r.FindCenter() + def testfind_center(self): + cen = self.r.find_center() ref = Coord3D(-20.171249, 215.498060, 119.427781) assertCoordsAlmostEqual(self, cen, ref) def testSetAtom(self): - atom = self.r.CopyAtom(3) + atom = self.r.copy_atom(3) atom.coords = Coord3D(3, 4, 5) self.r.SetAtom(3, atom) # test to see if the mofification worked: - atom2 = self.r.CopyAtom(3) + atom2 = self.r.copy_atom(3) coords2 = atom2.coords assertCoordsAlmostEqual(self, atom2.coords, Coord3D(3, 4, 5)) assertCoordsAlmostEqual(self, coords2, Coord3D(3, 4, 5)) @@ -234,7 +234,7 @@ def testSetAtomPropertyWithNegativePosition(self): def testNegativeResId(self): rigid = Rigidbody(TEST_2AAV_PDB) - at1 = rigid.CopyAtom(0) + at1 = rigid.copy_atom(0) self.assertEqual(at1.residId, -4) diff --git a/bindings/atom.pyx b/bindings/atom.pyx index ec6be8d..3be2579 100644 --- a/bindings/atom.pyx +++ b/bindings/atom.pyx @@ -25,8 +25,8 @@ cdef extern from "atom.h" namespace "PTools": void Translate(CppCoord3D&) CppCoord3D coords - cdef double cppDist "PTools::Dist" (CppAtom& , CppAtom& ) - cdef double cppDist2 "PTools::Dist2" (CppAtom& , CppAtom& ) + cdef double cppdist "PTools::dist" (CppAtom& , CppAtom& ) + cdef double cppdist2 "PTools::dist2" (CppAtom& , CppAtom& ) cdef extern from "cython_wrappers.h": cdef void cy_copy_atom(CppAtom* , CppAtom* ) @@ -187,9 +187,9 @@ cdef class Atom(Atomproperty): (self.thisptr).Translate(deref(co.thisptr)) -def Dist(Atom at1, Atom at2): - return cppDist(deref(at1.thisptr), deref(at2.thisptr)) +def dist(Atom at1, Atom at2): + return cppdist(deref(at1.thisptr), deref(at2.thisptr)) -def Dist2(Atom at1, Atom at2): - return cppDist2(deref(at1.thisptr), deref(at2.thisptr)) +def dist2(Atom at1, Atom at2): + return cppdist2(deref(at1.thisptr), deref(at2.thisptr)) diff --git a/bindings/atomselection.pyx b/bindings/atomselection.pyx index a8fbe3b..802777b 100644 --- a/bindings/atomselection.pyx +++ b/bindings/atomselection.pyx @@ -11,9 +11,9 @@ cdef extern from "atomselection.h" namespace "PTools": unsigned int Size() void SetRigid(CppRigidbody&) CppAtom operator[] - CppAtom CopyAtom(unsigned int) + CppAtom copy_atom(unsigned int) void add_atomIndex(unsigned int) - CppRigidbody CreateRigid() + CppRigidbody create_rigid() CppAtomSelection non(CppAtomSelection &) @@ -85,11 +85,11 @@ cdef class AtomSelection: return self.__invert__() - def CreateRigid(self): + def create_rigid(self): ret = Rigidbody() if ret.thisptr: del ret.thisptr - cdef CppRigidbody rig = self.thisptr.CreateRigid() + cdef CppRigidbody rig = self.thisptr.create_rigid() ret.thisptr = new CppRigidbody(rig) return ret diff --git a/bindings/attractrigidbody.pyx b/bindings/attractrigidbody.pyx index 49f97c7..520735c 100644 --- a/bindings/attractrigidbody.pyx +++ b/bindings/attractrigidbody.pyx @@ -20,7 +20,7 @@ cdef extern from "attractrigidbody.h" namespace "PTools": void setRotation(int) void setTranslation(int) - CppCoord3D FindCenter() + CppCoord3D find_center() unsigned int Size() @@ -33,7 +33,7 @@ cdef extern from "attractrigidbody.h" namespace "PTools": void PrintMatrix() - CppAtomSelection CA() + CppAtomSelection get_CA() @@ -110,9 +110,9 @@ cdef class AttractRigidbody (Rigidbody) : return self.thisptr.Size() - def FindCenter(self): + def find_center(self): cdef CppRigidbody* rig = self.thisptr - cdef CppCoord3D* co = new CppCoord3D (rig.FindCenter()) + cdef CppCoord3D* co = new CppCoord3D (rig.find_center()) ret = Coord3D() del ret.thisptr ret.thisptr = co @@ -140,9 +140,9 @@ cdef class AttractRigidbody (Rigidbody) : def PrintMatrix(self): ( self.thisptr).PrintMatrix() - def CA(self): + def get_CA(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.CA() + cdef CppAtomSelection new_sel = self.thisptr.get_CA() ret.thisptr = new CppAtomSelection(new_sel) return ret \ No newline at end of file diff --git a/bindings/coord3d.pyx b/bindings/coord3d.pyx index 479fc0a..fc410c4 100644 --- a/bindings/coord3d.pyx +++ b/bindings/coord3d.pyx @@ -113,10 +113,10 @@ def norm(Coord3D v): def norm2(Coord3D v): return Norm2(deref(v.thisptr)) -def dotproduct(Coord3D u, Coord3D v): +def dot_product(Coord3D u, Coord3D v): return dotProduct(deref(u.thisptr), deref(v.thisptr)) -def crossproduct(Coord3D u, Coord3D v): +def cross_product(Coord3D u, Coord3D v): cdef CppCoord3D cppresult = crossProduct(deref(u.thisptr), deref(v.thisptr)) cdef Coord3D result = Coord3D(cppresult.x, cppresult.y, cppresult.z) return result diff --git a/bindings/dna.pyx b/bindings/dna.pyx index fc176b6..990ae9f 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -14,9 +14,9 @@ cdef extern from "DNA.h" namespace "PTools": void add(CppBasePair) void add(CppDNA, const CppMovement &) void add(CppDNA) - void ChangeType(int, string, string) + void change_type(int, string, string) void apply_local(const CppMovement&, int) - void ChangeRepresentation(string) + void change_representation(string) string PrintPDB() @@ -86,16 +86,16 @@ cdef class DNA: else: self.thisptr.add(deref(dna.thisptr), deref(mov.thisptr)) - def ChangeType(self, int pos, bytes basetype, bytes filename): + def change_type(self, int pos, bytes basetype, bytes filename): cdef const char * c_basetype = basetype cdef const char * c_filename = filename - self.thisptr.ChangeType(pos, str(c_basetype), str(c_filename)) + self.thisptr.change_type(pos, str(c_basetype), str(c_filename)) def apply_local(self, Movement mov, int posMov): self.thisptr.apply_local(deref(mov.thisptr), posMov) - def ChangeRepresentation(self, bytes rep): - self.thisptr.ChangeRepresentation(rep) + def change_representation(self, bytes rep): + self.thisptr.change_representation(rep) def PrintPDB(self): return self.thisptr.PrintPDB() diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index f04bba1..3ce771e 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -23,11 +23,11 @@ cdef extern from "rigidbody.h" namespace "PTools": void SetCoords(unsigned int, CppCoord3D &) void rotate(CppCoord3D &, CppCoord3D &, double) void Translate(CppCoord3D &) - CppCoord3D FindCenter() + CppCoord3D find_center() void syncCoords() void euler_rotate(double, double, double) void apply_matrix(Array2D[double] &) - CppAtom CopyAtom(unsigned int) + CppAtom copy_atom(unsigned int) void add_atom(CppAtomproperty &, CppCoord3D) void add_atom(CppAtom &) void SetAtom(unsigned int, CppAtom &) @@ -50,7 +50,7 @@ cdef extern from "rigidbody.h" namespace "PTools": CppAtomSelection SelectResidType(string) CppAtomSelection SelectChainId(string) CppAtomSelection SelectResRange(int, int) - CppAtomSelection CA() + CppAtomSelection get_CA() CppAtomSelection backbone() @@ -142,9 +142,9 @@ cdef class Rigidbody: def Translate(self, Coord3D tr): self.thisptr.Translate(deref(tr.thisptr)) - def FindCenter(self): + def find_center(self): cdef Coord3D c = Coord3D() - cdef CppCoord3D cpp = self.thisptr.FindCenter() + cdef CppCoord3D cpp = self.thisptr.find_center() c.x = cpp.x c.y = cpp.y c.z = cpp.z @@ -163,8 +163,8 @@ cdef class Rigidbody: def apply_matrix(self, Matrix mat): self.thisptr.apply_matrix(deref(mat.thisptr)) - def CopyAtom(self, unsigned int atid): - cdef CppAtom cpp_at = self.thisptr.CopyAtom(atid) + def copy_atom(self, unsigned int atid): + cdef CppAtom cpp_at = self.thisptr.copy_atom(atid) cdef Atom at = Atom() cdef CppAtom * cpp_dest = at.thisptr cy_copy_atom(& cpp_at, cpp_dest) @@ -239,10 +239,10 @@ cdef class Rigidbody: ret.thisptr = new CppAtomSelection(new_sel) return ret - def CA(self): + def get_CA(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.CA() + cdef CppAtomSelection new_sel = self.thisptr.get_CA() ret.thisptr = new CppAtomSelection(new_sel) return ret diff --git a/headers/BasePair.h b/headers/BasePair.h index 7c6f5fc..348af30 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -68,7 +68,7 @@ namespace PTools /// return the i-th Atom of the basePair Atom operator[] (uint i) const { if (i>=this->Size()) throw std::range_error("DNA: array out of bounds"); - return rigbody.CopyAtom(i);}; + return rigbody.copy_atom(i);}; private: //atribut diff --git a/headers/DNA.h b/headers/DNA.h index ba3a3a8..9b23e32 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -44,7 +44,7 @@ namespace PTools void WritePDB(std::string); ///change the database use for the BasePair. the new database must contain the same names for pdb that the old one. - void ChangeRepresentation(std::string); + void change_representation(std::string); ///apply a Matrix/Movement to a specified BasePair. you can specify an anchor void apply_local(const Matrix&,int posMov, int posAnchor = 0); @@ -68,9 +68,9 @@ namespace PTools Parameter GetLocalParameter(int pos); ///return a Rigidbody of the DNA() - Rigidbody CreateRigid(); + Rigidbody create_rigid(); ///return a Rigidbody of the strand - Rigidbody CreateRigidOfStrand(std::string chain); + Rigidbody create_rigidOfStrand(std::string chain); //replace the base pair at the indicated position by the new base pair @@ -99,7 +99,7 @@ namespace PTools void Replace(const DNA & d,int start); ///change the type of the base pair at position pos to the indicated type using the coresponding structure in the designed database of pdb. - void ChangeType(int pos, std::string type, std::string filename ); + void change_type(int pos, std::string type, std::string filename ); diff --git a/headers/atom.h b/headers/atom.h index fcd7830..8a12db2 100644 --- a/headers/atom.h +++ b/headers/atom.h @@ -88,13 +88,13 @@ struct Atom : public Atomproperty /// distance between two atoms -inline dbl Dist(const Atom& at1, const Atom& at2) +inline dbl dist(const Atom& at1, const Atom& at2) { return Norm(at1.coords-at2.coords); } /// distance**2 between two atoms -inline dbl Dist2(const Atom& at1, const Atom& at2) +inline dbl dist2(const Atom& at1, const Atom& at2) { return Norm2(at1.coords - at2.coords ); } diff --git a/headers/atomselection.h b/headers/atomselection.h index b2a6015..189b437 100644 --- a/headers/atomselection.h +++ b/headers/atomselection.h @@ -36,11 +36,11 @@ class AtomSelection{ /// return the i-th atom of the list Atom operator[] (uint i) const { if (i>=this->Size()) throw std::range_error("AtomSelection: array out of bounds"); - return m_rigid->CopyAtom(m_list[i]);}; + return m_rigid->copy_atom(m_list[i]);}; - Atom CopyAtom(uint i) const {return m_rigid->CopyAtom(m_list[i]);} + Atom copy_atom(uint i) const {return m_rigid->copy_atom(m_list[i]);} void add_atomIndex(int i) {m_list.push_back(i);}; ///< adds an Atom index - Rigidbody CreateRigid(); ///< makes a new rigid copy (independant copy) from an AtomsSelection object. + Rigidbody create_rigid(); ///< makes a new rigid copy (independant copy) from an AtomsSelection object. AtomSelection non(const AtomSelection& atsel); diff --git a/headers/rigidbody.h b/headers/rigidbody.h index 9b0111d..f731fc1 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -75,7 +75,7 @@ class Rigidbody:private CoordsArray void PrintMatrix() const {std::cout << CoordsArray::PrintMatrix() << std::endl; } /// make a deep copy of one atom (the atom extracted is then totally independent) - virtual Atom CopyAtom(uint i) const ; + virtual Atom copy_atom(uint i) const ; /* /// const version of GetAtom*/ /*Atom GetAtom(uint pos) const @@ -134,7 +134,7 @@ class Rigidbody:private CoordsArray } /// return geometric center of all atoms - Coord3D FindCenter() const; + Coord3D find_center() const; /// center the rigidbody to the Origin (0,0,0) void CenterToOrigin(); @@ -178,7 +178,7 @@ class Rigidbody:private CoordsArray AtomSelection SelectResRange(int start, int stop); /// selection shortcut for C-alpha - AtomSelection CA(); + AtomSelection get_CA(); /// selection of backbone atoms: AtomSelection backbone(); diff --git a/ptools/__init__.py b/ptools/__init__.py index 64e985e..0a7420a 100644 --- a/ptools/__init__.py +++ b/ptools/__init__.py @@ -6,11 +6,11 @@ from _ptools import (ADNA, Atom, AtomPair, AtomSelection, Atomproperty, AttractForceField1, AttractForceField2, AttractPairList, AttractRigidbody, BDNA, BaseAttractForceField, BasePair, - Coord3D, CoordsArray, DNA, Dist, Dist2, Lbfgs, Matrix, + Coord3D, CoordsArray, DNA, dist, dist2, Lbfgs, Matrix, MatTrans2screw, Movement, Rigidbody, Rise, Rmsd, Roll, ScorpionForceField, Screw, Shift, Slide, Superpose_t, Surface, Tilt, Twist, Version, WritePDB, - crossproduct, dotproduct, norm, norm2, strToAtom, + cross_product, dot_product, norm, norm2, strToAtom, superpose) @@ -61,10 +61,10 @@ def rigidToSeq(rigid): This function needs CA atoms to be present. A missing CA atom will result in a missing letter in the sequence. """ - rca = rigid.CA().CreateRigid() # restrict to the CA atoms. + rca = rigid.get_CA().create_rigid() # restrict to the CA atoms. seq = [] for i in range(len(rca)): - at = rca.CopyAtom(i) + at = rca.copy_atom(i) seq.append(one_letter_residue_dict[at.residType]) return "".join(seq) diff --git a/ptools/commands/attract_cmd.py b/ptools/commands/attract_cmd.py index 97d343d..c10ac6c 100644 --- a/ptools/commands/attract_cmd.py +++ b/ptools/commands/attract_cmd.py @@ -84,7 +84,7 @@ def run(args): if args.startconfig: print("Minimize from starting configuration") # Use transnb, rotnb = 0, 0 to indicate this - translations = {0: lig.FindCenter()} + translations = {0: lig.find_center()} rotations = {0: (0, 0, 0)} else: ptools.io.check_file_exists('rotation.dat', "rotation file 'rotation.dat' is required.") diff --git a/ptools/commands/heligeom_cmd.py b/ptools/commands/heligeom_cmd.py index fe41fc4..7dbd310 100644 --- a/ptools/commands/heligeom_cmd.py +++ b/ptools/commands/heligeom_cmd.py @@ -77,7 +77,7 @@ def check_args(args): def distance(a, b): """Calculate the distance between two ptools.Coord3D.""" - return ptools.norm(ptools.crossproduct(a, b)) + return ptools.norm(ptools.cross_product(a, b)) def distAxis(rig, hp): @@ -94,9 +94,9 @@ def getpstart(start, hp, dmin, dmax): # position of the sphere point ap = ptools.Atomproperty() m1 = start - cm = m1.FindCenter() + cm = m1.find_center() v = cm - hp.point - s = ptools.dotproduct(v, hp.unitVector) + s = ptools.dot_product(v, hp.unitVector) p = (hp.point + hp.unitVector * s) # normal to the axis that contains the center of mass of the monomer @@ -118,10 +118,10 @@ def getpstart(start, hp, dmin, dmax): def getpart(groove, n, nbmono): inf = ptools.Rigidbody() for i in xrange(n - 1, n + 3): - inf = inf + groove.SelectChainId(string.ascii_uppercase[i % 26]).CreateRigid() + inf = inf + groove.SelectChainId(string.ascii_uppercase[i % 26]).create_rigid() sup = ptools.Rigidbody() for i in xrange(n - 2 + nbmono, n + 2 + nbmono): - sup = sup + groove.SelectChainId(string.ascii_uppercase[i % 26]).CreateRigid() + sup = sup + groove.SelectChainId(string.ascii_uppercase[i % 26]).create_rigid() return inf, sup @@ -133,7 +133,7 @@ def groove_width_calculation(hp, mono1): O = hp.point axe = hp.unitVector groove = extend(hp, mono1, nbmono * 3, False, False) - start = groove.SelectChainId(string.ascii_uppercase[n]).CreateRigid() + start = groove.SelectChainId(string.ascii_uppercase[n]).create_rigid() dmin, dmax = distAxis(mono1, hp) nb = 0 @@ -152,16 +152,16 @@ def groove_width_calculation(hp, mono1): pstart = getpstart(start, hp, k, k) # get the min dist on the inferior part - mindistinf = ptools.Dist(pstart.CopyAtom(0), inf.CopyAtom(0)) + mindistinf = ptools.dist(pstart.copy_atom(0), inf.copy_atom(0)) for k in xrange(1, infSize): - tempdist = ptools.Dist(pstart.CopyAtom(0), inf.CopyAtom(k)) + tempdist = ptools.dist(pstart.copy_atom(0), inf.copy_atom(k)) if tempdist < mindistinf: mindistinf = tempdist # the same on the superior part - mindistsup = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(0)) + mindistsup = ptools.dist(pstart.copy_atom(0), sup.copy_atom(0)) for k in xrange(1, supSize): - tempdist = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(k)) + tempdist = ptools.dist(pstart.copy_atom(0), sup.copy_atom(k)) if tempdist < mindistsup: mindistsup = tempdist # get the two point on the vector and take the mid size @@ -182,7 +182,7 @@ def changeChain(rig, letter): def extend(hp, mono1, nb, Z=False, seq=False): final = ptools.Rigidbody() - monoTest = mono1.SelectAllAtoms().CreateRigid() + monoTest = mono1.SelectAllAtoms().create_rigid() i = 0 O = hp.point axe = hp.unitVector diff --git a/ptools/commands/translate_cmd.py b/ptools/commands/translate_cmd.py index bba7eeb..5cc406b 100644 --- a/ptools/commands/translate_cmd.py +++ b/ptools/commands/translate_cmd.py @@ -71,7 +71,7 @@ def run(args): rec = ptools.Rigidbody(args.receptor) lig = ptools.Rigidbody(args.ligand) - # Distance to receptor. + # distance to receptor. distance_to_receptor = args.distance_to_receptor or lig.Radius() distance_to_receptor *= args.distance_to_receptor_factor diff --git a/ptools/docking.py b/ptools/docking.py index fc91694..cd7fc9e 100644 --- a/ptools/docking.py +++ b/ptools/docking.py @@ -76,7 +76,7 @@ def surreal(i): def rmsdca(l1, l2): """Return the RMSD between the alpha-carbone atom of two RigidBody instances.""" - return ptools.Rmsd(l1.CA().CreateRigid(), l2.CA().CreateRigid()) + return ptools.Rmsd(l1.get_CA().create_rigid(), l2.get_CA().create_rigid()) def get_group(collection, ngroups, ngroup): @@ -107,7 +107,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, # Use appropriate rmsd calculation if ref is not None: - refca = ref.CA() + refca = ref.get_CA() if len(refca) == 0: # No C alpha atom, ligand is probably a dna rmsd_func = ptools.Rmsd print("No Calpha atom found for ligand (DNA?). RMSD will be " @@ -129,7 +129,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, ligand = ptools.AttractRigidbody(lig) receptor = ptools.AttractRigidbody(rec) - center = ligand.FindCenter() + center = ligand.find_center() ligand.Translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 ligand.euler_rotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) ligand.Translate(trans) @@ -159,7 +159,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, output = ptools.AttractRigidbody(ligand) - center = output.FindCenter() + center = output.find_center() output.Translate(ptools.Coord3D() - center) output.euler_rotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) output.Translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) diff --git a/ptools/reduce.py b/ptools/reduce.py index 9f47777..2dfc1eb 100644 --- a/ptools/reduce.py +++ b/ptools/reduce.py @@ -324,7 +324,7 @@ def read_reduction_parameters(self): def read_topology(self): """Read PDB topology file.""" rb = ptools.Rigidbody(self.allatom_file) - self.atoms = [rb.CopyAtom(i) for i in xrange(len(rb))] + self.atoms = [rb.copy_atom(i) for i in xrange(len(rb))] def read_name_conversion_file(self): """Read YAML file containing residue and atom name conversion rules. diff --git a/src/BasePair.cpp b/src/BasePair.cpp index 5edfc4f..b269dde 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -38,7 +38,7 @@ string BasePair::PrintPDB()const std::string BasePair::PrintPDBofBase(std::string chain) { - return rigbody.SelectChainId(chain).CreateRigid().PrintPDB(); + return rigbody.SelectChainId(chain).create_rigid().PrintPDB(); } void BasePair::SetChainID(){ @@ -89,7 +89,7 @@ Rigidbody BasePair::GetRigidBody()const Rigidbody BasePair::GetRigidBodyOfBase(std::string chain) { - return rigbody.SelectChainId(chain).CreateRigid(); + return rigbody.SelectChainId(chain).create_rigid(); } @@ -129,7 +129,7 @@ uint BasePair::SetAtomNumberOfBase(std::string chain,int num) uint BasePair::GetResIDofBase(std::string chain) { - Atomproperty ap = rigbody.SelectChainId(chain).CreateRigid().GetAtomProperty(0); + Atomproperty ap = rigbody.SelectChainId(chain).create_rigid().GetAtomProperty(0); return ap.residId; } diff --git a/src/DNA.cpp b/src/DNA.cpp index 16e6dee..38b13c2 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -160,8 +160,8 @@ bool DNA::IsJumna ( Rigidbody& model) if (sel.Size() == 0) sel = model.SelectAtomType("GS1"); - double d1 = Dist(sel[0],sel[sel.Size()-1]); - double d2 = Dist(sel[0],sel[sel.Size()/2]); + double d1 = dist(sel[0],sel[sel.Size()-1]); + double d2 = dist(sel[0],sel[sel.Size()/2]); return (d1>d2); } @@ -333,7 +333,7 @@ Rigidbody DNA::DelSingleBase (Rigidbody& model) { if ( solution[i]==1) { - newModel= newModel + model.SelectResRange(i,i).CreateRigid(); + newModel= newModel + model.SelectResRange(i,i).create_rigid(); } } //cout << newModel.PrintPDB()<< endl; @@ -383,7 +383,7 @@ bool DNA::IsAlign(std::string s1,std::string s2,int shift)const Rigidbody DNA::GetModelOfBasePair( Rigidbody& model,int posA,int posB) { - return (model.SelectResRange(posA, posA)|model.SelectResRange(posB, posB)).CreateRigid(); + return (model.SelectResRange(posA, posA)|model.SelectResRange(posB, posB)).create_rigid(); } @@ -437,7 +437,7 @@ vector DNA::BuildVbase(string chainIDs, Rigidbody& dataBase)const for (unsigned int i = 0; i < chainIDsSize ; i++) { - vbase.push_back(dataBase.SelectChainId(chainIDs.substr(i,1)).CreateRigid()); + vbase.push_back(dataBase.SelectChainId(chainIDs.substr(i,1)).create_rigid()); } return vbase; } @@ -581,22 +581,22 @@ void DNA::WritePDB(std::string fileName) myfile.close(); } -Rigidbody DNA::CreateRigid() +Rigidbody DNA::create_rigid() { - //we use the method createRigidOfStrand() to make sure that the rigidbody returned follow the established format - Rigidbody chainA = CreateRigidOfStrand("A"); - Rigidbody chainB = CreateRigidOfStrand("B"); + //we use the method create_rigidOfStrand() to make sure that the rigidbody returned follow the established format + Rigidbody chainA = create_rigidOfStrand("A"); + Rigidbody chainB = create_rigidOfStrand("B"); //we add the atoms of the chain B to the chainA unsigned int chainBsize = chainB.Size(); for ( unsigned int i =0; i < chainBsize ; i++ ) { - chainA.add_atom(chainB.CopyAtom(i)); + chainA.add_atom(chainB.copy_atom(i)); } return chainA; } -Rigidbody DNA::CreateRigidOfStrand(std::string chain) +Rigidbody DNA::create_rigidOfStrand(std::string chain) { Rigidbody dna; unsigned int strandSize = strand.size(); @@ -616,14 +616,14 @@ Rigidbody DNA::CreateRigidOfStrand(std::string chain) unsigned int basePairSize = basePair.Size(); for (unsigned int j=0; j Size(); i++) { - Atom at = m_rigid->CopyAtom(m_list[i]); + Atom at = m_rigid->copy_atom(m_list[i]); newrigid.add_atom(at); } diff --git a/src/attractforcefield.cpp b/src/attractforcefield.cpp index 72da094..d65e501 100644 --- a/src/attractforcefield.cpp +++ b/src/attractforcefield.cpp @@ -699,7 +699,7 @@ void BaseAttractForceField::addLigand(AttractRigidbody & lig) setDummyTypeList(lig); // sets the dummy atom type. (virtual function customized for each Attract forcefield) AttractRigidbody centeredlig = lig ; - Coord3D com = lig.FindCenter(); + Coord3D com = lig.find_center(); m_ligcenter.push_back(com); m_movedligand.push_back(lig); diff --git a/src/mcopff.cpp b/src/mcopff.cpp index ac847fb..64b79a3 100644 --- a/src/mcopff.cpp +++ b/src/mcopff.cpp @@ -17,7 +17,7 @@ Mcoprigid::Mcoprigid() void Mcoprigid::setMain(AttractRigidbody& main) { _main=main; - _center = _main.FindCenter(); + _center = _main.find_center(); }; diff --git a/src/pdbio.cpp b/src/pdbio.cpp index c043bf9..38cc782 100644 --- a/src/pdbio.cpp +++ b/src/pdbio.cpp @@ -205,7 +205,7 @@ void WritePDB(const Rigidbody& rigid, std::string filename) const char * chainID="A" ; - Atom at = rigid.CopyAtom(i); + Atom at = rigid.copy_atom(i); const char* atomname=at._pdbAtomType.c_str(); const char* residName=at.residType.c_str(); int residnumber = at.residId; diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index ba8f7b8..c320a80 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -66,7 +66,7 @@ void Rigidbody::add_atom(const Atomproperty& at, Coord3D co) } -Atom Rigidbody::CopyAtom(uint i) const +Atom Rigidbody::copy_atom(uint i) const { Atom at(mAtomProp[i],GetCoords(i)); return at; @@ -98,7 +98,7 @@ void Rigidbody::add_atom(const Atom& at) } -Coord3D Rigidbody::FindCenter() const +Coord3D Rigidbody::find_center() const { Coord3D center(0.0,0.0,0.0); for (uint i=0; i< this->Size() ; i++) @@ -111,13 +111,13 @@ Coord3D Rigidbody::FindCenter() const void Rigidbody::CenterToOrigin() { - Coord3D c = FindCenter(); + Coord3D c = find_center(); Translate(Coord3D()-c); } dbl Rigidbody::RadiusGyration() { - Coord3D c = this->FindCenter(); + Coord3D c = this->find_center(); dbl r=0.0; for (uint i=0; i< this->Size(); i++) { @@ -130,7 +130,7 @@ dbl Rigidbody::RadiusGyration() dbl Rigidbody::Radius() { - Coord3D center = this->FindCenter(); + Coord3D center = this->find_center(); uint size = this->Size(); dbl radius = 0.0; for (uint i=0; i < size; i++) @@ -246,7 +246,7 @@ AtomSelection Rigidbody::SelectResRange(int start, int stop) } -AtomSelection Rigidbody::CA() { +AtomSelection Rigidbody::get_CA() { return SelectAtomType("CA"); } @@ -272,7 +272,7 @@ AtomSelection Rigidbody::backbone() for (uint i=0; iSize(); i++) { - if (isbackbone(CopyAtom(i).atomType) ) + if (isbackbone(copy_atom(i).atomType) ) { newsel.add_atomIndex(i); } diff --git a/src/rmsd.cpp b/src/rmsd.cpp index 64efb19..c3e9df9 100644 --- a/src/rmsd.cpp +++ b/src/rmsd.cpp @@ -35,10 +35,10 @@ dbl Rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) for (uint i=0; i co # coptr = c.thisptr - # self.thisptr.unsafeGetCoords(i, deref(coptr)) + # self.thisptr.unsafeget_coords(i, deref(coptr)) - def unsafeGetCoords(self, int i, Coord3D co): - self.thisptr.unsafeGetCoords(i, deref(co.thisptr)) + def unsafeget_coords(self, int i, Coord3D co): + self.thisptr.unsafeget_coords(i, deref(co.thisptr)) def add_coord(self, Coord3D co): self.thisptr.add_coord( deref(co.thisptr) ) - def GetCoords(self, i, Coord3D co): - self.thisptr.GetCoords(i, deref(co.thisptr)) + def get_coords(self, i, Coord3D co): + self.thisptr.get_coords(i, deref(co.thisptr)) def SetCoords(self, i, Coord3D co): self.thisptr.SetCoords(i, deref(co.thisptr)) diff --git a/bindings/lbfgs.pyx b/bindings/lbfgs.pyx index fee4def..7783c82 100644 --- a/bindings/lbfgs.pyx +++ b/bindings/lbfgs.pyx @@ -5,9 +5,9 @@ cdef extern from "lbfgs_interface.h" namespace "PTools": cdef cppclass CppLbfgs "PTools::Lbfgs": CppLbfgs(CppBaseAttractForceField&) void minimize(int) - vector[double] GetMinimizedVars() - vector[double] GetMinimizedVarsAtIter(int) - int GetNumberIter() + vector[double] get_minimized_vars() + vector[double] get_minimized_vars_at_iter(int) + int get_number_iter() cdef class Lbfgs: @@ -25,18 +25,18 @@ cdef class Lbfgs: def minimize(self, int maxiter): self.thisptr.minimize(maxiter) - def GetMinimizedVars(self): - cdef vector[double] vars = self.thisptr.GetMinimizedVars() + def get_minimized_vars(self): + cdef vector[double] vars = self.thisptr.get_minimized_vars() out = [] for i in xrange(vars.size()): out.append(vars[i]) return out - def GetNumberIter(self): - return self.thisptr.GetNumberIter() + def get_number_iter(self): + return self.thisptr.get_number_iter() - def GetMinimizedVarsAtIter(self, int iter): - cdef vector[double] vars = self.thisptr.GetMinimizedVarsAtIter(iter) + def get_minimized_vars_at_iter(self, int iter): + cdef vector[double] vars = self.thisptr.get_minimized_vars_at_iter(iter) out = [] for i in xrange(vars.size()): out.append(vars[i]) diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index 3ce771e..8bdb182 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -18,8 +18,8 @@ cdef extern from "rigidbody.h" namespace "PTools": CppRigidbody() CppRigidbody(CppRigidbody &) unsigned int Size() - CppCoord3D GetCoords(unsigned int) - void unsafeGetCoords(unsigned int, CppCoord3D &) + CppCoord3D get_coords(unsigned int) + void unsafeget_coords(unsigned int, CppCoord3D &) void SetCoords(unsigned int, CppCoord3D &) void rotate(CppCoord3D &, CppCoord3D &, double) void Translate(CppCoord3D &) @@ -41,7 +41,7 @@ cdef extern from "rigidbody.h" namespace "PTools": # Returns the radius of a Rigidbody (max distance from center). double Radius() - CppAtomproperty & GetAtomProperty(unsigned int) + CppAtomproperty & get_atom_property(unsigned int) void SetAtomProperty(unsigned int, CppAtomproperty &) # AtomSelection: @@ -122,9 +122,9 @@ cdef class Rigidbody: def size(self): return len(self) - def getCoords(self, unsigned int i): + def get_coords(self, unsigned int i): cdef Coord3D c = Coord3D() - cdef CppCoord3D cpp = self.thisptr.GetCoords(i) + cdef CppCoord3D cpp = self.thisptr.get_coords(i) c.x = cpp.x c.y = cpp.y c.z = cpp.z @@ -133,8 +133,8 @@ cdef class Rigidbody: def print_pdb(self): return str(self) - def unsafeGetCoords(self, unsigned int i, Coord3D co): - self.thisptr.unsafeGetCoords(i, deref(co.thisptr)) + def unsafeget_coords(self, unsigned int i, Coord3D co): + self.thisptr.unsafeget_coords(i, deref(co.thisptr)) def setCoords(self, int i, Coord3D co): self.thisptr.SetCoords(i, deref(co.thisptr)) @@ -176,8 +176,8 @@ cdef class Rigidbody: def SetAtom(self, unsigned int position, Atom at): self.thisptr.SetAtom(position, deref(at.thisptr)) - def GetAtomProperty(self, unsigned int position): - cdef CppAtomproperty cppatprop = self.thisptr.GetAtomProperty(position) + def get_atom_property(self, unsigned int position): + cdef CppAtomproperty cppatprop = self.thisptr.get_atom_property(position) cdef Atomproperty pyAtprop = Atomproperty() cdef CppAtomproperty * new_atomprop = new CppAtomproperty(cppatprop) del pyAtprop.thisptr diff --git a/bindings/scorpion_lbfgs.pyx b/bindings/scorpion_lbfgs.pyx index 0ac2a22..61a6d31 100644 --- a/bindings/scorpion_lbfgs.pyx +++ b/bindings/scorpion_lbfgs.pyx @@ -5,9 +5,9 @@ cdef extern from "lbfgs_interface.h" namespace "PTools": cdef cppclass CppScorpionLbfgs "PTools::Lbfgs": CppScorpionLbfgs(CppScorpionForceField&) void minimize(int) - vector[double] GetMinimizedVars() - vector[double] GetMinimizedVarsAtIter(int) - int GetNumberIter() + vector[double] get_minimized_vars() + vector[double] get_minimized_vars_at_iter(int) + int get_number_iter() cdef class ScorpionLbfgs: @@ -25,18 +25,18 @@ cdef class ScorpionLbfgs: def minimize(self, int maxiter): self.thisptr.minimize(maxiter) - def GetMinimizedVars(self): - cdef vector[double] vars = self.thisptr.GetMinimizedVars() + def get_minimized_vars(self): + cdef vector[double] vars = self.thisptr.get_minimized_vars() out = [] for i in xrange(vars.size()): out.append(vars[i]) return out - def GetNumberIter(self): - return self.thisptr.GetNumberIter() + def get_number_iter(self): + return self.thisptr.get_number_iter() - def GetMinimizedVarsAtIter(self, int iter): - cdef vector[double] vars = self.thisptr.GetMinimizedVarsAtIter(iter) + def get_minimized_vars_at_iter(self, int iter): + cdef vector[double] vars = self.thisptr.get_minimized_vars_at_iter(iter) out = [] for i in xrange(vars.size()): out.append(vars[i]) diff --git a/bindings/scorpionforcefield.pyx b/bindings/scorpionforcefield.pyx index 500479e..c05c955 100644 --- a/bindings/scorpionforcefield.pyx +++ b/bindings/scorpionforcefield.pyx @@ -7,7 +7,7 @@ cdef extern from "scorpionforcefield.h" namespace "PTools": CppScorpionForceField(string&, double) void addLigand(CppAttractRigidbody&) double Function(vector[double]&) - double getVdw() + double get_vdw() double getCoulomb() double nonbon8(CppAttractRigidbody& , CppAttractRigidbody& , CppAttractPairList & , int) @@ -39,8 +39,8 @@ cdef class ScorpionForceField: return self.thisptr.Function(v) - def getVdw(self): - return self.thisptr.getVdw() + def get_vdw(self): + return self.thisptr.get_vdw() def getCoulomb(self): return self.thisptr.getCoulomb() diff --git a/bindings/superpose.pyx b/bindings/superpose.pyx index 99317a4..d818007 100644 --- a/bindings/superpose.pyx +++ b/bindings/superpose.pyx @@ -1,7 +1,7 @@ cdef extern from "superpose.h" namespace "PTools": cdef cppSuperpose_t cppsuperpose "PTools::superpose" ( CppRigidbody& ,CppRigidbody& , int ) - cdef CppScrew cppMatTrans2screw "PTools::MatTrans2screw" ( Array2D[double]& ) except + + cdef CppScrew cppmat44_to_screw "PTools::mat44_to_screw" ( Array2D[double]& ) except + cdef extern from "screw.h" namespace "PTools": @@ -67,8 +67,8 @@ def superpose(Rigidbody ref, Rigidbody mob, int verbosity=0): return pysup -def MatTrans2screw(Matrix mat): - cpp_screw = cppMatTrans2screw(deref(mat.thisptr)) +def mat44_to_screw(Matrix mat): + cpp_screw = cppmat44_to_screw(deref(mat.thisptr)) screw = Screw() screw.angle = cpp_screw.angle screw.normtranslation = cpp_screw.normtranslation diff --git a/headers/BasePair.h b/headers/BasePair.h index 348af30..3226d5a 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -37,15 +37,15 @@ namespace PTools void apply(const Matrix&); /// return the Matrix of the BasePair - Matrix GetMatrix()const; + Matrix get_matrix()const; /// return the Movemeny of the BasePair Movement GetMovement()const; /// return the Rigidbody of the BasePair - Rigidbody GetRigidBody()const; + Rigidbody get_rigid()const; /// return the Rigidbody of the specified base (by chain) - Rigidbody GetRigidBodyOfBase(std::string chain); + Rigidbody get_rigidOfBase(std::string chain); /// define the Rigidbody of the BasePair void SetRigidBody(const Rigidbody&); @@ -57,7 +57,7 @@ namespace PTools uint SetAtomNumberOfBase(std::string chain,int); - std::string GetType() const; + std::string get_type() const; void SetType(std::string type); diff --git a/headers/Movement.h b/headers/Movement.h index 9e1d349..7ac16c6 100644 --- a/headers/Movement.h +++ b/headers/Movement.h @@ -30,7 +30,7 @@ namespace PTools void apply(Rigidbody& rigbody)const; ///return the Matrix - const Matrix& GetMatrix() const; + const Matrix& get_matrix() const; ///print the Matrix void Print() const; diff --git a/headers/attractforcefield.h b/headers/attractforcefield.h index 0ca9109..20bb39c 100644 --- a/headers/attractforcefield.h +++ b/headers/attractforcefield.h @@ -60,7 +60,7 @@ class BaseAttractForceField: public ForceField void Rota(uint molIndex, dbl phi, dbl ssi, dbl rot, Vdouble& delta, uint shift, bool print=false); ///return van der waals energy - dbl getVdw(){return m_vdw;} + dbl get_vdw(){return m_vdw;} ///coulomb (electrostatic) energy dbl getCoulomb(){return m_elec;} diff --git a/headers/coordsarray.h b/headers/coordsarray.h index d23848f..1e9e921 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -78,7 +78,7 @@ class CoordsArray _uptodate = true; //modify the function pointer _getcoords to call the "unsafe" method next time (faster) - _getcoords = & CoordsArray::unsafeGetCoords; + _getcoords = & CoordsArray::unsafeget_coords; (*this.* _getcoords)(i, co); //return the correct function }; @@ -92,13 +92,13 @@ class CoordsArray CoordsArray(const CoordsArray & ca); //copy constructor /// get the cached coordinates. You must ensure that update() has been called first ! - void inline unsafeGetCoords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; + void inline unsafeget_coords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; void add_coord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; uint Size() const {return _refcoords.size();}; - void GetCoords(const uint i, Coord3D& co) const throw(std::out_of_range) ; + void get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) ; void SetCoords(const uint k, const Coord3D& co); @@ -112,7 +112,7 @@ class CoordsArray std::string PrintMatrix() const; ///return the rotation/translation matrix - Matrix GetMatrix() const; + Matrix get_matrix() const; diff --git a/headers/lbfgs_interface.h b/headers/lbfgs_interface.h index a149275..ac28810 100644 --- a/headers/lbfgs_interface.h +++ b/headers/lbfgs_interface.h @@ -23,10 +23,10 @@ class Lbfgs Lbfgs(ForceField& toMinim); ~Lbfgs(); void minimize(int maxiter); - std::vector GetMinimizedVars() const {return x;}; + std::vector get_minimized_vars() const {return x;}; - std::vector GetMinimizedVarsAtIter(uint iter); - int GetNumberIter() {return m_opt->niter;} + std::vector get_minimized_vars_at_iter(uint iter); + int get_number_iter() {return m_opt->niter;} diff --git a/headers/rigidbody.h b/headers/rigidbody.h index f731fc1..12bcf42 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -81,13 +81,13 @@ class Rigidbody:private CoordsArray /*Atom GetAtom(uint pos) const { Coord3D co; - CoordsArray::GetCoords(pos, co); + CoordsArray::get_coords(pos, co); Atom at(mAtomProp[pos], co ); return at; }*/ /// return atom properties - Atomproperty const & GetAtomProperty(uint pos) const + Atomproperty const & get_atom_property(uint pos) const { return mAtomProp[pos]; } @@ -108,22 +108,22 @@ class Rigidbody:private CoordsArray void add_atom(const Atom& at); //returns the coordinates of atom i - Coord3D GetCoords(uint i) const + Coord3D get_coords(uint i) const { assert(i4s} {:>6s} {:>6s} {:>13s} {:>13s} {:>13s} {:>13s}".format(' ', 'Trans', 'Rot', 'Ener', 'RmsdCA_ref', "VDW", "Coulomb")) pl = ptools.AttractPairList(receptor, ligand, surreal(500)) - print("{:<4s} {:6d} {:6d} {:13.7f} {:>13s} {:13.7f} {:13.7f}".format("==", transnb, rotnb, forcefield.nonbon8(receptor, ligand, pl), str(rms), forcefield.getVdw(), forcefield.getCoulomb())) + print("{:<4s} {:6d} {:6d} {:13.7f} {:>13s} {:13.7f} {:13.7f}".format("==", transnb, rotnb, forcefield.nonbon8(receptor, ligand, pl), str(rms), forcefield.get_vdw(), forcefield.getCoulomb())) output.PrintMatrix() diff --git a/src/BasePair.cpp b/src/BasePair.cpp index b269dde..e17d0df 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -17,7 +17,7 @@ BasePair::BasePair(std::string filename) { cout << "opening : " << filename << endl; ReadPDB(filename,rigbody); - this->type = rigbody.GetAtomProperty(0).residType; + this->type = rigbody.get_atom_property(0).residType; } @@ -28,7 +28,7 @@ BasePair::BasePair(const Rigidbody& rigbody) throw std::runtime_error("cannot initialize a BasePair with an empty Rigidbody"); } this->rigbody=rigbody; - this->type = rigbody.GetAtomProperty(0).residType; + this->type = rigbody.get_atom_property(0).residType; } string BasePair::PrintPDB()const @@ -45,7 +45,7 @@ void BasePair::SetChainID(){ unsigned int rigSize=rigbody.Size(); for(unsigned int i =0; i< rigSize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.residType == type) { ap.chainId = "A"; @@ -69,25 +69,25 @@ void BasePair::apply(const Matrix& m) apply(Movement (m)); } -Matrix BasePair::GetMatrix() const +Matrix BasePair::get_matrix() const { - return rigbody.GetMatrix(); + return rigbody.get_matrix(); } Movement BasePair::GetMovement()const { - return Movement(GetMatrix()); + return Movement(get_matrix()); } -Rigidbody BasePair::GetRigidBody()const +Rigidbody BasePair::get_rigid()const { return rigbody; } -Rigidbody BasePair::GetRigidBodyOfBase(std::string chain) +Rigidbody BasePair::get_rigidOfBase(std::string chain) { return rigbody.SelectChainId(chain).create_rigid(); } @@ -98,7 +98,7 @@ void BasePair::SetResID(int idA,int idB) unsigned int baseSize=rigbody.Size(); for(unsigned int i =0; i< baseSize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == "A") { ap.residId = idA; @@ -116,7 +116,7 @@ uint BasePair::SetAtomNumberOfBase(std::string chain,int num) unsigned int baseSize=rigbody.Size(); for(unsigned int i =0; i< baseSize ; i++) { - Atomproperty ap=rigbody.GetAtomProperty(i); + Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == chain) { ap.atomId = num; @@ -129,7 +129,7 @@ uint BasePair::SetAtomNumberOfBase(std::string chain,int num) uint BasePair::GetResIDofBase(std::string chain) { - Atomproperty ap = rigbody.SelectChainId(chain).create_rigid().GetAtomProperty(0); + Atomproperty ap = rigbody.SelectChainId(chain).create_rigid().get_atom_property(0); return ap.residId; } @@ -139,7 +139,7 @@ void BasePair::SetRigidBody(const Rigidbody& rigbody) this->rigbody=rigbody; } -string BasePair::GetType() const { +string BasePair::get_type() const { return type; } diff --git a/src/DNA.cpp b/src/DNA.cpp index 38b13c2..b36da11 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -88,7 +88,7 @@ void DNA::PlaceBasePairs( Rigidbody& model) Matrix DNA::GetMatBetwenBasePair( Rigidbody& modelOfBasePair,int pos) { Parameter param =Parameter(); - Rigidbody secondAxis = strand[pos].GetRigidBody(); + Rigidbody secondAxis = strand[pos].get_rigid(); Superpose_t sup =superpose (param.BuildAxisCentered(modelOfBasePair), param.BuildAxisCentered( secondAxis ) ); return sup.matrix; } @@ -97,7 +97,7 @@ Matrix DNA::GetMatBetwenBasePair( Rigidbody& modelOfBasePair,int pos) void DNA::RenumberModel (Rigidbody& model) { - unsigned int tempId = model.GetAtomProperty(0).residId; + unsigned int tempId = model.get_atom_property(0).residId; string chain; unsigned int nbRes=0; unsigned int second = 0; @@ -116,7 +116,7 @@ void DNA::RenumberModel (Rigidbody& model) chain = "A"; for (unsigned int i =0; i < modelSize; i++ ) { - Atomproperty ap=model.GetAtomProperty(i); + Atomproperty ap=model.get_atom_property(i); unsigned int Id = ap.residId; if ( tempId != Id ) { @@ -607,11 +607,11 @@ Rigidbody DNA::create_rigidOfStrand(std::string chain) Rigidbody basePair; if (chain == "B" || chain == "b") { - basePair = strand[strandSize-1-i].GetRigidBodyOfBase(chain); + basePair = strand[strandSize-1-i].get_rigidOfBase(chain); } else { - basePair = strand[i].GetRigidBodyOfBase(chain); + basePair = strand[i].get_rigidOfBase(chain); } unsigned int basePairSize = basePair.Size(); for (unsigned int j=0; j 0) { - bp.apply(matrixMultiply(strand[strand.size()-1].GetMatrix(),mov.GetMatrix())); + bp.apply(matrixMultiply(strand[strand.size()-1].get_matrix(),mov.get_matrix())); } - else bp.apply(mov.GetMatrix()); + else bp.apply(mov.get_matrix()); strand.push_back(bp); this->ChangeFormat(); } @@ -834,7 +834,7 @@ DNA DNA::SubDNA(uint start, uint end)const } DNA newdna = DNA(); - newdna.add(strand[start],Movement(strand[start].GetMatrix())); + newdna.add(strand[start],Movement(strand[start].get_matrix())); for (uint i=start+1; iGetLocalMatrix(i))); @@ -847,7 +847,7 @@ void DNA::Replace(const DNA & d,int start) DNA preDNA = this->SubDNA(0,start); DNA postDNA =this->SubDNA(start+d.Size(),this->Size()); - Movement initMov = Movement(strand[0].GetMatrix()); + Movement initMov = Movement(strand[0].get_matrix()); strand.clear(); @@ -860,7 +860,7 @@ void DNA::Replace(const DNA & d,int start) void DNA::change_type(int pos, std::string type, std::string filename) { Rigidbody dataBase = Rigidbody(filename); - Movement mov = Movement(strand[pos].GetMatrix()); + Movement mov = Movement(strand[pos].get_matrix()); strand[pos] = BasePair(dataBase.SelectChainId(type).create_rigid()); strand[pos].apply(mov); @@ -873,7 +873,7 @@ void DNA::Translate(Coord3D coord) unsigned int strandSize = strand.size(); for (unsigned int i=0; i & vCat, std::vector& vC for (uint i=0; im_activeAtoms[i]; - Coord3D coords = pLigCentered->GetCoords(atomIndex); + Coord3D coords = pLigCentered->get_coords(atomIndex); X = coords.x; Y = coords.y; Z = coords.z; diff --git a/src/coordsarray.cpp b/src/coordsarray.cpp index d1a6789..88a3f87 100644 --- a/src/coordsarray.cpp +++ b/src/coordsarray.cpp @@ -117,7 +117,7 @@ std::string CoordsArray::PrintMatrix() const } -Matrix CoordsArray::GetMatrix() const +Matrix CoordsArray::get_matrix() const { Matrix matrix(4,4); @@ -131,13 +131,13 @@ return matrix; -void CoordsArray::GetCoords(const uint i, Coord3D& co) const throw(std::out_of_range) +void CoordsArray::get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) { if (i>=Size()) { std::stringstream ss (std::stringstream::in | std::stringstream::out); - ss << "CoordsArray::GetCoords : out of range : "; + ss << "CoordsArray::get_coords : out of range : "; ss << i << " is out of bounds (object size: " << Size() << ")\n"; std::string message = ss.str() ; std::cerr << message ; diff --git a/src/minimizers/lbfgs_interface.cpp b/src/minimizers/lbfgs_interface.cpp index a658d95..0a206ff 100644 --- a/src/minimizers/lbfgs_interface.cpp +++ b/src/minimizers/lbfgs_interface.cpp @@ -195,7 +195,7 @@ void Lbfgs::minimize(int maxiter) -std::vectorLbfgs::GetMinimizedVarsAtIter(uint iter) +std::vectorLbfgs::get_minimized_vars_at_iter(uint iter) { if (iter>=m_vars_over_time.size()) { diff --git a/src/pairlist.cpp b/src/pairlist.cpp index a0ca6b7..060eab6 100644 --- a/src/pairlist.cpp +++ b/src/pairlist.cpp @@ -83,8 +83,8 @@ void AttractPairList::update() uint j=activerec[jj]; - Coord3D c1 = mp_ligand->GetCoords(i) ; - Coord3D c2 = mp_receptor->GetCoords(j); + Coord3D c1 = mp_ligand->get_coords(i) ; + Coord3D c2 = mp_receptor->get_coords(j); if (Norm2(c1-c2) <= squarecutoff) { vectl.push_back(i); diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index c320a80..396b6cb 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -68,7 +68,7 @@ void Rigidbody::add_atom(const Atomproperty& at, Coord3D co) Atom Rigidbody::copy_atom(uint i) const { - Atom at(mAtomProp[i],GetCoords(i)); + Atom at(mAtomProp[i],get_coords(i)); return at; } @@ -103,7 +103,7 @@ Coord3D Rigidbody::find_center() const Coord3D center(0.0,0.0,0.0); for (uint i=0; i< this->Size() ; i++) { - center = center + GetCoords(i); + center = center + get_coords(i); } return ( (1.0/(dbl)this->Size())*center); } @@ -121,7 +121,7 @@ dbl Rigidbody::RadiusGyration() dbl r=0.0; for (uint i=0; i< this->Size(); i++) { - r += Norm2( c - this->GetCoords(i) ); + r += Norm2( c - this->get_coords(i) ); } dbl result = sqrt( r/ (double) this->Size() ); @@ -135,7 +135,7 @@ dbl Rigidbody::Radius() dbl radius = 0.0; for (uint i=0; i < size; i++) { - dbl rad=Norm(center - this->GetCoords(i)); + dbl rad=Norm(center - this->get_coords(i)); if (radius < rad) {radius=rad;} } return radius; @@ -286,7 +286,7 @@ AtomSelection Rigidbody::backbone() Rigidbody Rigidbody::operator+(const Rigidbody& rig) { Rigidbody rigFinal(*this); for (uint i=0; i< rig.Size() ; i++) { - rigFinal.add_coord(rig.GetCoords(i)); + rigFinal.add_coord(rig.get_coords(i)); rigFinal.mAtomProp.push_back(rig.mAtomProp[i]); } return rigFinal; @@ -307,10 +307,10 @@ std::string Rigidbody::PrintPDB() const std::string output; for (uint i=0; i < size-1 ; i++) { - Atom at(mAtomProp[i], this->GetCoords(i)); + Atom at(mAtomProp[i], this->get_coords(i)); output = output + at.ToPdbString() + "\n" ; } - Atom at(mAtomProp[size-1], this->GetCoords(size-1)); + Atom at(mAtomProp[size-1], this->get_coords(size-1)); output += at.ToPdbString(); // append the last pdb string, without "\n" diff --git a/src/scorpionforcefield.cpp b/src/scorpionforcefield.cpp index c27fa72..0860c9b 100644 --- a/src/scorpionforcefield.cpp +++ b/src/scorpionforcefield.cpp @@ -131,7 +131,7 @@ dbl ScorpionForceField::nonbon8_forces(AttractRigidbody& rec, AttractRigidbody& dbl sumElectrostatic=0.0; - //synchronize coordinates for using unsafeGetCoords + //synchronize coordinates for using unsafeget_coords rec.syncCoords(); lig.syncCoords(); @@ -152,8 +152,8 @@ dbl ScorpionForceField::nonbon8_forces(AttractRigidbody& rec, AttractRigidbody& dbl eij = m_epsij[ rAtomCat ][ lAtomCat ]; - lig.unsafeGetCoords(jl,a); - rec.unsafeGetCoords(ir,b); + lig.unsafeget_coords(jl,a); + rec.unsafeget_coords(ir,b); Coord3D dx = a-b ; dbl r2 = Norm2(dx); diff --git a/src/superpose.cpp b/src/superpose.cpp index 4afbb3d..90ce0e0 100644 --- a/src/superpose.cpp +++ b/src/superpose.cpp @@ -131,7 +131,7 @@ void Rotate(Rigidbody& rigid, Mat33 mat) for (uint i=0; i Date: Thu, 27 Jul 2017 17:42:25 +0200 Subject: [PATCH 13/22] rename P-R --- NAMES_TXN | 52 ++++++++++++++++---------------- Tests/__init__.py | 2 +- Tests/cpp/ptoolstest.h | 14 ++++----- Tests/functional/test_reduce.py | 6 ++-- Tests/heligeom/test_heligeom.py | 6 ++-- Tests/test_dna.py | 8 ++--- Tests/test_misc.py | 32 ++++++++++---------- Tests/test_rigidbody.py | 8 ++--- Tests/test_superpose.py | 2 +- bindings/attractrigidbody.pyx | 18 +++++------ bindings/dna.pyx | 6 ++-- bindings/rigidbody.pyx | 16 +++++----- bindings/rmsd.pyx | 10 +++--- bindings/surface.pyx | 6 ++-- headers/BasePair.h | 4 +-- headers/DNA.h | 8 ++--- headers/coordsarray.h | 2 +- headers/rigidbody.h | 8 ++--- headers/rmsd.h | 2 +- headers/surface.h | 2 +- ptools/__init__.py | 2 +- ptools/commands/reduce_cmd.py | 2 +- ptools/commands/translate_cmd.py | 4 +-- ptools/docking.py | 8 ++--- ptools/exceptions.py | 4 +-- ptools/reduce.py | 4 +-- src/BasePair.cpp | 8 ++--- src/DNA.cpp | 20 ++++++------ src/coordsarray.cpp | 2 +- src/rigidbody.cpp | 6 ++-- src/rmsd.cpp | 4 +-- src/superpose.cpp | 2 +- src/surface.cpp | 2 +- 33 files changed, 140 insertions(+), 140 deletions(-) diff --git a/NAMES_TXN b/NAMES_TXN index be543fa..e720d91 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -16,35 +16,35 @@ # createRigid create_rigid # CreateRigid create_rigid # crossproduct cross_product -## Dist2( dist2( +## Dist2 dist2 # Dist dist # dotproduct dot_product # FindCenter find_center -GetAtomProperty get_atom_property -GetChainId get_chainid -getCoords get_coords -GetCoords get_coords -GetMatrix get_matrix -GetMinimizedVarsAtIter get_minimized_vars_at_iter -GetMinimizedVars get_minimized_vars -GetNumberIter get_number_iter -GetResidId get_resid -GetRigidBody get_rigid -getStructure get_structure -GetType get_type -getVdw get_vdw -MatTrans2screw mat44_to_screw -# PrintMatrix( print_matrix( -# PrintParam( print_param( -# PrintPDB( print_pdb( -# Print( print( -# RadiusGyration radius_of_gyration( -# Radius( radius( -# Reducer( reducer( -# Reduce( reduce( -# removeclosest remove_closest( -# rigidXMat44( rigidXMat44_CHANGEMANUALLY( -# Rmsd( rmsd( +# GetAtomProperty get_atom_property +# GetChainId get_chainid +# getCoords get_coords +# GetCoords get_coords +# GetMatrix get_matrix +# GetMinimizedVarsAtIter get_minimized_vars_at_iter +# GetMinimizedVars get_minimized_vars +# GetNumberIter get_number_iter +# GetResidId get_resid +# GetRigidBody get_rigid +# getStructure get_structure +# GetType get_type +# getVdw get_vdw +# MatTrans2screw mat44_to_screw +PrintMatrix print_matrix +PrintParam print_param +PrintPDB print_pdb +### Print print +RadiusGyration radius_of_gyration +Radius radius +## Reducer reducer +Reduce reduce +removeclosest remove_closest +# rigidXMat44 rigidXMat44_CHANGEMANUALLY +Rmsd rmsd # SelectAllAtoms( select_all_atoms( # SelectAtomID( select_atomid( # SelectAtomType( select_atomtype( diff --git a/Tests/__init__.py b/Tests/__init__.py index 32ca961..2f13182 100644 --- a/Tests/__init__.py +++ b/Tests/__init__.py @@ -58,7 +58,7 @@ # --------------------------------------------------------------------------- # -# Reduce test files +# reduce test files # # --------------------------------------------------------------------------- TEST_REDUCE_DATA_DIR = os.path.join(TEST_DATA_DIR, 'reduce') diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index e345d58..bc3f3ae 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -134,12 +134,12 @@ Rigidbody rigid1, rigid2, rigid3; rigid3=Rigidbody(rigid2); } - void testBasicRmsd() + void testBasicrmsd() { Rigidbody rigtmp(rigid1); - TS_ASSERT_EQUALS(Rmsd(rigid1, rigid1), 0.0); + TS_ASSERT_EQUALS(rmsd(rigid1, rigid1), 0.0); rigid1.Translate(Coord3D(4,0,0)); - TS_ASSERT_EQUALS(Rmsd(rigtmp, rigid1), 4); + TS_ASSERT_EQUALS(rmsd(rigtmp, rigid1), 4); } void testTranslation1() @@ -150,7 +150,7 @@ Rigidbody rigid1, rigid2, rigid3; Coord3D diff=CoM2-CoM1; TS_ASSERT( Norm2(diff + Coord3D(-3.0, 55.67, -1.0)) < 1e-6); rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)); //# translate back - TS_ASSERT(Rmsd(rigid1, rigid2) < 1e-6); + TS_ASSERT(rmsd(rigid1, rigid2) < 1e-6); } void testTranslation2(){ @@ -159,7 +159,7 @@ Rigidbody rigid1, rigid2, rigid3; rigid2.Translate(vec1+vec2); rigid2.Translate(vec1-vec2); rigid2.Translate(Coord3D() - 2*vec1) ; // #should be a global null translation + round error - TS_ASSERT(Rmsd(rigid2, rigid3) < 1e-6); + TS_ASSERT(rmsd(rigid2, rigid3) < 1e-6); } @@ -285,7 +285,7 @@ Rigidbody prot1; Superpose_t sup = superpose(prot1,prot2); //# superpose(reference, mobile) Matrix matrix = sup.matrix; prot2.apply_matrix(matrix); - TS_ASSERT(Rmsd(prot2,prot1)<1e-6); + TS_ASSERT(rmsd(prot2,prot1)<1e-6); } @@ -341,7 +341,7 @@ class TestRot: public CxxTest::TestSuite Superpose_t s = superpose(r1,r2); r2.apply_matrix(s.matrix); - TS_ASSERT( Rmsd(r1,r2) < 1e-4 ); + TS_ASSERT( rmsd(r1,r2) < 1e-4 ); } diff --git a/Tests/functional/test_reduce.py b/Tests/functional/test_reduce.py index 36681bc..464b46e 100644 --- a/Tests/functional/test_reduce.py +++ b/Tests/functional/test_reduce.py @@ -17,7 +17,7 @@ TEST_LIGAND_RED_SCORPION_CGOPT) -class TestReduceAttract1(unittest.TestCase): +class TestreduceAttract1(unittest.TestCase): def setUp(self): self.output_file = mk_tmp_file() @@ -33,7 +33,7 @@ def test_reduce_attract1(self): self.assertTrue(filecmp.cmp(TEST_LIGAND_RED_ATTRACT1, self.output_name)) -class TestReduceAttract2(unittest.TestCase): +class TestreduceAttract2(unittest.TestCase): def setUp(self): self.output_file = mk_tmp_file() @@ -49,7 +49,7 @@ def test_reduce_attract2(self): self.assertTrue(filecmp.cmp(TEST_LIGAND_RED_ATTRACT2, self.output_name)) -class TestReduceScorpion(unittest.TestCase): +class TestreduceScorpion(unittest.TestCase): def setUp(self): self.output_file = mk_tmp_file() diff --git a/Tests/heligeom/test_heligeom.py b/Tests/heligeom/test_heligeom.py index bd461e8..4b525c6 100644 --- a/Tests/heligeom/test_heligeom.py +++ b/Tests/heligeom/test_heligeom.py @@ -26,7 +26,7 @@ class TestHeligeom(unittest.TestCase): def testGenerateBDNA(self): dna = DNA(TEST_BP_PDB, "AAAAAATCGATCTATC", ADNA()) # tout atom - result = dna.PrintPDB() + result = dna.print_pdb() expected = open(TEST_BDNA_EXPECTED_PDB).read() self.assertEqual(result, expected) @@ -56,14 +56,14 @@ def testBasicManipulation(self): # change to a All Atom representation dna.change_representation(TEST_BP_PDB) - result = dna.PrintPDB() + result = dna.print_pdb() with open(TEST_BASIC_MANIP_EXPECTED_PDB, 'rt') as f: expected = f.read() self.assertEqual(result, expected) def testCGfromPDBFile(self): dna = DNA(TEST_BP_PDB, TEST_BDNA_EXPECTED_PDB) # gros grain - result = dna.PrintPDB() + result = dna.print_pdb() expected = open(TEST_CG_FROM_PDBFILE_EXPECTED_PDB).read() self.assertEqual(result, expected) diff --git a/Tests/test_dna.py b/Tests/test_dna.py index d44489e..a7e01ab 100644 --- a/Tests/test_dna.py +++ b/Tests/test_dna.py @@ -38,8 +38,8 @@ def test_has_SubDNA(self): def test_has_change_representation(self): self.assertTrue(hasattr(DNA, 'change_representation')) - def test_has_PrintPDB(self): - self.assertTrue(hasattr(DNA, 'PrintPDB')) + def test_has_print_pdb(self): + self.assertTrue(hasattr(DNA, 'print_pdb')) class TestDNA(unittest.TestCase): @@ -81,8 +81,8 @@ def test_change_representation(self): warnings.warn("only check the call, not the result") self.dna.change_representation(PDB_BASE_PAIR2) - def test_PrintPDB(self): - s = self.dna.PrintPDB() + def test_print_pdb(self): + s = self.dna.print_pdb() self.assertNotEqual(s, '') diff --git a/Tests/test_misc.py b/Tests/test_misc.py index 82eeb76..d3b94d8 100644 --- a/Tests/test_misc.py +++ b/Tests/test_misc.py @@ -5,7 +5,7 @@ import math import unittest -from ptools import Rigidbody, Coord3D, Atom, Atomproperty, norm2, Rmsd +from ptools import Rigidbody, Coord3D, Atom, Atomproperty, norm2, rmsd from . import TEST_LIGAND_PDB @@ -16,31 +16,31 @@ def setUp(self): self.rigid2 = Rigidbody(self.rigid1) self.rigid3 = Rigidbody(self.rigid2) - def testBasicRmsd(self): + def testBasicrmsd(self): rigtmp = Rigidbody(self.rigid1) - self.assertEqual(Rmsd(self.rigid1, self.rigid1), 0.0) + self.assertEqual(rmsd(self.rigid1, self.rigid1), 0.0) self.rigid1.Translate(Coord3D(4, 0, 0)) - self.assertEqual(Rmsd(rigtmp, self.rigid1), 4) + self.assertEqual(rmsd(rigtmp, self.rigid1), 4) - def testErrorsRmsd(self): + def testErrorsrmsd(self): rigid1 = Rigidbody() rigid2 = Rigidbody() # cannot calculate an rmsd on an empty object - self.assertRaises(ValueError, Rmsd, rigid1, rigid2) + self.assertRaises(ValueError, rmsd, rigid1, rigid2) # check input paramter types: - self.assertRaises(RuntimeError, Rmsd, self.rigid1, "hello") - self.assertRaises(RuntimeError, Rmsd, "hello", self.rigid1) + self.assertRaises(RuntimeError, rmsd, self.rigid1, "hello") + self.assertRaises(RuntimeError, rmsd, "hello", self.rigid1) - def testRmsdAtomSelection1(self): - # tests Rmsd with an AtomSelection object + def testrmsdAtomSelection1(self): + # tests rmsd with an AtomSelection object atsel = self.rigid1.SelectAllAtoms() - self.assertEqual(Rmsd(atsel, self.rigid2), 0) + self.assertEqual(rmsd(atsel, self.rigid2), 0) - def testRmsdAtomSelection2(self): - # tests Rmsd with an AtomSelection object + def testrmsdAtomSelection2(self): + # tests rmsd with an AtomSelection object atsel = self.rigid1.SelectAllAtoms() - self.assertEqual(Rmsd(self.rigid2, atsel), 0) + self.assertEqual(rmsd(self.rigid2, atsel), 0) def testTranslation1(self): CoM1 = self.rigid1.find_center() @@ -49,7 +49,7 @@ def testTranslation1(self): diff = CoM2 - CoM1 self.assertAlmostEqual(norm2(diff + Coord3D(-3.0, 55.67, -1.0)), 0.0) self.rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)) # translate back - self.assertAlmostEqual(Rmsd(self.rigid1, self.rigid2), 0.0) + self.assertAlmostEqual(rmsd(self.rigid1, self.rigid2), 0.0) def testTranslation2(self): vec1 = Coord3D(-123.54, 45.62, -99.003) @@ -57,7 +57,7 @@ def testTranslation2(self): self.rigid2.Translate(vec1 + vec2) self.rigid2.Translate(vec1 - vec2) self.rigid2.Translate(Coord3D() - 2 * vec1) # should be a global null translation + round error - self.assertAlmostEqual(Rmsd(self.rigid2, self.rigid3), 0) + self.assertAlmostEqual(rmsd(self.rigid2, self.rigid3), 0) class TestRotations(unittest.TestCase): diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index ca994d7..2660b9b 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -65,11 +65,11 @@ def test_Rigidbody_has_get_atom_property(self): def test_Rigidbody_has_SetAtomProperty(self): self.assertTrue(hasattr(Rigidbody, 'SetAtomProperty')) - def test_Rigidbody_has_Radius(self): - self.assertTrue(hasattr(Rigidbody, 'Radius')) + def test_Rigidbody_has_radius(self): + self.assertTrue(hasattr(Rigidbody, 'radius')) - def test_Rigidbody_has_RadiusGyration(self): - self.assertTrue(hasattr(Rigidbody, 'RadiusGyration')) + def test_Rigidbody_has_radius_of_gyration(self): + self.assertTrue(hasattr(Rigidbody, 'radius_of_gyration')) def test_Rigidbody_has_SelectAllAtoms(self): self.assertTrue(hasattr(Rigidbody, 'SelectAllAtoms')) diff --git a/Tests/test_superpose.py b/Tests/test_superpose.py index 8249aa2..4a7349a 100644 --- a/Tests/test_superpose.py +++ b/Tests/test_superpose.py @@ -53,7 +53,7 @@ def testTransRot(self): sup = ptools.superpose(self.prot1, prot2) # superpose(reference, mobile) matrix = sup.matrix prot2.apply_matrix(matrix) - self.assertAlmostEqual(ptools.Rmsd(prot2, self.prot1), 0.0) + self.assertAlmostEqual(ptools.rmsd(prot2, self.prot1), 0.0) if __name__ == '__main__': diff --git a/bindings/attractrigidbody.pyx b/bindings/attractrigidbody.pyx index 520735c..35c79a9 100644 --- a/bindings/attractrigidbody.pyx +++ b/bindings/attractrigidbody.pyx @@ -26,12 +26,12 @@ cdef extern from "attractrigidbody.h" namespace "PTools": #returns radius of gyration - double RadiusGyration() + double radius_of_gyration() #returns the radius of a Rigidbody (max distance from center) - double Radius() + double radius() - void PrintMatrix() + void print_matrix() CppAtomSelection get_CA() @@ -130,15 +130,15 @@ cdef class AttractRigidbody (Rigidbody) : #these function should be defined only in Rigdibody object and attractrigdbody should inherit from it:œ - def Radius(self): - return self.thisptr.Radius() + def radius(self): + return self.thisptr.radius() - def RadiusGyration(self): - return self.thisptr.RadiusGyration() + def radius_of_gyration(self): + return self.thisptr.radius_of_gyration() - def PrintMatrix(self): - ( self.thisptr).PrintMatrix() + def print_matrix(self): + ( self.thisptr).print_matrix() def get_CA(self): ret = AtomSelection() diff --git a/bindings/dna.pyx b/bindings/dna.pyx index 990ae9f..3794a5e 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -17,7 +17,7 @@ cdef extern from "DNA.h" namespace "PTools": void change_type(int, string, string) void apply_local(const CppMovement&, int) void change_representation(string) - string PrintPDB() + string print_pdb() cdef class DNA: @@ -97,5 +97,5 @@ cdef class DNA: def change_representation(self, bytes rep): self.thisptr.change_representation(rep) - def PrintPDB(self): - return self.thisptr.PrintPDB() + def print_pdb(self): + return self.thisptr.print_pdb() diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index 8bdb182..d44f968 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -31,15 +31,15 @@ cdef extern from "rigidbody.h" namespace "PTools": void add_atom(CppAtomproperty &, CppCoord3D) void add_atom(CppAtom &) void SetAtom(unsigned int, CppAtom &) - string PrintPDB() + string print_pdb() CppRigidbody operator+(CppRigidbody &) void CenterToOrigin() # Returns radius of gyration. - double RadiusGyration() + double radius_of_gyration() # Returns the radius of a Rigidbody (max distance from center). - double Radius() + double radius() CppAtomproperty & get_atom_property(unsigned int) void SetAtomProperty(unsigned int, CppAtomproperty &) @@ -107,7 +107,7 @@ cdef class Rigidbody: return self.thisptr.Size() def __str__(self): - s = self.thisptr.PrintPDB() + s = self.thisptr.print_pdb() return s def __add__(Rigidbody self, Rigidbody other): @@ -189,11 +189,11 @@ cdef class Rigidbody: raise IndexError('atom index out of bounds') self.thisptr.SetAtomProperty(position, deref(prop.thisptr)) - def Radius(self): - return self.thisptr.Radius() + def radius(self): + return self.thisptr.radius() - def RadiusGyration(self): - return self.thisptr.RadiusGyration() + def radius_of_gyration(self): + return self.thisptr.radius_of_gyration() def SelectAllAtoms(self): ret = AtomSelection() diff --git a/bindings/rmsd.pyx b/bindings/rmsd.pyx index 8c44944..e443f3d 100644 --- a/bindings/rmsd.pyx +++ b/bindings/rmsd.pyx @@ -1,9 +1,9 @@ cdef extern from "rmsd.h" namespace "PTools": - cdef double CppRmsd "PTools::Rmsd" (CppRigidbody& r1, CppRigidbody& r2) except +ValueError - cdef double CppRmsd "PTools::Rmsd" (CppAtomSelection & r1, CppAtomSelection& r2) except +ValueError + cdef double Cpprmsd "PTools::rmsd" (CppRigidbody& r1, CppRigidbody& r2) except +ValueError + cdef double Cpprmsd "PTools::rmsd" (CppAtomSelection & r1, CppAtomSelection& r2) except +ValueError -def Rmsd(r1, r2): +def rmsd(r1, r2): """calculates the RMSD between two objects (either Rigibody or AtomSelection). This function does NOT perform superposition before the calculation""" @@ -41,7 +41,7 @@ def Rmsd(r1, r2): del_er2 = True else: raise RuntimeError("second argument should be an AtomSelection or a Rigidbody") - rmsd = CppRmsd(deref(er1), deref(er2)) + rmsd = Cpprmsd(deref(er1), deref(er2)) if del_er1: del er1 @@ -52,7 +52,7 @@ def Rmsd(r1, r2): #cdef CppRigidbody* er1 = r1.thisptr #cdef CppRigidbody* er2 = r2.thisptr - #return CppRmsd(deref(er1), deref(er2)) + #return Cpprmsd(deref(er1), deref(er2)) \ No newline at end of file diff --git a/bindings/surface.pyx b/bindings/surface.pyx index 5394c33..64808c5 100644 --- a/bindings/surface.pyx +++ b/bindings/surface.pyx @@ -8,7 +8,7 @@ cdef extern from "surface.h" namespace "PTools": CppRigidbody surfpoint(CppRigidbody & , double) void surfpointParams(int, double) CppRigidbody outergrid(CppRigidbody &, CppRigidbody & , double) - CppRigidbody removeclosest(CppRigidbody & , double) + CppRigidbody remove_closest(CppRigidbody & , double) void readsolvparam(string) @@ -43,8 +43,8 @@ cdef class Surface: ret.thisptr = new CppRigidbody(r) return ret - def removeclosest(self, Rigidbody rigid1, double srad): - cdef CppRigidbody r = self.thisptr.removeclosest(deref(rigid1.thisptr), srad) + def remove_closest(self, Rigidbody rigid1, double srad): + cdef CppRigidbody r = self.thisptr.remove_closest(deref(rigid1.thisptr), srad) ret = Rigidbody() del ret.thisptr ret.thisptr = new CppRigidbody(r) diff --git a/headers/BasePair.h b/headers/BasePair.h index 3226d5a..df08367 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -23,10 +23,10 @@ namespace PTools virtual ~BasePair() {} ///return a string containing the atoms data following the PDB format - std::string PrintPDB() const; + std::string print_pdb() const; ///return a string containing the atoms data of a base (identified by its chain) following the PDB format - std::string PrintPDBofBase(std::string chain) ; + std::string print_pdbofBase(std::string chain) ; ///change the chainID of the internal bases to 'A' for the first base (coresponding to the type) and 'B' for the second one void SetChainID(); diff --git a/headers/DNA.h b/headers/DNA.h index 9b23e32..8bc1b53 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -32,13 +32,13 @@ namespace PTools unsigned int AtomSize() const; ///return a string containing the atoms data following the PDB format - std::string PrintPDB() ; + std::string print_pdb() ; ///return a string containing the atoms data following the PDB format - std::string PrintPDBofStrand( std::string chain ); + std::string print_pdbofStrand( std::string chain ); ///return a string containing all the local parameter formated - std::string PrintParam(); + std::string print_param(); ///write in a file the atoms data following the PDB format void WritePDB(std::string); @@ -78,7 +78,7 @@ namespace PTools /// return the RMSD between two DNA (not aligning them and assuming they are comparable) - double Rmsd(const DNA&)const; + double rmsd(const DNA&)const; ///------edition functions------ diff --git a/headers/coordsarray.h b/headers/coordsarray.h index 1e9e921..0b109d4 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -109,7 +109,7 @@ class CoordsArray void ResetMatrix(); - std::string PrintMatrix() const; + std::string print_matrix() const; ///return the rotation/translation matrix Matrix get_matrix() const; diff --git a/headers/rigidbody.h b/headers/rigidbody.h index 12bcf42..1fa69de 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -72,7 +72,7 @@ class Rigidbody:private CoordsArray uint Size() const {return CoordsArray::Size();}; - void PrintMatrix() const {std::cout << CoordsArray::PrintMatrix() << std::endl; } + void print_matrix() const {std::cout << CoordsArray::print_matrix() << std::endl; } /// make a deep copy of one atom (the atom extracted is then totally independent) virtual Atom copy_atom(uint i) const ; @@ -154,13 +154,13 @@ class Rigidbody:private CoordsArray /// returns radius of gyration - dbl RadiusGyration(); + dbl radius_of_gyration(); /// returns the radius of a Rigidbody (max distance from center) - dbl Radius(); + dbl radius(); /// converts rigidbody to classical PDB-like string - std::string PrintPDB() const ; + std::string print_pdb() const ; /// selection : complete AtomSelection SelectAllAtoms() const; diff --git a/headers/rmsd.h b/headers/rmsd.h index d6a7fa3..121b1c0 100644 --- a/headers/rmsd.h +++ b/headers/rmsd.h @@ -15,7 +15,7 @@ namespace PTools { /// root mean square deviation without superposition -dbl Rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2); +dbl rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2); } diff --git a/headers/surface.h b/headers/surface.h index f2b1007..0e4420b 100644 --- a/headers/surface.h +++ b/headers/surface.h @@ -28,7 +28,7 @@ class Surface Rigidbody surfpoint(const Rigidbody & rigid, dbl srad); /// generate a grid of point around the protein void surfpointParams(int max, dbl shift); /// initialize some parameters of the grid generation Rigidbody outergrid(const Rigidbody & grid, const Rigidbody & rigid2, dbl rad); /// remove overlap between rigid1 and rigid2 - Rigidbody removeclosest(const Rigidbody & rigid1, dbl srad); /// fix the density of the grid (remove points that are too close to eachother) + Rigidbody remove_closest(const Rigidbody & rigid1, dbl srad); /// fix the density of the grid (remove points that are too close to eachother) void readsolvparam(const std::string& file); /// read solvation parameters private: diff --git a/ptools/__init__.py b/ptools/__init__.py index a10f63f..09f36ca 100644 --- a/ptools/__init__.py +++ b/ptools/__init__.py @@ -7,7 +7,7 @@ AttractForceField1, AttractForceField2, AttractPairList, AttractRigidbody, BDNA, BaseAttractForceField, BasePair, Coord3D, CoordsArray, DNA, dist, dist2, Lbfgs, Matrix, - mat44_to_screw, Movement, Rigidbody, Rise, Rmsd, Roll, + mat44_to_screw, Movement, Rigidbody, Rise, rmsd, Roll, ScorpionForceField, Screw, Shift, Slide, Superpose_t, Surface, Tilt, Twist, Version, WritePDB, cross_product, dot_product, norm, norm2, strToAtom, diff --git a/ptools/commands/reduce_cmd.py b/ptools/commands/reduce_cmd.py index 1056ffc..05bc690 100644 --- a/ptools/commands/reduce_cmd.py +++ b/ptools/commands/reduce_cmd.py @@ -112,7 +112,7 @@ def run(args): ptools.io.check_file_exists(convname) ptools.io.check_file_exists(atomicname) - reducer = ptools.reduce.Reducer(atomicname, redname) + reducer = ptools.reduce.reducer(atomicname, redname) reducer.name_conversion_file = convname # Convert exception list of names as list of classes. diff --git a/ptools/commands/translate_cmd.py b/ptools/commands/translate_cmd.py index 6d8122a..d5b2a0e 100644 --- a/ptools/commands/translate_cmd.py +++ b/ptools/commands/translate_cmd.py @@ -72,7 +72,7 @@ def run(args): lig = ptools.Rigidbody(args.ligand) # distance to receptor. - distance_to_receptor = args.distance_to_receptor or lig.Radius() + distance_to_receptor = args.distance_to_receptor or lig.radius() distance_to_receptor *= args.distance_to_receptor_factor # Initialize surface. @@ -84,7 +84,7 @@ def run(args): # Remove points too clore from the receptor. outergrid = surf.outergrid(grid, rec, distance_to_receptor) - outergrid = surf.removeclosest(outergrid, args.density) + outergrid = surf.remove_closest(outergrid, args.density) # Generate output PDB. if args.output: diff --git a/ptools/docking.py b/ptools/docking.py index 6860939..1cb02a1 100644 --- a/ptools/docking.py +++ b/ptools/docking.py @@ -76,7 +76,7 @@ def surreal(i): def rmsdca(l1, l2): """Return the RMSD between the alpha-carbone atom of two RigidBody instances.""" - return ptools.Rmsd(l1.get_CA().create_rigid(), l2.get_CA().create_rigid()) + return ptools.rmsd(l1.get_CA().create_rigid(), l2.get_CA().create_rigid()) def get_group(collection, ngroups, ngroup): @@ -109,7 +109,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, if ref is not None: refca = ref.get_CA() if len(refca) == 0: # No C alpha atom, ligand is probably a dna - rmsd_func = ptools.Rmsd + rmsd_func = ptools.rmsd print("No Calpha atom found for ligand (DNA?). RMSD will be " "calculated on all grains") else: @@ -184,7 +184,7 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, # calculates true energy, and rmsd if possible # with the new ligand position forcefield = ff_specs['ff_class'](ff_specs['ff_file'], surreal(500)) - print("{:>4s} {:>6s} {:>6s} {:>13s} {:>13s} {:>13s} {:>13s}".format(' ', 'Trans', 'Rot', 'Ener', 'RmsdCA_ref', "VDW", "Coulomb")) + print("{:>4s} {:>6s} {:>6s} {:>13s} {:>13s} {:>13s} {:>13s}".format(' ', 'Trans', 'Rot', 'Ener', 'rmsdCA_ref', "VDW", "Coulomb")) pl = ptools.AttractPairList(receptor, ligand, surreal(500)) print("{:<4s} {:6d} {:6d} {:13.7f} {:>13s} {:13.7f} {:13.7f}".format("==", transnb, rotnb, forcefield.nonbon8(receptor, ligand, pl), str(rms), forcefield.get_vdw(), forcefield.getCoulomb())) - output.PrintMatrix() + output.print_matrix() diff --git a/ptools/exceptions.py b/ptools/exceptions.py index 94237b4..2bf2200 100644 --- a/ptools/exceptions.py +++ b/ptools/exceptions.py @@ -113,7 +113,7 @@ def duplicate_atoms(self): return [name for name, count in counter.items() if count > 1] -class IgnoredAtomsInReducedResidueError(ResidueReductionError): +class IgnoredAtomsInreducedResidueError(ResidueReductionError): """Exception raised when an atom from all-atom model has not been used in the coarse grain model. @@ -134,7 +134,7 @@ def __init__(self, residue): self.bead_atom_names = [atom.atomType for bead in residue.beads for atom in bead.atoms] - super(IgnoredAtomsInReducedResidueError, self).__init__(residue.resname, residue.resid) + super(IgnoredAtomsInreducedResidueError, self).__init__(residue.resname, residue.resid) @property def unused_atoms(self): diff --git a/ptools/reduce.py b/ptools/reduce.py index 2dfc1eb..ae2099c 100644 --- a/ptools/reduce.py +++ b/ptools/reduce.py @@ -156,7 +156,7 @@ def topdb(self): return '\n'.join(b.topdb() for b in self.beads) -class Reducer(object): +class reducer(object): """Class that handle reduction from an atomistic topology to a coarse grain model. @@ -191,7 +191,7 @@ class Reducer(object): """ def __init__(self, topology_file, reduction_parameters_file): - """Initialize Reduce from topology file and reduction parameter file. + """Initialize reduce from topology file and reduction parameter file. Args: topology_file (str): path to all-atom topology file (PDB format). diff --git a/src/BasePair.cpp b/src/BasePair.cpp index e17d0df..b92e315 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -31,14 +31,14 @@ BasePair::BasePair(const Rigidbody& rigbody) this->type = rigbody.get_atom_property(0).residType; } -string BasePair::PrintPDB()const +string BasePair::print_pdb()const { - return rigbody.PrintPDB (); + return rigbody.print_pdb (); } -std::string BasePair::PrintPDBofBase(std::string chain) +std::string BasePair::print_pdbofBase(std::string chain) { - return rigbody.SelectChainId(chain).create_rigid().PrintPDB(); + return rigbody.SelectChainId(chain).create_rigid().print_pdb(); } void BasePair::SetChainID(){ diff --git a/src/DNA.cpp b/src/DNA.cpp index b36da11..851111f 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -336,7 +336,7 @@ Rigidbody DNA::DelSingleBase (Rigidbody& model) newModel= newModel + model.SelectResRange(i,i).create_rigid(); } } - //cout << newModel.PrintPDB()<< endl; + //cout << newModel.print_pdb()<< endl; RenumberModel (newModel); @@ -537,31 +537,31 @@ unsigned int DNA::AtomSize() const } -string DNA::PrintPDB() +string DNA::print_pdb() { string strandA, strandB; unsigned int strandSize = strand.size(); for ( unsigned int i =0; i < strandSize ; i++ ) { - strandA += strand[i].PrintPDBofBase("A") + "\n"; - strandB += strand[strandSize-1-i].PrintPDBofBase("B") + "\n"; + strandA += strand[i].print_pdbofBase("A") + "\n"; + strandB += strand[strandSize-1-i].print_pdbofBase("B") + "\n"; } string out= strandA + strandB; return out.substr(0,out.size()-1); } -std::string DNA::PrintPDBofStrand( std::string chain ) +std::string DNA::print_pdbofStrand( std::string chain ) { string out; unsigned int strandSize = strand.size(); for ( unsigned int i =0; i < strandSize ; i++ ) { - out += strand[i].PrintPDBofBase( chain ); + out += strand[i].print_pdbofBase( chain ); } return out.substr(0,out.size()-1); } -string DNA::PrintParam() +string DNA::print_param() { stringstream ss; unsigned int strandSize = strand.size(); @@ -577,7 +577,7 @@ void DNA::WritePDB(std::string fileName) { ofstream myfile; myfile.open(fileName.c_str()); - myfile << PrintPDB(); + myfile << print_pdb(); myfile.close(); } @@ -750,14 +750,14 @@ void DNA::apply(const Matrix& m) } -double DNA::Rmsd(const DNA& model)const +double DNA::rmsd(const DNA& model)const { double aSize=AtomSize(); if (model.AtomSize() != aSize) { std::cerr << "Error: trying to superpose two DNA of different sizes" << std::endl ; - throw std::invalid_argument("RmsdSizesDiffers"); + throw std::invalid_argument("rmsdSizesDiffers"); } double total = 0.0; diff --git a/src/coordsarray.cpp b/src/coordsarray.cpp index 88a3f87..eb936f2 100644 --- a/src/coordsarray.cpp +++ b/src/coordsarray.cpp @@ -95,7 +95,7 @@ void CoordsArray::ResetMatrix() -std::string CoordsArray::PrintMatrix() const +std::string CoordsArray::print_matrix() const { std::string out; out += "### MAT BEGIN\n"; diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index 396b6cb..916b0ee 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -115,7 +115,7 @@ void Rigidbody::CenterToOrigin() Translate(Coord3D()-c); } -dbl Rigidbody::RadiusGyration() +dbl Rigidbody::radius_of_gyration() { Coord3D c = this->find_center(); dbl r=0.0; @@ -128,7 +128,7 @@ dbl Rigidbody::RadiusGyration() return result; } -dbl Rigidbody::Radius() +dbl Rigidbody::radius() { Coord3D center = this->find_center(); uint size = this->Size(); @@ -300,7 +300,7 @@ void Rigidbody::rotate(const Coord3D& A, const Coord3D& B, dbl theta) -std::string Rigidbody::PrintPDB() const +std::string Rigidbody::print_pdb() const { uint size=this->Size(); diff --git a/src/rmsd.cpp b/src/rmsd.cpp index c3e9df9..2f69128 100644 --- a/src/rmsd.cpp +++ b/src/rmsd.cpp @@ -18,7 +18,7 @@ namespace PTools { -dbl Rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) +dbl rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) { if (atsel1.Size() == 0 || atsel2.Size() == 0) { @@ -27,7 +27,7 @@ dbl Rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) if (atsel1.Size() != atsel2.Size()) { - throw std::invalid_argument("RmsdSizesDiffers"); + throw std::invalid_argument("rmsdSizesDiffers"); } dbl sum = 0.0; diff --git a/src/superpose.cpp b/src/superpose.cpp index 90ce0e0..acc25c8 100644 --- a/src/superpose.cpp +++ b/src/superpose.cpp @@ -491,7 +491,7 @@ Superpose_t superpose(const Rigidbody& ref, const Rigidbody& mob, int verbosity) Rigidbody probe(mob); probe.apply_matrix(output); - sup.rmsd = Rmsd(ref,probe); + sup.rmsd = rmsd(ref,probe); return sup; diff --git a/src/surface.cpp b/src/surface.cpp index 159c46b..0369398 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -198,7 +198,7 @@ Rigidbody Surface::outergrid(const Rigidbody & grid, const Rigidbody & rigid2, d return rigid3; } -Rigidbody Surface::removeclosest(const Rigidbody & rigid, dbl srad) +Rigidbody Surface::remove_closest(const Rigidbody & rigid, dbl srad) { int const size=rigid.Size(); From 3bb1e6d01d79b0efa972ced1e0d27baa77045885 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 17:45:59 +0200 Subject: [PATCH 14/22] rename S --- NAMES_TXN | 60 ++++---- Tests/cpp/cxxtest/ErrorFormatter.h | 10 +- Tests/cpp/cxxtest/TestRunner.h | 8 +- Tests/cpp/cxxtest/TestSuite.cpp | 10 +- Tests/cpp/cxxtest/TestSuite.h | 4 +- Tests/cpp/cxxtest/Win32Gui.h | 2 +- Tests/cpp/cxxtest/X11Gui.h | 4 +- Tests/cpp/ptoolstest.h | 22 +-- Tests/heligeom/test_heligeom.py | 10 +- Tests/test_atomselection.py | 34 ++--- Tests/test_attract_misc.py | 8 +- Tests/test_attractforcefield.py | 4 +- Tests/test_basepair.py | 10 +- Tests/test_coordsarray.py | 6 +- Tests/test_dna.py | 20 +-- Tests/test_misc.py | 4 +- Tests/test_rigidbody.py | 62 ++++----- bindings/atomselection.pyx | 10 +- bindings/attractforcefield.pyx | 2 +- bindings/attractrigidbody.pyx | 24 ++-- bindings/basepair.pyx | 8 +- bindings/coordsarray.pyx | 14 +- bindings/dna.pyx | 10 +- bindings/pairlist.pyx | 6 +- bindings/rigidbody.pyx | 58 ++++---- bindings/surface.pyx | 6 +- headers/BasePair.h | 8 +- headers/DNA.h | 6 +- headers/atomselection.h | 6 +- headers/attractforcefield.h | 8 +- headers/attractrigidbody.h | 6 +- headers/coordsarray.h | 4 +- headers/forcefield.h | 2 +- headers/mcopff.h | 2 +- headers/pairlist.h | 2 +- headers/rigidbody.h | 26 ++-- headers/surface.h | 2 +- ptools/commands/heligeom_cmd.py | 18 +-- ptools/commands/translate_cmd.py | 2 +- ptools/docking.py | 6 +- src/BasePair.cpp | 30 ++-- src/DNA.cpp | 212 ++++++++++++++--------------- src/Parameter.cpp | 34 ++--- src/Stacking.cpp | 30 ++-- src/atomselection.cpp | 8 +- src/attractforcefield.cpp | 26 ++-- src/attractrigidbody.cpp | 8 +- src/coordsarray.cpp | 6 +- src/forcefield.cpp | 4 +- src/mcopff.cpp | 16 +-- src/minimizers/lbfgs_interface.cpp | 2 +- src/pairlist.cpp | 8 +- src/pdbio.cpp | 2 +- src/rigidbody.cpp | 60 ++++---- src/rmsd.cpp | 10 +- src/scorpionforcefield.cpp | 10 +- src/superpose.cpp | 16 +-- src/surface.cpp | 12 +- 58 files changed, 504 insertions(+), 504 deletions(-) diff --git a/NAMES_TXN b/NAMES_TXN index e720d91..02ffa69 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -34,37 +34,37 @@ # GetType get_type # getVdw get_vdw # MatTrans2screw mat44_to_screw -PrintMatrix print_matrix -PrintParam print_param -PrintPDB print_pdb +# PrintMatrix print_matrix +# PrintParam print_param +# PrintPDB print_pdb ### Print print -RadiusGyration radius_of_gyration -Radius radius -## Reducer reducer -Reduce reduce -removeclosest remove_closest -# rigidXMat44 rigidXMat44_CHANGEMANUALLY -Rmsd rmsd -# SelectAllAtoms( select_all_atoms( -# SelectAtomID( select_atomid( -# SelectAtomType( select_atomtype( -# SelectChainId( select_chainid( -# SelectResidType( select_restype( -# SelectResRange select_resid_range( -# SetAtomProperty( set_atom_property( -# SetAtom( set_atom( -# SetChainId( set_chainid( -# setCoords( set_coords( -# SetCoords( set_coords( -# setdefault( set_default( -# SetResidId( set_resid( -# SetRestraint( set_restraint( -# SetRigid( set_rigid( -# setRotation( set_rotation( -# setTranslation( set_translation( -# Size( size( -# surfpointParams( surfpoint_params( -# syncCoords( sync_coords( +# RadiusGyration radius_of_gyration +# Radius radius +# ## Reducer reducer +# Reduce reduce +# removeclosest remove_closest +# # rigidXMat44 rigidXMat44_CHANGEMANUALLY +# Rmsd rmsd +SelectAllAtoms select_all_atoms +SelectAtomID select_atomid +SelectAtomType select_atomtype +SelectChainId select_chainid +SelectResidType select_restype +SelectResRange select_resid_range +SetAtomProperty set_atom_property +SetAtom set_atom +SetChainId set_chainid +setCoords set_coords +SetCoords set_coords +setdefault set_default +SetResidId set_resid +SetRestraint set_restraint +SetRigid set_rigid +setRotation set_rotation +setTranslation set_translation +Size size +surfpointParams surfpoint_params +syncCoords sync_coords # toatom( to_atom( # ToPdbString( to_pdb_string( # toString( to_string( diff --git a/Tests/cpp/cxxtest/ErrorFormatter.h b/Tests/cpp/cxxtest/ErrorFormatter.h index 968c310..cfc0713 100644 --- a/Tests/cpp/cxxtest/ErrorFormatter.h +++ b/Tests/cpp/cxxtest/ErrorFormatter.h @@ -252,15 +252,15 @@ namespace CxxTest void dumpBuffer( const void *buffer, unsigned size ) { - unsigned dumpSize = size; - if ( maxDumpSize() && dumpSize > maxDumpSize() ) - dumpSize = maxDumpSize(); + unsigned dumpsize = size; + if ( maxDumpsize() && dumpsize > maxDumpsize() ) + dumpsize = maxDumpsize(); const unsigned char *p = (const unsigned char *)buffer; (*_o) << " { "; - for ( unsigned i = 0; i < dumpSize; ++ i ) + for ( unsigned i = 0; i < dumpsize; ++ i ) (*_o) << byteToHex( *p++ ) << " "; - if ( dumpSize < size ) + if ( dumpsize < size ) (*_o) << "... "; (*_o) << "}" << endl; } diff --git a/Tests/cpp/cxxtest/TestRunner.h b/Tests/cpp/cxxtest/TestRunner.h index 43f0832..7bd2819 100644 --- a/Tests/cpp/cxxtest/TestRunner.h +++ b/Tests/cpp/cxxtest/TestRunner.h @@ -82,7 +82,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH bool _abortTestOnFail; #endif // _CXXTEST_HAVE_EH - unsigned _maxDumpSize; + unsigned _maxDumpsize; public: StateGuard() @@ -90,7 +90,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH _abortTestOnFail = abortTestOnFail(); #endif // _CXXTEST_HAVE_EH - _maxDumpSize = maxDumpSize(); + _maxDumpsize = maxDumpsize(); } ~StateGuard() @@ -98,7 +98,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( _abortTestOnFail ); #endif // _CXXTEST_HAVE_EH - setMaxDumpSize( _maxDumpSize ); + setMaxDumpsize( _maxDumpsize ); } }; @@ -110,7 +110,7 @@ namespace CxxTest #ifdef _CXXTEST_HAVE_EH setAbortTestOnFail( CXXTEST_DEFAULT_ABORT ); #endif // _CXXTEST_HAVE_EH - setMaxDumpSize( CXXTEST_MAX_DUMP_SIZE ); + setMaxDumpsize( CXXTEST_MAX_DUMP_SIZE ); } }; }; diff --git a/Tests/cpp/cxxtest/TestSuite.cpp b/Tests/cpp/cxxtest/TestSuite.cpp index bc14c2c..ac04f9c 100644 --- a/Tests/cpp/cxxtest/TestSuite.cpp +++ b/Tests/cpp/cxxtest/TestSuite.cpp @@ -38,16 +38,16 @@ namespace CxxTest // // Max dump size // - static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE; + static unsigned currentMaxDumpsize = CXXTEST_MAX_DUMP_SIZE; - unsigned maxDumpSize() + unsigned maxDumpsize() { - return currentMaxDumpSize; + return currentMaxDumpsize; } - void setMaxDumpSize( unsigned value ) + void setMaxDumpsize( unsigned value ) { - currentMaxDumpSize = value; + currentMaxDumpsize = value; } // diff --git a/Tests/cpp/cxxtest/TestSuite.h b/Tests/cpp/cxxtest/TestSuite.h index fc5a206..137f5df 100644 --- a/Tests/cpp/cxxtest/TestSuite.h +++ b/Tests/cpp/cxxtest/TestSuite.h @@ -33,8 +33,8 @@ namespace CxxTest bool abortTestOnFail(); void setAbortTestOnFail( bool value = CXXTEST_DEFAULT_ABORT ); - unsigned maxDumpSize(); - void setMaxDumpSize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); + unsigned maxDumpsize(); + void setMaxDumpsize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); void doTrace( const char *file, unsigned line, const char *message ); void doWarn( const char *file, unsigned line, const char *message ); diff --git a/Tests/cpp/cxxtest/Win32Gui.h b/Tests/cpp/cxxtest/Win32Gui.h index a071914..898750a 100644 --- a/Tests/cpp/cxxtest/Win32Gui.h +++ b/Tests/cpp/cxxtest/Win32Gui.h @@ -161,7 +161,7 @@ namespace CxxTest void registerWindowClass() { - _windowClass.cbSize = sizeof(_windowClass); + _windowClass.cbsize = sizeof(_windowClass); _windowClass.style = CS_HREDRAW | CS_VREDRAW; _windowClass.lpfnWndProc = &(Win32Gui::windowProcedure); _windowClass.cbClsExtra = 0; diff --git a/Tests/cpp/cxxtest/X11Gui.h b/Tests/cpp/cxxtest/X11Gui.h index f14431d..5e5ed32 100644 --- a/Tests/cpp/cxxtest/X11Gui.h +++ b/Tests/cpp/cxxtest/X11Gui.h @@ -251,14 +251,14 @@ namespace CxxTest void redraw() { - getWindowSize(); + getWindowsize(); drawSolidBar(); drawDividers(); drawPercentage(); flush(); } - void getWindowSize() + void getWindowsize() { XWindowAttributes attributes; XGetWindowAttributes( _display, _window, &attributes ); diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index bc3f3ae..96c3e4d 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -71,20 +71,20 @@ Coord3D A, B; void testCopy() { s = Rigidbody(r); - TS_ASSERT_EQUALS(s.Size(), r.Size()) + TS_ASSERT_EQUALS(s.size(), r.size()) TS_ASSERT_EQUALS(r.find_center(), s.find_center()); } - void testSize() - { TS_ASSERT_EQUALS(r.Size(), 2365); + void testsize() + { TS_ASSERT_EQUALS(r.size(), 2365); } - void testSetAtom() + void testset_atom() { Atom atom (r.copy_atom(3) ) ; atom.coords = Coord3D(3,4,5); - r.SetAtom(3,atom); + r.set_atom(3,atom); //#test to see if the mofification worked: Atom atom2 = r.copy_atom(3); TS_ASSERT( Norm2(atom2.coords - Coord3D(3,4,5) ) < 1e6 ); @@ -105,10 +105,10 @@ Coord3D A, B; r.Translate(Coord3D(34.23, 123.45,11.972)); r2.Translate(Coord3D(34.23, 123.45,11.972)); - r2.syncCoords(); + r2.sync_coords(); // #same rotation and translation for r and r2: should have exact same coordinates - for (int i=0; iself.thisptr).getCharge(atomid) - #void setRotation(bool) - def setRotation(self, flag): - ( self.thisptr).setRotation(flag) + #void set_rotation(bool) + def set_rotation(self, flag): + ( self.thisptr).set_rotation(flag) - #void setTranslation(bool) - def setTranslation(self, flag): - ( self.thisptr).setTranslation(flag) + #void set_translation(bool) + def set_translation(self, flag): + ( self.thisptr).set_translation(flag) def isAtomActive(self, atomid): return ( self.thisptr).isAtomActive(atomid) @@ -102,12 +102,12 @@ cdef class AttractRigidbody (Rigidbody) : ( self.thisptr).resetForces() - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() #define also the __len__ method: def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def find_center(self): diff --git a/bindings/basepair.pyx b/bindings/basepair.pyx index 28086ce..520534e 100644 --- a/bindings/basepair.pyx +++ b/bindings/basepair.pyx @@ -5,7 +5,7 @@ cdef extern from "BasePair.h" namespace "PTools": CppBasePair(CppRigidbody&) CppBasePair(CppBasePair&) CppRigidbody get_rigid() - unsigned int Size() + unsigned int size() cdef class BasePair: @@ -30,10 +30,10 @@ cdef class BasePair: self.thisptr = 0 def __len__(self): - return self.Size() + return self.size() - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() def get_rigid(self): # Get a pointer to the RigidBody. diff --git a/bindings/coordsarray.pyx b/bindings/coordsarray.pyx index e60394d..10c965d 100644 --- a/bindings/coordsarray.pyx +++ b/bindings/coordsarray.pyx @@ -4,9 +4,9 @@ cdef extern from "coordsarray.h" namespace "PTools": CppCoordsArray( CppCoordsArray & ) void unsafeget_coords(unsigned int , CppCoord3D& ) void add_coord(CppCoord3D& co) - unsigned int Size() + unsigned int size() void get_coords(unsigned int, CppCoord3D&) - void SetCoords(unsigned int, CppCoord3D&) + void set_coords(unsigned int, CppCoord3D&) void Translate(CppCoord3D&) void euler_rotate(double , double, double) @@ -23,11 +23,11 @@ cdef class CoordsArray: self.thisptr = new CppCoordsArray() def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() - def Size(self): + def size(self): print "Depreciated, use len(obj) instead" - return self.thisptr.Size() + return self.thisptr.size() #def unsafeget_coords(self, int i, Coord3D co): # cdef Coord3D c @@ -46,8 +46,8 @@ cdef class CoordsArray: def get_coords(self, i, Coord3D co): self.thisptr.get_coords(i, deref(co.thisptr)) - def SetCoords(self, i, Coord3D co): - self.thisptr.SetCoords(i, deref(co.thisptr)) + def set_coords(self, i, Coord3D co): + self.thisptr.set_coords(i, deref(co.thisptr)) def Translate(self, Coord3D co): self.thisptr.Translate(deref(co.thisptr)) diff --git a/bindings/dna.pyx b/bindings/dna.pyx index 3794a5e..6242011 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -9,7 +9,7 @@ cdef extern from "DNA.h" namespace "PTools": CppDNA(string&, string&) #with default value for third parameter CppDNA SubDNA(int, int) CppBasePair operator[](int) - unsigned int Size() + unsigned int size() void add(CppBasePair, const CppMovement &) void add(CppBasePair) void add(CppDNA, const CppMovement &) @@ -45,10 +45,10 @@ cdef class DNA: self.thisptr = 0 def __len__(self): - return self.Size() + return self.size() def __getitem__(self, unsigned int i): - if i>=self.thisptr.Size(): + if i>=self.thisptr.size(): raise IndexError bp = BasePair() if bp.thisptr: @@ -57,8 +57,8 @@ cdef class DNA: bp.thisptr = new CppBasePair(deref(self.thisptr)[i]) return bp - def Size(self): - return self.thisptr.Size() + def size(self): + return self.thisptr.size() def SubDNA(self, int start, int end): ret = DNA() diff --git a/bindings/pairlist.pyx b/bindings/pairlist.pyx index 79f6fbf..6fb20c0 100644 --- a/bindings/pairlist.pyx +++ b/bindings/pairlist.pyx @@ -51,7 +51,7 @@ cdef extern from "pairlist.h" namespace "PTools": CppAttractPairList() CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody &, double ) CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody & ) - int Size() + int size() CppAtomPair operator[](int) @@ -82,10 +82,10 @@ cdef class AttractPairList: def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def __getitem__(self, unsigned int i): - if i>=self.thisptr.Size(): + if i>=self.thisptr.size(): raise IndexError cdef CppAtomPair * catp = new CppAtomPair(deref(self.thisptr)[i]) atp = AtomPair() diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index d44f968..64d7c55 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -17,20 +17,20 @@ cdef extern from "rigidbody.h" namespace "PTools": CppRigidbody(string) except+ CppRigidbody() CppRigidbody(CppRigidbody &) - unsigned int Size() + unsigned int size() CppCoord3D get_coords(unsigned int) void unsafeget_coords(unsigned int, CppCoord3D &) - void SetCoords(unsigned int, CppCoord3D &) + void set_coords(unsigned int, CppCoord3D &) void rotate(CppCoord3D &, CppCoord3D &, double) void Translate(CppCoord3D &) CppCoord3D find_center() - void syncCoords() + void sync_coords() void euler_rotate(double, double, double) void apply_matrix(Array2D[double] &) CppAtom copy_atom(unsigned int) void add_atom(CppAtomproperty &, CppCoord3D) void add_atom(CppAtom &) - void SetAtom(unsigned int, CppAtom &) + void set_atom(unsigned int, CppAtom &) string print_pdb() CppRigidbody operator+(CppRigidbody &) void CenterToOrigin() @@ -42,14 +42,14 @@ cdef extern from "rigidbody.h" namespace "PTools": double radius() CppAtomproperty & get_atom_property(unsigned int) - void SetAtomProperty(unsigned int, CppAtomproperty &) + void set_atom_property(unsigned int, CppAtomproperty &) # AtomSelection: - CppAtomSelection SelectAllAtoms() - CppAtomSelection SelectAtomType(string) - CppAtomSelection SelectResidType(string) - CppAtomSelection SelectChainId(string) - CppAtomSelection SelectResRange(int, int) + CppAtomSelection select_all_atoms() + CppAtomSelection select_atomtype(string) + CppAtomSelection select_restype(string) + CppAtomSelection select_chainid(string) + CppAtomSelection select_resid_range(int, int) CppAtomSelection get_CA() CppAtomSelection backbone() @@ -104,7 +104,7 @@ cdef class Rigidbody: self.thisptr = 0 def __len__(self): - return self.thisptr.Size() + return self.thisptr.size() def __str__(self): s = self.thisptr.print_pdb() @@ -136,8 +136,8 @@ cdef class Rigidbody: def unsafeget_coords(self, unsigned int i, Coord3D co): self.thisptr.unsafeget_coords(i, deref(co.thisptr)) - def setCoords(self, int i, Coord3D co): - self.thisptr.SetCoords(i, deref(co.thisptr)) + def set_coords(self, int i, Coord3D co): + self.thisptr.set_coords(i, deref(co.thisptr)) def Translate(self, Coord3D tr): self.thisptr.Translate(deref(tr.thisptr)) @@ -157,8 +157,8 @@ cdef class Rigidbody: def euler_rotate(self, double phi, double ssi, double rot): self.thisptr.euler_rotate(phi, ssi, rot) - def syncCoords(self): - self.thisptr.syncCoords() + def sync_coords(self): + self.thisptr.sync_coords() def apply_matrix(self, Matrix mat): self.thisptr.apply_matrix(deref(mat.thisptr)) @@ -173,8 +173,8 @@ cdef class Rigidbody: def add_atom(self, Atom at): self.thisptr.add_atom(deref(at.thisptr)) - def SetAtom(self, unsigned int position, Atom at): - self.thisptr.SetAtom(position, deref(at.thisptr)) + def set_atom(self, unsigned int position, Atom at): + self.thisptr.set_atom(position, deref(at.thisptr)) def get_atom_property(self, unsigned int position): cdef CppAtomproperty cppatprop = self.thisptr.get_atom_property(position) @@ -184,10 +184,10 @@ cdef class Rigidbody: pyAtprop.thisptr = new_atomprop return pyAtprop - def SetAtomProperty(self, unsigned int position, Atomproperty prop): + def set_atom_property(self, unsigned int position, Atomproperty prop): if position < 0 or position >= len(self): raise IndexError('atom index out of bounds') - self.thisptr.SetAtomProperty(position, deref(prop.thisptr)) + self.thisptr.set_atom_property(position, deref(prop.thisptr)) def radius(self): return self.thisptr.radius() @@ -195,47 +195,47 @@ cdef class Rigidbody: def radius_of_gyration(self): return self.thisptr.radius_of_gyration() - def SelectAllAtoms(self): + def select_all_atoms(self): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.SelectAllAtoms() + cdef CppAtomSelection new_sel = self.thisptr.select_all_atoms() ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectAtomType(self, bytes b): + def select_atomtype(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_atomtype = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectAtomType(deref(cpp_atomtype)) + cdef CppAtomSelection new_sel = self.thisptr.select_atomtype(deref(cpp_atomtype)) del cpp_atomtype ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectResidType(self, bytes b): + def select_restype(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_residtype = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectResidType(deref(cpp_residtype)) + cdef CppAtomSelection new_sel = self.thisptr.select_restype(deref(cpp_residtype)) del cpp_residtype ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectChainId(self, bytes b): + def select_chainid(self, bytes b): ret = AtomSelection() del ret.thisptr cdef char * c_typename = b cdef string * cpp_chainid = new string(c_typename) - cdef CppAtomSelection new_sel = self.thisptr.SelectChainId(deref(cpp_chainid)) + cdef CppAtomSelection new_sel = self.thisptr.select_chainid(deref(cpp_chainid)) del cpp_chainid ret.thisptr = new CppAtomSelection(new_sel) return ret - def SelectResRange(self, int i, int j): + def select_resid_range(self, int i, int j): ret = AtomSelection() del ret.thisptr - cdef CppAtomSelection new_sel = self.thisptr.SelectResRange(i, j) + cdef CppAtomSelection new_sel = self.thisptr.select_resid_range(i, j) ret.thisptr = new CppAtomSelection(new_sel) return ret diff --git a/bindings/surface.pyx b/bindings/surface.pyx index 64808c5..94dc817 100644 --- a/bindings/surface.pyx +++ b/bindings/surface.pyx @@ -6,7 +6,7 @@ cdef extern from "surface.h" namespace "PTools": cdef cppclass CppSurface "PTools::Surface": CppSurface(int, int , string ) CppRigidbody surfpoint(CppRigidbody & , double) - void surfpointParams(int, double) + void surfpoint_params(int, double) CppRigidbody outergrid(CppRigidbody &, CppRigidbody & , double) CppRigidbody remove_closest(CppRigidbody & , double) void readsolvparam(string) @@ -33,8 +33,8 @@ cdef class Surface: ret.thisptr = new CppRigidbody(r) return ret - def surfpointParams(self, int max, double shift): - self.thisptr.surfpointParams(max, shift) + def surfpoint_params(self, int max, double shift): + self.thisptr.surfpoint_params(max, shift) def outergrid(self, Rigidbody rigid1, Rigidbody rigid2, double srad): cdef CppRigidbody r = self.thisptr.outergrid(deref(rigid1.thisptr), deref(rigid2.thisptr), srad) diff --git a/headers/BasePair.h b/headers/BasePair.h index df08367..4641a01 100644 --- a/headers/BasePair.h +++ b/headers/BasePair.h @@ -47,14 +47,14 @@ namespace PTools /// return the Rigidbody of the specified base (by chain) Rigidbody get_rigidOfBase(std::string chain); /// define the Rigidbody of the BasePair - void SetRigidBody(const Rigidbody&); + void set_rigidBody(const Rigidbody&); /// return the Residue ID of the specified base (by chain) uint GetResIDofBase(std::string chain); /// change the ID of res to idA for base on strand A and idB for the one on strand B void SetResID(int idA,int idB); /// change the atoms numbers of the specified base (by chain) starting at startnum and returning the last atom number - uint SetAtomNumberOfBase(std::string chain,int); + uint set_atomNumberOfBase(std::string chain,int); std::string get_type() const; @@ -63,11 +63,11 @@ namespace PTools ///return the number of Atom - unsigned int Size() const { return rigbody.Size(); } + unsigned int size() const { return rigbody.size(); } /// return the i-th Atom of the basePair Atom operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("DNA: array out of bounds"); + if (i>=this->size()) throw std::range_error("DNA: array out of bounds"); return rigbody.copy_atom(i);}; private: diff --git a/headers/DNA.h b/headers/DNA.h index 8bc1b53..5208e02 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -26,10 +26,10 @@ namespace PTools ///return the number of BasePair - unsigned int Size() const; + unsigned int size() const; ///return the number of Atom - unsigned int AtomSize() const; + unsigned int Atomsize() const; ///return a string containing the atoms data following the PDB format std::string print_pdb() ; @@ -84,7 +84,7 @@ namespace PTools /// return the i-th BasePair of the strand BasePair operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("DNA: array out of bounds"); + if (i>=this->size()) throw std::range_error("DNA: array out of bounds"); return strand[i];}; /// add the basePairs of a DNA to the strand of this DNA. the specified movement do the liason betwen the two strand diff --git a/headers/atomselection.h b/headers/atomselection.h index 189b437..cdbfe1a 100644 --- a/headers/atomselection.h +++ b/headers/atomselection.h @@ -30,12 +30,12 @@ class AtomSelection{ AtomSelection(const Rigidbody& rigid); ///< translate a Rigidbody object into an AtomSelection ~AtomSelection(); - uint Size() const {return m_list.size();}; ///< returns the size of the selection - void SetRigid(const Rigidbody& rig) {m_rigid=&rig;}; + uint size() const {return m_list.size();}; ///< returns the size of the selection + void set_rigid(const Rigidbody& rig) {m_rigid=&rig;}; /// return the i-th atom of the list Atom operator[] (uint i) const { - if (i>=this->Size()) throw std::range_error("AtomSelection: array out of bounds"); + if (i>=this->size()) throw std::range_error("AtomSelection: array out of bounds"); return m_rigid->copy_atom(m_list[i]);}; Atom copy_atom(uint i) const {return m_rigid->copy_atom(m_list[i]);} diff --git a/headers/attractforcefield.h b/headers/attractforcefield.h index 20bb39c..476bd23 100644 --- a/headers/attractforcefield.h +++ b/headers/attractforcefield.h @@ -23,7 +23,7 @@ class BaseAttractForceField: public ForceField virtual void initMinimization(); ///analytical derivative void Derivatives(const Vdouble&, Vdouble&); - uint ProblemSize(); + uint Problemsize(); dbl Function(const Vdouble&); ///add a new ligand to the ligand list... @@ -38,8 +38,8 @@ class BaseAttractForceField: public ForceField ///non-bonded interactions virtual dbl nonbon8(AttractRigidbody& rec, AttractRigidbody& lig, AttractPairList & pairlist, bool print=false) { - std::vector forcesrec (rec.Size()); - std::vector forceslig (lig.Size()); + std::vector forcesrec (rec.size()); + std::vector forceslig (lig.size()); dbl ener = nonbon8_forces(rec, lig, pairlist, forcesrec, forceslig, print); rec.addForces(forcesrec); @@ -134,7 +134,7 @@ class TestForceField: public ForceField //virtual dbl Function() {return 0.0;}; - virtual uint ProblemSize(){ + virtual uint Problemsize(){ return 2; }; diff --git a/headers/attractrigidbody.h b/headers/attractrigidbody.h index e014ae2..b465bdd 100644 --- a/headers/attractrigidbody.h +++ b/headers/attractrigidbody.h @@ -68,7 +68,7 @@ class AttractRigidbody: public Rigidbody void resetForces() { - m_forces = std::vector (this->Size() ) ; + m_forces = std::vector (this->size() ) ; } void addForces(const std::vector& forces) @@ -78,8 +78,8 @@ class AttractRigidbody: public Rigidbody } - void setRotation(bool value) {hasrotation = value;} ///< allow/disallow rotation - void setTranslation(bool value) {hastranslation = value;} ///< allow/disallow translation + void set_rotation(bool value) {hasrotation = value;} ///< allow/disallow rotation + void set_translation(bool value) {hastranslation = value;} ///< allow/disallow translation void setDummyTypes(const std::vector& dummy); ///< set a list of ignored atom types diff --git a/headers/coordsarray.h b/headers/coordsarray.h index 0b109d4..d8335b7 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -95,12 +95,12 @@ class CoordsArray void inline unsafeget_coords(const uint i, Coord3D& co) const { co = _movedcoords[i];}; void add_coord(const Coord3D& co) {_refcoords.push_back(co); _movedcoords.push_back(co); _modified(); }; - uint Size() const {return _refcoords.size();}; + uint size() const {return _refcoords.size();}; void get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) ; - void SetCoords(const uint k, const Coord3D& co); + void set_coords(const uint k, const Coord3D& co); /// Translate the whole object void Translate(const Coord3D& tr); diff --git a/headers/forcefield.h b/headers/forcefield.h index f47408a..cad68fe 100644 --- a/headers/forcefield.h +++ b/headers/forcefield.h @@ -35,7 +35,7 @@ class ForceField virtual void NumDerivatives(const Vdouble& StateVars, Vdouble& delta, bool print=false); ///size of the problem (number of variables the minimizer must optimize) - virtual uint ProblemSize()=0; + virtual uint Problemsize()=0; ///this function is called at the beginning of a minimization, by the minimizer (Lbfgs) virtual void initMinimization()=0; diff --git a/headers/mcopff.h b/headers/mcopff.h index 28b8786..77b914c 100644 --- a/headers/mcopff.h +++ b/headers/mcopff.h @@ -114,7 +114,7 @@ class McopForceField: public ForceField void calculate_weights(Mcoprigid& lig, bool print=false); - uint ProblemSize() {return 6;}; + uint Problemsize() {return 6;}; void initMinimization(){}; private: diff --git a/headers/pairlist.h b/headers/pairlist.h index 3b8c334..dbabfd4 100644 --- a/headers/pairlist.h +++ b/headers/pairlist.h @@ -45,7 +45,7 @@ class AttractPairList }; ///return number of pairs of atoms in interaction (distance <= cutoff) - uint Size() { + uint size() { return vectl.size(); }; diff --git a/headers/rigidbody.h b/headers/rigidbody.h index 1fa69de..a2380bf 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -69,7 +69,7 @@ class Rigidbody:private CoordsArray virtual ~Rigidbody(){}; /// return number of atoms in the rigidbody - uint Size() const {return CoordsArray::Size();}; + uint size() const {return CoordsArray::size();}; void print_matrix() const {std::cout << CoordsArray::print_matrix() << std::endl; } @@ -93,13 +93,13 @@ class Rigidbody:private CoordsArray } /// define atom properties - void SetAtomProperty(uint pos, const Atomproperty& atprop) + void set_atom_property(uint pos, const Atomproperty& atprop) { mAtomProp[pos] = atprop; } /// define atom pos - void SetAtom(uint pos, const Atom& atom); + void set_atom(uint pos, const Atom& atom); /// add an atom to the molecule (deep copy) void add_atom(const Atomproperty& at, Coord3D co); @@ -110,7 +110,7 @@ class Rigidbody:private CoordsArray //returns the coordinates of atom i Coord3D get_coords(uint i) const { - assert(i 0.0: - # forcefield.SetRestraint(rstk) + # forcefield.set_restraint(rstk) lbfgs_minimizer = ff_specs['minimizer_class'](forcefield) diff --git a/src/BasePair.cpp b/src/BasePair.cpp index b92e315..bc6c17e 100644 --- a/src/BasePair.cpp +++ b/src/BasePair.cpp @@ -23,7 +23,7 @@ BasePair::BasePair(std::string filename) BasePair::BasePair(const Rigidbody& rigbody) { - if (rigbody.Size()==0) + if (rigbody.size()==0) { throw std::runtime_error("cannot initialize a BasePair with an empty Rigidbody"); } @@ -38,12 +38,12 @@ string BasePair::print_pdb()const std::string BasePair::print_pdbofBase(std::string chain) { - return rigbody.SelectChainId(chain).create_rigid().print_pdb(); + return rigbody.select_chainid(chain).create_rigid().print_pdb(); } void BasePair::SetChainID(){ - unsigned int rigSize=rigbody.Size(); - for(unsigned int i =0; i< rigSize ; i++) + unsigned int rigsize=rigbody.size(); + for(unsigned int i =0; i< rigsize ; i++) { Atomproperty ap=rigbody.get_atom_property(i); if (ap.residType == type) @@ -54,7 +54,7 @@ void BasePair::SetChainID(){ { ap.chainId = "B"; } - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } @@ -89,14 +89,14 @@ Rigidbody BasePair::get_rigid()const Rigidbody BasePair::get_rigidOfBase(std::string chain) { - return rigbody.SelectChainId(chain).create_rigid(); + return rigbody.select_chainid(chain).create_rigid(); } void BasePair::SetResID(int idA,int idB) { - unsigned int baseSize=rigbody.Size(); - for(unsigned int i =0; i< baseSize ; i++) + unsigned int basesize=rigbody.size(); + for(unsigned int i =0; i< basesize ; i++) { Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == "A") @@ -107,21 +107,21 @@ void BasePair::SetResID(int idA,int idB) { ap.residId = idB; } - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } -uint BasePair::SetAtomNumberOfBase(std::string chain,int num) +uint BasePair::set_atomNumberOfBase(std::string chain,int num) { - unsigned int baseSize=rigbody.Size(); - for(unsigned int i =0; i< baseSize ; i++) + unsigned int basesize=rigbody.size(); + for(unsigned int i =0; i< basesize ; i++) { Atomproperty ap=rigbody.get_atom_property(i); if (ap.chainId == chain) { ap.atomId = num; num++; - rigbody.SetAtomProperty(i,ap); + rigbody.set_atom_property(i,ap); } } return num; @@ -129,12 +129,12 @@ uint BasePair::SetAtomNumberOfBase(std::string chain,int num) uint BasePair::GetResIDofBase(std::string chain) { - Atomproperty ap = rigbody.SelectChainId(chain).create_rigid().get_atom_property(0); + Atomproperty ap = rigbody.select_chainid(chain).create_rigid().get_atom_property(0); return ap.residId; } -void BasePair::SetRigidBody(const Rigidbody& rigbody) +void BasePair::set_rigidBody(const Rigidbody& rigbody) { this->rigbody=rigbody; } diff --git a/src/DNA.cpp b/src/DNA.cpp index 851111f..9bfbc60 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -35,8 +35,8 @@ DNA::DNA(const string& dataBaseFile, const string& seq, const Movement& mov) DNA::DNA( const DNA& model ) { - unsigned int modelSize = model.Size(); - for (uint i =0; i< modelSize; i++) + unsigned int modelsize = model.size(); + for (uint i =0; i< modelsize; i++) { strand.push_back(model[i]); } @@ -74,12 +74,12 @@ DNA::~DNA() void DNA::PlaceBasePairs( Rigidbody& model) { - unsigned int DNASize = (strand.size()*2)-1; - unsigned int strandSize = strand.size(); + unsigned int DNAsize = (strand.size()*2)-1; + unsigned int strandsize = strand.size(); Parameter param =Parameter(); - for ( unsigned int i = 0; i < strandSize; i++ )// strandSize + for ( unsigned int i = 0; i < strandsize; i++ )// strandsize { - Rigidbody modelOfBasePair = GetModelOfBasePair( model, i, DNASize-i); + Rigidbody modelOfBasePair = GetModelOfBasePair( model, i, DNAsize-i); strand[i].apply(GetMatBetwenBasePair ( modelOfBasePair,i )); } } @@ -102,26 +102,26 @@ void DNA::RenumberModel (Rigidbody& model) unsigned int nbRes=0; unsigned int second = 0; - unsigned int strandSize = 0; - if ((model.SelectAtomType("C1'").Size() / 2) > 0) { - strandSize = model.SelectAtomType("C1'").Size() / 2; - } else if ((model.SelectAtomType("C1*").Size() / 2) > 0) { - strandSize = model.SelectAtomType("C1*").Size() / 2; - } else if((model.SelectAtomType("GS1").Size() / 2) > 0) { - strandSize = model.SelectAtomType("GS1").Size() / 2; + unsigned int strandsize = 0; + if ((model.select_atomtype("C1'").size() / 2) > 0) { + strandsize = model.select_atomtype("C1'").size() / 2; + } else if ((model.select_atomtype("C1*").size() / 2) > 0) { + strandsize = model.select_atomtype("C1*").size() / 2; + } else if((model.select_atomtype("GS1").size() / 2) > 0) { + strandsize = model.select_atomtype("GS1").size() / 2; } bool isjumna = IsJumna(model); - unsigned int modelSize=model.Size(); + unsigned int modelsize=model.size(); chain = "A"; - for (unsigned int i =0; i < modelSize; i++ ) + for (unsigned int i =0; i < modelsize; i++ ) { Atomproperty ap=model.get_atom_property(i); unsigned int Id = ap.residId; if ( tempId != Id ) { - if (nbRes >= strandSize -1){ + if (nbRes >= strandsize -1){ chain = "B"; if (isjumna) { @@ -146,7 +146,7 @@ void DNA::RenumberModel (Rigidbody& model) } ap.residId = nbRes; ap.chainId = chain; - model.SetAtomProperty(i,ap); + model.set_atom_property(i,ap); } } @@ -155,13 +155,13 @@ bool DNA::IsJumna ( Rigidbody& model) //jumna have an inversed numerotation so on a 10 base dna (strand A: 0,1,2,3,4 and strand B:5,6,7,8,9) //the base 0 is associated with 5 instead of 9. //to check wich convention is followed, I'm gonna test the distance between 0-5 and 0-9, the shorter being the correct coupling - AtomSelection sel = model.SelectAtomType("C1'"); - if (sel.Size() == 0) sel = model.SelectAtomType("C1*"); - if (sel.Size() == 0) sel = model.SelectAtomType("GS1"); + AtomSelection sel = model.select_atomtype("C1'"); + if (sel.size() == 0) sel = model.select_atomtype("C1*"); + if (sel.size() == 0) sel = model.select_atomtype("GS1"); - double d1 = dist(sel[0],sel[sel.Size()-1]); - double d2 = dist(sel[0],sel[sel.Size()/2]); + double d1 = dist(sel[0],sel[sel.size()-1]); + double d2 = dist(sel[0],sel[sel.size()/2]); return (d1>d2); } @@ -169,22 +169,22 @@ bool DNA::IsJumna ( Rigidbody& model) Rigidbody DNA::DelSingleBase (Rigidbody& model) { string seq; - unsigned int strandSize; + unsigned int strandsize; Rigidbody newModel = Rigidbody(); - if ((model.SelectAtomType("C1'").Size()) >0) + if ((model.select_atomtype("C1'").size()) >0) { - strandSize = model.SelectAtomType("C1'").Size(); - }else if ((model.SelectAtomType("C1*").Size()) >0) + strandsize = model.select_atomtype("C1'").size(); + }else if ((model.select_atomtype("C1*").size()) >0) { - strandSize = model.SelectAtomType("C1*").Size(); - }else if ((model.SelectAtomType("GS1").Size()) >0) + strandsize = model.select_atomtype("C1*").size(); + }else if ((model.select_atomtype("GS1").size()) >0) { - strandSize = model.SelectAtomType("GS1").Size(); + strandsize = model.select_atomtype("GS1").size(); }else {return model;} - for ( unsigned int i=0 ; i< strandSize ; i++ ) + for ( unsigned int i=0 ; i< strandsize ; i++ ) { - string type = model.SelectResRange( i, i)[0].residType; + string type = model.select_resid_range( i, i)[0].residType; // /!\ the order of the check is important! somme pdb use a CYT description for C, a wrong order could detect this as a T if ( type.find ('G') != string::npos || type.find ('g') != string::npos) seq+='G'; else if ( type.find ('C') != string::npos || type.find ('c') != string::npos) seq+='C'; @@ -333,7 +333,7 @@ Rigidbody DNA::DelSingleBase (Rigidbody& model) { if ( solution[i]==1) { - newModel= newModel + model.SelectResRange(i,i).create_rigid(); + newModel= newModel + model.select_resid_range(i,i).create_rigid(); } } //cout << newModel.print_pdb()<< endl; @@ -383,7 +383,7 @@ bool DNA::IsAlign(std::string s1,std::string s2,int shift)const Rigidbody DNA::GetModelOfBasePair( Rigidbody& model,int posA,int posB) { - return (model.SelectResRange(posA, posA)|model.SelectResRange(posB, posB)).create_rigid(); + return (model.select_resid_range(posA, posA)|model.select_resid_range(posB, posB)).create_rigid(); } @@ -405,20 +405,20 @@ void DNA::AssembleSeq (const std::string &dataBaseFile, const std::string& seq) string DNA::GetSeq ( Rigidbody& model) { string seq; - unsigned int strandSize; - if ((model.SelectAtomType("C1'").Size()/2) >0) + unsigned int strandsize; + if ((model.select_atomtype("C1'").size()/2) >0) { - strandSize = model.SelectAtomType("C1'").Size()/2; - }else if ((model.SelectAtomType("C1*").Size()/2) >0) + strandsize = model.select_atomtype("C1'").size()/2; + }else if ((model.select_atomtype("C1*").size()/2) >0) { - strandSize = model.SelectAtomType("C1*").Size()/2; - }else if ((model.SelectAtomType("GS1").Size()/2) >0) + strandsize = model.select_atomtype("C1*").size()/2; + }else if ((model.select_atomtype("GS1").size()/2) >0) { - strandSize = model.SelectAtomType("GS1").Size()/2; + strandsize = model.select_atomtype("GS1").size()/2; }else {return "";} - for ( unsigned int i=0 ; i< strandSize ; i++ ) + for ( unsigned int i=0 ; i< strandsize ; i++ ) { - string type = model.SelectResRange( i, i)[0].residType; + string type = model.select_resid_range( i, i)[0].residType; // /!\ the order of the check is important! somme pdb use a CYT description for C, a wrong order could detect this as a T if ( type.find ('G') != string::npos || type.find ('g') != string::npos) seq+='G'; else if ( type.find ('C') != string::npos || type.find ('c') != string::npos) seq+='C'; @@ -433,11 +433,11 @@ string DNA::GetSeq ( Rigidbody& model) vector DNA::BuildVbase(string chainIDs, Rigidbody& dataBase)const { vector vbase; - unsigned int chainIDsSize = chainIDs.size(); - for (unsigned int i = 0; i < chainIDsSize ; i++) + unsigned int chainIDssize = chainIDs.size(); + for (unsigned int i = 0; i < chainIDssize ; i++) { - vbase.push_back(dataBase.SelectChainId(chainIDs.substr(i,1)).create_rigid()); + vbase.push_back(dataBase.select_chainid(chainIDs.substr(i,1)).create_rigid()); } return vbase; } @@ -446,11 +446,11 @@ vector DNA::BuildVbase(string chainIDs, Rigidbody& dataBase)const string DNA::GetChainIDs(const Rigidbody& rb)const { string chainIDs; - AtomSelection selection = rb.SelectAllAtoms (); + AtomSelection selection = rb.select_all_atoms (); string tmp = ""; - unsigned int selectionSize = selection.Size(); + unsigned int selectionsize = selection.size(); - for (unsigned int i=0; i < selectionSize ;i++) + for (unsigned int i=0; i < selectionsize ;i++) { string id = selection[i].chainId; if(id !=tmp) @@ -469,12 +469,12 @@ bool DNA::IsPdbFile (std::string seq) const void DNA::BuildStrand(std::string seq, std::string chainIDs, const std::vector& vbase) { - unsigned int seqSize = seq.size(); - unsigned int chainIDsSize = chainIDs.size(); + unsigned int seqsize = seq.size(); + unsigned int chainIDssize = chainIDs.size(); - for (unsigned int i =0; i < seqSize; i++ ) + for (unsigned int i =0; i < seqsize; i++ ) { - for (unsigned int j =0; j < chainIDsSize; j++ ) + for (unsigned int j =0; j < chainIDssize; j++ ) { if (seq[i] == chainIDs[j]) { @@ -488,31 +488,31 @@ void DNA::BuildStrand(std::string seq, std::string chainIDs, const std::vector 0 ; i-- ) + for (unsigned int i = strandsize-1; i > 0 ; i-- ) { //numerotation atom (second part) - nbAtom = strand[i].SetAtomNumberOfBase("B",nbAtom); + nbAtom = strand[i].set_atomNumberOfBase("B",nbAtom); } //last part of atom numerotation (because of error with decreasing unsigned int) - strand[0].SetAtomNumberOfBase("B",nbAtom); + strand[0].set_atomNumberOfBase("B",nbAtom); } void DNA::applyInitialMov(const Movement& mov) { - unsigned int strandSize = strand.size(); - for (unsigned int i=1; i Size(); - for (uint i=0; isize(); + for (uint i=0; i"< vbase = BuildVbase(chainIDs,dataBase); - unsigned int chainIDsSize = chainIDs.size(); + unsigned int chainIDssize = chainIDs.size(); - unsigned int strandSize = strand.size(); - for (unsigned int i = 0; i < strandSize ; i++) + unsigned int strandsize = strand.size(); + for (unsigned int i = 0; i < strandsize ; i++) { Movement mov = Movement(strand[i].get_matrix()); - for (unsigned int j =0; j < chainIDsSize; j++ ) + for (unsigned int j =0; j < chainIDssize; j++ ) { if ( strand[i].get_type()[0] == chainIDs[j]) { @@ -678,8 +678,8 @@ void DNA::applylocalMov(const Movement& mov,int pos) Matrix nextlocal = GetLocalMatrix(pos+1); strand[pos].apply(mov); - unsigned int strandSize = strand.size(); - for (unsigned int i=pos+1; i 1){ + unsigned int strandsize = strand.size(); + if (strandsize>1){ nextlocal = GetLocalMatrix(1); } strand[0].apply(mov); - for (unsigned int i=1; i add(d[0], mov); - for(uint i =1; i< d.Size();i++) + for(uint i =1; i< d.size();i++) { this->add(d[i],Movement(d.GetLocalMatrix(i))); } @@ -828,7 +828,7 @@ void DNA::add(BasePair bp, const Movement & mov) DNA DNA::SubDNA(uint start, uint end)const { - if (std::max(start, end) > this->Size() ) + if (std::max(start, end) > this->size() ) { throw std::out_of_range("out of range in SubDNA"); } @@ -845,7 +845,7 @@ DNA DNA::SubDNA(uint start, uint end)const void DNA::Replace(const DNA & d,int start) { DNA preDNA = this->SubDNA(0,start); - DNA postDNA =this->SubDNA(start+d.Size(),this->Size()); + DNA postDNA =this->SubDNA(start+d.size(),this->size()); Movement initMov = Movement(strand[0].get_matrix()); strand.clear(); @@ -862,7 +862,7 @@ void DNA::change_type(int pos, std::string type, std::string filename) { Rigidbody dataBase = Rigidbody(filename); Movement mov = Movement(strand[pos].get_matrix()); - strand[pos] = BasePair(dataBase.SelectChainId(type).create_rigid()); + strand[pos] = BasePair(dataBase.select_chainid(type).create_rigid()); strand[pos].apply(mov); ChangeFormat(); @@ -870,12 +870,12 @@ void DNA::change_type(int pos, std::string type, std::string filename) { void DNA::Translate(Coord3D coord) { - unsigned int strandSize = strand.size(); - for (unsigned int i=0; i 0) + if (bp.select_atomtype("GS2").size()> 0) { return BuildAxisCGGeometricCenter(bp); } @@ -52,24 +52,24 @@ Rigidbody Parameter::BuildAxisCentered( Rigidbody& bp) ////code "steal" from deformDna.cpp (author: Pierre Poulain), modified to use the geometric center Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) { - AtomSelection selSugar = bp.SelectAtomType("GS2"); - assert(selSugar.Size() == 2); + AtomSelection selSugar = bp.select_atomtype("GS2"); + assert(selSugar.size() == 2); // build base3D Rigidbody base3D; // define atoms for base3D construction Coord3D center = selSugar.create_rigid().find_center(); // middle of GS2 Coord3D pointY = selSugar[0].coords; // point toward Y (first GS2) - AtomSelection grain1 = bp.SelectAtomType("GG1"); // GG1 or GA1 - if (grain1.Size() == 0) { - grain1 = bp.SelectAtomType("GA1"); + AtomSelection grain1 = bp.select_atomtype("GG1"); // GG1 or GA1 + if (grain1.size() == 0) { + grain1 = bp.select_atomtype("GA1"); } - assert(grain1.Size() == 1); + assert(grain1.size() == 1); - AtomSelection grain2 = bp.SelectAtomType("GC1"); // GG1 or GA1 - if (grain2.Size() == 0) { - grain2 = bp.SelectAtomType("GT1"); + AtomSelection grain2 = bp.select_atomtype("GC1"); // GG1 or GA1 + if (grain2.size() == 0) { + grain2 = bp.select_atomtype("GT1"); } - assert(grain2.Size() == 1); + assert(grain2.size() == 1); Coord3D pointX1 = grain1[0].coords; Coord3D pointX2 = grain2[0].coords; // Y @@ -112,18 +112,18 @@ Rigidbody Parameter::BuildAxisCGGeometricCenter( Rigidbody& bp) ///Definitions and Nomenclature of Nucleic Acid Structure Parameters, R. E. Dickerson et alJ. Mol. Biol. (1995) 251, 648–664. Rigidbody Parameter::BuildAxisAAGeometricCenter( Rigidbody& bp) { - AtomSelection selSugar = bp.SelectAtomType("C1'"); - if (selSugar.Size() != 2)selSugar = bp.SelectAtomType("C1*"); + AtomSelection selSugar = bp.select_atomtype("C1'"); + if (selSugar.size() != 2)selSugar = bp.select_atomtype("C1*"); // build base3D Rigidbody base3D; // define atoms for base3D construction Coord3D center = selSugar.create_rigid().find_center(); // middle of GS2 Coord3D pointY = selSugar[0].coords; // point toward Y (first GS2) - AtomSelection grain = bp.SelectAtomType("C5"); // GG1 or GA1 - if (grain.Size() == 0) { - grain = bp.SelectAtomType("GA1"); + AtomSelection grain = bp.select_atomtype("C5"); // GG1 or GA1 + if (grain.size() == 0) { + grain = bp.select_atomtype("GA1"); } - assert(grain.Size() >= 1); /* /!\ */ + assert(grain.size() >= 1); /* /!\ */ // Y Coord3D axeY = (pointY - center).Normalize(); // Z diff --git a/src/Stacking.cpp b/src/Stacking.cpp index df1c31e..8536ca0 100644 --- a/src/Stacking.cpp +++ b/src/Stacking.cpp @@ -27,50 +27,50 @@ Stacking::~Stacking() Rigidbody Stacking::Axis( Rigidbody& bp1, Rigidbody& bp2) { //1 determine if the considered basePair is a G-C or a A-T - bool bp1isGC = bp1.SelectAtomType("GG1").Size()>0; - bool bp2isGC = bp2.SelectAtomType("GG1").Size()>0; + bool bp1isGC = bp1.select_atomtype("GG1").size()>0; + bool bp2isGC = bp2.select_atomtype("GG1").size()>0; //2 build rigidbody for pyrimidine Rigidbody pyrBp1; if (bp1isGC) { - pyrBp1 = bp1.SelectAtomType("GC1").create_rigid() + bp1.SelectAtomType("GC2").create_rigid(); + pyrBp1 = bp1.select_atomtype("GC1").create_rigid() + bp1.select_atomtype("GC2").create_rigid(); } else { - pyrBp1 = bp1.SelectAtomType("GT1").create_rigid() + bp1.SelectAtomType("GT2").create_rigid(); + pyrBp1 = bp1.select_atomtype("GT1").create_rigid() + bp1.select_atomtype("GT2").create_rigid(); } Rigidbody pyrBp2; if (bp2isGC) { - pyrBp2 = bp2.SelectAtomType("GC1").create_rigid() + bp2.SelectAtomType("GC2").create_rigid(); + pyrBp2 = bp2.select_atomtype("GC1").create_rigid() + bp2.select_atomtype("GC2").create_rigid(); } else { - pyrBp2 = bp2.SelectAtomType("GT1").create_rigid() + bp2.SelectAtomType("GT2").create_rigid(); + pyrBp2 = bp2.select_atomtype("GT1").create_rigid() + bp2.select_atomtype("GT2").create_rigid(); } //3 build rigidbody for purine Rigidbody purBp1; if (bp1isGC) { - purBp1 = bp1.SelectAtomType("GG1").create_rigid() + bp1.SelectAtomType("GG2").create_rigid() + bp1.SelectAtomType("GG3").create_rigid(); + purBp1 = bp1.select_atomtype("GG1").create_rigid() + bp1.select_atomtype("GG2").create_rigid() + bp1.select_atomtype("GG3").create_rigid(); } else { - purBp1 = bp1.SelectAtomType("GA1").create_rigid() + bp1.SelectAtomType("GA2").create_rigid() + bp1.SelectAtomType("GA3").create_rigid(); + purBp1 = bp1.select_atomtype("GA1").create_rigid() + bp1.select_atomtype("GA2").create_rigid() + bp1.select_atomtype("GA3").create_rigid(); } Rigidbody purBp2; if (bp2isGC) { - purBp2 = bp2.SelectAtomType("GG1").create_rigid() + bp2.SelectAtomType("GG2").create_rigid() + bp2.SelectAtomType("GG3").create_rigid(); + purBp2 = bp2.select_atomtype("GG1").create_rigid() + bp2.select_atomtype("GG2").create_rigid() + bp2.select_atomtype("GG3").create_rigid(); } else { - purBp2 = bp2.SelectAtomType("GA1").create_rigid() + bp2.SelectAtomType("GA2").create_rigid() + bp2.SelectAtomType("GA3").create_rigid(); + purBp2 = bp2.select_atomtype("GA1").create_rigid() + bp2.select_atomtype("GA2").create_rigid() + bp2.select_atomtype("GA3").create_rigid(); } //4 compute center @@ -101,29 +101,29 @@ Rigidbody Stacking::Axis( Rigidbody& bp1, Rigidbody& bp2) Rigidbody Stacking::Axis( Rigidbody& basePair) { //1 determine if the considered basePair is a G-C or a A-T - bool basePairIsGC = basePair.SelectAtomType("GG1").Size()>0; + bool basePairIsGC = basePair.select_atomtype("GG1").size()>0; //2 build rigidbody for pyrimidine Rigidbody pyrBp; if (basePairIsGC) { - pyrBp = basePair.SelectAtomType("GC1").create_rigid() + basePair.SelectAtomType("GC2").create_rigid(); + pyrBp = basePair.select_atomtype("GC1").create_rigid() + basePair.select_atomtype("GC2").create_rigid(); } else { - pyrBp = basePair.SelectAtomType("GT1").create_rigid() + basePair.SelectAtomType("GT2").create_rigid(); + pyrBp = basePair.select_atomtype("GT1").create_rigid() + basePair.select_atomtype("GT2").create_rigid(); } //3 build rigidbody for purine Rigidbody purBp; if (basePairIsGC) { - purBp = basePair.SelectAtomType("GG1").create_rigid() + basePair.SelectAtomType("GG2").create_rigid() + basePair.SelectAtomType("GG3").create_rigid(); + purBp = basePair.select_atomtype("GG1").create_rigid() + basePair.select_atomtype("GG2").create_rigid() + basePair.select_atomtype("GG3").create_rigid(); } else { - purBp = basePair.SelectAtomType("GA1").create_rigid() + basePair.SelectAtomType("GA2").create_rigid() + basePair.SelectAtomType("GA3").create_rigid(); + purBp = basePair.select_atomtype("GA1").create_rigid() + basePair.select_atomtype("GA2").create_rigid() + basePair.select_atomtype("GA3").create_rigid(); } diff --git a/src/atomselection.cpp b/src/atomselection.cpp index f9ebd56..9787efc 100644 --- a/src/atomselection.cpp +++ b/src/atomselection.cpp @@ -14,7 +14,7 @@ namespace PTools { AtomSelection::AtomSelection(const Rigidbody& rigid) { m_rigid=&rigid; - for (uint i=0; i < rigid.Size(); i++) + for (uint i=0; i < rigid.size(); i++) { this->add_atomIndex(i); } @@ -36,7 +36,7 @@ AtomSelection::AtomSelection(const AtomSelection& oldsel) Rigidbody AtomSelection::create_rigid() { Rigidbody newrigid; - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { Atom at = m_rigid->copy_atom(m_list[i]); newrigid.add_atom(at); @@ -101,8 +101,8 @@ AtomSelection operator! (const AtomSelection& seltoinverse) { //TODO: tests! AtomSelection selout; - selout.SetRigid(*seltoinverse.m_rigid); - AtomSelection all = seltoinverse.m_rigid->SelectAllAtoms(); + selout.set_rigid(*seltoinverse.m_rigid); + AtomSelection all = seltoinverse.m_rigid->select_all_atoms(); set_difference(all.m_list.begin(), all.m_list.end(), seltoinverse.m_list.begin(), seltoinverse.m_list.end(), back_inserter(selout.m_list)); diff --git a/src/attractforcefield.cpp b/src/attractforcefield.cpp index e993335..a38d112 100644 --- a/src/attractforcefield.cpp +++ b/src/attractforcefield.cpp @@ -24,7 +24,7 @@ void extractExtra( Rigidbody& rig, std::vector& vCat, std::vector& vC uint atcategory = 0; dbl atcharge = 0.0; - for (uint i=0; i& forcerec, std::vector& forcelig, bool print) { - assert(forcerec.size() == rec.Size()); - assert(forcelig.size() == lig.Size()); + assert(forcerec.size() == rec.size()); + assert(forcelig.size() == lig.size()); dbl sumLJ=0.0 ; dbl sumElectrostatic=0.0; //synchronize coordinates for using unsafeget_coords - rec.syncCoords(); - lig.syncCoords(); + rec.sync_coords(); + lig.sync_coords(); Coord3D a, b; - for (uint iter=0; iter=1); assert(m_movedligand.size() >=1); - if (stateVars.size() != this->ProblemSize() ) + if (stateVars.size() != this->Problemsize() ) { - throw std::runtime_error("error: ProblemSize != size of state vars in BaseAttractForceField::Function"); + throw std::runtime_error("error: Problemsize != size of state vars in BaseAttractForceField::Function"); } uint svptr = 0; //state variable 'pointer' @@ -405,7 +405,7 @@ dbl BaseAttractForceField::Function(const Vdouble& stateVars ) -uint BaseAttractForceField::ProblemSize() +uint BaseAttractForceField::Problemsize() { uint size = 0; for (uint i = 0; i < m_centeredligand.size(); i++) @@ -479,13 +479,13 @@ dbl AttractForceField2::nonbon8_forces(AttractRigidbody& rec, AttractRigidbody& std::cout.precision(20); //synchronise coordinates to later use unsafeget_coords (should be faster) - rec.syncCoords(); - lig.syncCoords(); + rec.sync_coords(); + lig.sync_coords(); Coord3D a; Coord3D b; - for (uint ik=0; ik newactivelist; - for(uint i=0; iSize(); i++) + for(uint i=0; isize(); i++) { if( isAtomActive(i) ) newactivelist.push_back(i); } diff --git a/src/coordsarray.cpp b/src/coordsarray.cpp index eb936f2..dce572a 100644 --- a/src/coordsarray.cpp +++ b/src/coordsarray.cpp @@ -134,11 +134,11 @@ return matrix; void CoordsArray::get_coords(const uint i, Coord3D& co) const throw(std::out_of_range) { - if (i>=Size()) + if (i>=size()) { std::stringstream ss (std::stringstream::in | std::stringstream::out); ss << "CoordsArray::get_coords : out of range : "; - ss << i << " is out of bounds (object size: " << Size() << ")\n"; + ss << i << " is out of bounds (object size: " << size() << ")\n"; std::string message = ss.str() ; std::cerr << message ; throw std::out_of_range (message); @@ -148,7 +148,7 @@ void CoordsArray::get_coords(const uint i, Coord3D& co) const throw(std::out_of }; -void CoordsArray::SetCoords(const uint k, const Coord3D& co) +void CoordsArray::set_coords(const uint k, const Coord3D& co) { //sets the coordinate [i] to be 'co' after rotation/translation diff --git a/src/forcefield.cpp b/src/forcefield.cpp index 449c497..9f638df 100644 --- a/src/forcefield.cpp +++ b/src/forcefield.cpp @@ -55,7 +55,7 @@ void ForceField::NumDerivatives(const Vdouble& stateVars, Vdouble& delta, bool p std::cout << "Warning: using numerical derivatives in production may lead to poor performances\n" ; numerical_warning=true; } - for (uint j=0; j newvars1 = stateVars; @@ -77,7 +77,7 @@ void ForceField::NumDerivatives(const Vdouble& stateVars, Vdouble& delta, bool p if (print) { std::cout << "Numerical derivatives: \n"; - for (uint i=0; i copyforce(copy.Size()); - std::vector mainforce(lig._main.Size()); + std::vector copyforce(copy.size()); + std::vector mainforce(lig._main.size()); // dbl e = _ff.nonbon8( lig._main, _receptor._vregion[loopregion][copy] , cpl ); dbl e = _ff.nonbon8_forces(lig._main, copy, cpl, mainforce, copyforce); @@ -205,11 +205,11 @@ dbl McopForceField::Function(const Vdouble & v) { mainforce[i] = weight*mainforce[i]; } //add force to main ligand and receptor copy - assert(lig._main.Size() == mainforce.size()); - for (uint i=0; i todbl(std::vector & vcplx) void Lbfgs::minimize(int maxiter) { - int n = objToMinimize.ProblemSize(); + int n = objToMinimize.Problemsize(); std::cout << "number of free variables for the minimizer: " << n << std::endl; diff --git a/src/pairlist.cpp b/src/pairlist.cpp index 060eab6..b18fa89 100644 --- a/src/pairlist.cpp +++ b/src/pairlist.cpp @@ -23,8 +23,8 @@ AttractPairList::AttractPairList(const AttractRigidbody & receptor, const Attrac mp_receptor = &receptor; no_update = true ; //if infinite cutoff - for (uint i = 0 ; i < mp_ligand->Size(); i++) - for (uint j = 0; j < mp_receptor->Size(); j++) + for (uint i = 0 ; i < mp_ligand->size(); i++) + for (uint j = 0; j < mp_receptor->size(); j++) { vectl.push_back(i); vectr.push_back(j); @@ -54,7 +54,7 @@ void AttractPairList::update() std::vector activelig; std::vector activerec; - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { if (mp_ligand->isAtomActive(i)) { @@ -62,7 +62,7 @@ void AttractPairList::update() } } - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { if (mp_receptor->isAtomActive(i)) { diff --git a/src/pdbio.cpp b/src/pdbio.cpp index 38cc782..f07bc45 100644 --- a/src/pdbio.cpp +++ b/src/pdbio.cpp @@ -200,7 +200,7 @@ void WritePDB(const Rigidbody& rigid, std::string filename) FILE* file= fopen(filename.c_str(),"w") ; - for (uint i=0; i= this->Size()) + if (pos<0 || pos >= this->size()) { - std::string message = "SetAtom: position "; + std::string message = "set_atom: position "; message += pos; message += " is out of range"; throw std::out_of_range(message); } Atomproperty atp(atom); Coord3D co(atom.coords); - SetAtomProperty(pos, atp); - SetCoords(pos,co); + set_atom_property(pos, atp); + set_coords(pos,co); } @@ -101,11 +101,11 @@ void Rigidbody::add_atom(const Atom& at) Coord3D Rigidbody::find_center() const { Coord3D center(0.0,0.0,0.0); - for (uint i=0; i< this->Size() ; i++) + for (uint i=0; i< this->size() ; i++) { center = center + get_coords(i); } - return ( (1.0/(dbl)this->Size())*center); + return ( (1.0/(dbl)this->size())*center); } @@ -119,19 +119,19 @@ dbl Rigidbody::radius_of_gyration() { Coord3D c = this->find_center(); dbl r=0.0; - for (uint i=0; i< this->Size(); i++) + for (uint i=0; i< this->size(); i++) { r += Norm2( c - this->get_coords(i) ); } - dbl result = sqrt( r/ (double) this->Size() ); + dbl result = sqrt( r/ (double) this->size() ); return result; } dbl Rigidbody::radius() { Coord3D center = this->find_center(); - uint size = this->Size(); + uint size = this->size(); dbl radius = 0.0; for (uint i=0; i < size; i++) { @@ -156,11 +156,11 @@ void Rigidbody::euler_rotate(dbl phi, dbl ssi, dbl rot) -AtomSelection Rigidbody::SelectAllAtoms() const +AtomSelection Rigidbody::select_all_atoms() const { AtomSelection newsel; - newsel.SetRigid(*this); - for (uint i=0; i < Size(); i++) + newsel.set_rigid(*this); + for (uint i=0; i < size(); i++) { newsel.add_atomIndex(i); } @@ -171,10 +171,10 @@ AtomSelection Rigidbody::SelectAllAtoms() const } -AtomSelection Rigidbody::SelectAtomType(std::string atomtype) +AtomSelection Rigidbody::select_atomtype(std::string atomtype) { AtomSelection newsel; - newsel.SetRigid(*this); + newsel.set_rigid(*this); if (atomtype.size() == 0) return newsel; @@ -197,7 +197,7 @@ AtomSelection Rigidbody::SelectAtomType(std::string atomtype) else - for (uint i=0; i=start && atp.residId <= stop) newsel.add_atomIndex(i); @@ -247,7 +247,7 @@ AtomSelection Rigidbody::SelectResRange(int start, int stop) AtomSelection Rigidbody::get_CA() { - return SelectAtomType("CA"); + return select_atomtype("CA"); } bool isbackbone(const std::string & atomtype) @@ -268,9 +268,9 @@ bool isbackbone(const std::string & atomtype) AtomSelection Rigidbody::backbone() { AtomSelection newsel; - newsel.SetRigid(*this); + newsel.set_rigid(*this); - for (uint i=0; iSize(); i++) + for (uint i=0; isize(); i++) { if (isbackbone(copy_atom(i).atomType) ) { @@ -285,7 +285,7 @@ AtomSelection Rigidbody::backbone() /// operator + Rigidbody Rigidbody::operator+(const Rigidbody& rig) { Rigidbody rigFinal(*this); - for (uint i=0; i< rig.Size() ; i++) { + for (uint i=0; i< rig.size() ; i++) { rigFinal.add_coord(rig.get_coords(i)); rigFinal.mAtomProp.push_back(rig.mAtomProp[i]); } @@ -302,7 +302,7 @@ void Rigidbody::rotate(const Coord3D& A, const Coord3D& B, dbl theta) std::string Rigidbody::print_pdb() const { - uint size=this->Size(); + uint size=this->size(); std::string output; for (uint i=0; i < size-1 ; i++) diff --git a/src/rmsd.cpp b/src/rmsd.cpp index 2f69128..0e1296a 100644 --- a/src/rmsd.cpp +++ b/src/rmsd.cpp @@ -20,20 +20,20 @@ namespace PTools { dbl rmsd(const AtomSelection& atsel1, const AtomSelection& atsel2) { - if (atsel1.Size() == 0 || atsel2.Size() == 0) + if (atsel1.size() == 0 || atsel2.size() == 0) { throw std::invalid_argument("EmptyRigidbody"); } - if (atsel1.Size() != atsel2.Size()) + if (atsel1.size() != atsel2.size()) { - throw std::invalid_argument("rmsdSizesDiffers"); + throw std::invalid_argument("rmsdsizesDiffers"); } dbl sum = 0.0; - for (uint i=0; i& forcerec, std::vector& forcelig, bool print) { - assert(forcerec.size() == rec.Size()); - assert(forcelig.size() == lig.Size()); + assert(forcerec.size() == rec.size()); + assert(forcelig.size() == lig.size()); dbl sumLJ=0.0 ; dbl sumElectrostatic=0.0; //synchronize coordinates for using unsafeget_coords - rec.syncCoords(); - lig.syncCoords(); + rec.sync_coords(); + lig.sync_coords(); Coord3D a, b; - for (uint iter=0; iter neigh; radius.clear(); @@ -79,7 +79,7 @@ Rigidbody Surface::surfpoint(const Rigidbody & rigid, dbl srad) // read radius AttractRigidbody rigid_tmp(rigid); m_atomtypenumber.resize(size_rigid); - for (uint i=0; i< rigid_tmp.Size(); i++) + for (uint i=0; i< rigid_tmp.size(); i++) { m_atomtypenumber[i] = rigid_tmp.getAtomTypeNumber(i);} for (int i=0; i Date: Thu, 27 Jul 2017 17:53:54 +0200 Subject: [PATCH 15/22] rename T-Z --- NAMES_TXN | 18 +++++++++--------- README_NAMES | 1 + Tests/__init__.py | 2 +- Tests/cpp/ptoolstest.h | 28 ++++++++++++++-------------- Tests/functional/test_translate.py | 2 +- Tests/test_attract_misc.py | 6 +++--- Tests/test_coordsarray.py | 4 ++-- Tests/test_misc.py | 12 ++++++------ Tests/test_movement.py | 2 +- Tests/test_rigidbody.py | 12 ++++++------ Tests/test_superpose.py | 2 +- bindings/atom.pyx | 12 ++++++------ bindings/attractrigidbody.pyx | 4 ++-- bindings/coordsarray.pyx | 6 +++--- bindings/movement.pyx | 6 +++--- bindings/pdbio.pyx | 6 +++--- bindings/rigidbody.pyx | 6 +++--- headers/DNA.h | 4 ++-- headers/Movement.h | 2 +- headers/atom.h | 4 ++-- headers/coord3d.h | 2 +- headers/coordsarray.h | 4 ++-- headers/mcopff.h | 6 +++--- headers/pdbio.h | 2 +- headers/rigidbody.h | 2 +- headers/screw.h | 4 ++-- ptools/__init__.py | 2 +- ptools/commands/heligeom_cmd.py | 6 +++--- ptools/docking.py | 10 +++++----- ptools/reduce.py | 6 +++--- src/DNA.cpp | 6 +++--- src/Movement.cpp | 2 +- src/atom.cpp | 4 ++-- src/attractforcefield.cpp | 4 ++-- src/coord3d.cpp | 2 +- src/coordsarray.cpp | 4 ++-- src/mcopff.cpp | 10 +++++----- src/pdbio.cpp | 2 +- src/rigidbody.cpp | 10 +++++----- 39 files changed, 114 insertions(+), 113 deletions(-) diff --git a/NAMES_TXN b/NAMES_TXN index 02ffa69..1a7a896 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -16,7 +16,7 @@ # createRigid create_rigid # CreateRigid create_rigid # crossproduct cross_product -## Dist2 dist2 +## Dist2 dist2 # Redundant change when no "(" is used # Dist dist # dotproduct dot_product # FindCenter find_center @@ -37,13 +37,13 @@ # PrintMatrix print_matrix # PrintParam print_param # PrintPDB print_pdb -### Print print +### Print print # Error when converting, not done # RadiusGyration radius_of_gyration # Radius radius # ## Reducer reducer # Reduce reduce # removeclosest remove_closest -# # rigidXMat44 rigidXMat44_CHANGEMANUALLY +# # rigidXMat44 rigidXMat44 # Will change manually, forgot why # Rmsd rmsd SelectAllAtoms select_all_atoms SelectAtomID select_atomid @@ -65,9 +65,9 @@ setTranslation set_translation Size size surfpointParams surfpoint_params syncCoords sync_coords -# toatom( to_atom( -# ToPdbString( to_pdb_string( -# toString( to_string( -# Translate( translate( -# unsafeGetCoords( unsafe_get_coords( -# WritePDB( write_pdb( +toatom to_atom +ToPdbString to_pdb_string +toString to_string +Translate translate +unsafeGetCoords unsafe_get_coords +WritePDB write_pdb diff --git a/README_NAMES b/README_NAMES index b08accf..f02ce6f 100644 --- a/README_NAMES +++ b/README_NAMES @@ -62,3 +62,4 @@ D. Detailed protocol: - specific filetypes: git checkout -- "*.py" "*.pyx" "*.cpp" "*.h" +8. I added new Makefile targets "undo" and "rename" for the commands often used in this branch diff --git a/Tests/__init__.py b/Tests/__init__.py index 2f13182..cfc3ef2 100644 --- a/Tests/__init__.py +++ b/Tests/__init__.py @@ -95,7 +95,7 @@ # --------------------------------------------------------------------------- # -# Translate test files +# translate test files # # --------------------------------------------------------------------------- diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index 96c3e4d..a9a71d1 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -102,8 +102,8 @@ Coord3D A, B; B = Coord3D(1.23, 6.33, 1.234); r.rotate(A,B, 2.2345); r2.rotate(A,B, 2.2345); - r.Translate(Coord3D(34.23, 123.45,11.972)); - r2.Translate(Coord3D(34.23, 123.45,11.972)); + r.translate(Coord3D(34.23, 123.45,11.972)); + r2.translate(Coord3D(34.23, 123.45,11.972)); r2.sync_coords(); // #same rotation and translation for r and r2: should have exact same coordinates @@ -138,27 +138,27 @@ Rigidbody rigid1, rigid2, rigid3; { Rigidbody rigtmp(rigid1); TS_ASSERT_EQUALS(rmsd(rigid1, rigid1), 0.0); - rigid1.Translate(Coord3D(4,0,0)); + rigid1.translate(Coord3D(4,0,0)); TS_ASSERT_EQUALS(rmsd(rigtmp, rigid1), 4); } void testTranslation1() { Coord3D CoM1 = rigid1.find_center() ; - rigid1.Translate(Coord3D(3.0, -55.67, 1)); + rigid1.translate(Coord3D(3.0, -55.67, 1)); Coord3D CoM2 = rigid1.find_center(); Coord3D diff=CoM2-CoM1; TS_ASSERT( Norm2(diff + Coord3D(-3.0, 55.67, -1.0)) < 1e-6); - rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)); //# translate back + rigid1.translate(Coord3D(-3.0, 55.67, -1.0)); //# translate back TS_ASSERT(rmsd(rigid1, rigid2) < 1e-6); } void testTranslation2(){ Coord3D vec1 = Coord3D (-123.54, 45.62, -99.003); Coord3D vec2 = Coord3D (36.3125, 2.78, -36.378); - rigid2.Translate(vec1+vec2); - rigid2.Translate(vec1-vec2); - rigid2.Translate(Coord3D() - 2*vec1) ; // #should be a global null translation + round error + rigid2.translate(vec1+vec2); + rigid2.translate(vec1-vec2); + rigid2.translate(Coord3D() - 2*vec1) ; // #should be a global null translation + round error TS_ASSERT(rmsd(rigid2, rigid3) < 1e-6); } @@ -198,7 +198,7 @@ class TestCoordsArray: public CxxTest::TestSuite void testBasicTranslation() { - c.Translate(tr); + c.translate(tr); Coord3D c1; Coord3D c2; c.get_coords(0, c1 ); @@ -213,7 +213,7 @@ class TestCoordsArray: public CxxTest::TestSuite with the rotation/translation 4x4 matrix. When user set the coordinates, this means: 'change the current coordinates of atom i' and not 'change the initial coordinates of atom i' so here we check that this is the case"""*/ - c.Translate(tr); //#do some translation + c.translate(tr); //#do some translation c.euler_rotate(2.0,4.0,5.0); // # do a rotation Coord3D co = Coord3D(3,2,1); // #new coordinates to be added c.set_coords(0,co); @@ -276,7 +276,7 @@ Rigidbody prot1; x = (random.random()-0.5)*50.0; y = (random.random()-0.5)*50.0; z = (random.random()-0.5)*50.0; - prot2.Translate(Coord3D(x,y,z)); + prot2.translate(Coord3D(x,y,z)); a = (random.random()-0.5)*50.0; b = (random.random()-0.5)*50.0; c = (random.random()-0.5)*50.0; @@ -336,7 +336,7 @@ class TestRot: public CxxTest::TestSuite r2.rotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); - r2.Translate(Coord3D(x,y,z)); + r2.translate(Coord3D(x,y,z)); Superpose_t s = superpose(r1,r2); @@ -361,7 +361,7 @@ class TestRot: public CxxTest::TestSuite r2.rotate(rdCoord(-20,20), rdCoord(-10,10), rdrange(-3.1415926,3.1415926) ); - r2.Translate(Coord3D(x,y,z)); + r2.translate(Coord3D(x,y,z)); Superpose_t s = superpose(r1,r2); @@ -370,7 +370,7 @@ class TestRot: public CxxTest::TestSuite Rigidbody r3; r3.rotate(v.point, v.point+v.unitVector, v.angle); - r3.Translate(v.normtranslation*v.unitVector); + r3.translate(v.normtranslation*v.unitVector); // r3.get_matrix().Print(); diff --git a/Tests/functional/test_translate.py b/Tests/functional/test_translate.py index 17becb4..75c0e43 100644 --- a/Tests/functional/test_translate.py +++ b/Tests/functional/test_translate.py @@ -9,7 +9,7 @@ TEST_TRANSLATE_OUTPUT) -class TestTranslate(unittest.TestCase): +class Testtranslate(unittest.TestCase): def setUp(self): self.output_file = mk_tmp_file() self.output_name = self.output_file.name diff --git a/Tests/test_attract_misc.py b/Tests/test_attract_misc.py index 77de007..80751ef 100644 --- a/Tests/test_attract_misc.py +++ b/Tests/test_attract_misc.py @@ -92,7 +92,7 @@ def test_find_analytical_solution_when_displaced_along_Y(self): atom = ligand.copy_atom(0) # Ligand position in file 5.0, 5.0, 0.0 # Minimum-energy ligand position is 5.0, 0.0, 0.0 - print "Ligand starting position: %s" % atom.ToPdbString() + print "Ligand starting position: %s" % atom.to_pdb_string() self.forcefield.addLigand(receptor) self.forcefield.addLigand(ligand) @@ -118,9 +118,9 @@ def test_find_analytical_solution_when_displaced_along_X_Y_Z(self): ligand = AttractRigidbody(TEST_TOYMINIM_LIGAND) # New starting ligand position 10.0, 5.0, 5.0 # Minimum-energy ligand position is 5.0, 0.0, 0.0 - ligand.Translate(Coord3D(5.0, 0.0, 5.0)) + ligand.translate(Coord3D(5.0, 0.0, 5.0)) atom = ligand.copy_atom(0) - print "Ligand starting position: %s" % atom.ToPdbString() + print "Ligand starting position: %s" % atom.to_pdb_string() self.forcefield.addLigand(receptor) self.forcefield.addLigand(ligand) diff --git a/Tests/test_coordsarray.py b/Tests/test_coordsarray.py index 6ee67ba..ae522d1 100644 --- a/Tests/test_coordsarray.py +++ b/Tests/test_coordsarray.py @@ -26,7 +26,7 @@ def testGetAtom(self): assertCoordsAlmostEqual(self, c1, Coord3D(3.0, 4.0, 5.0)) def testBasicTranslation(self): - self.c.Translate(self.tr) + self.c.translate(self.tr) c1 = Coord3D() c2 = Coord3D() self.c.get_coords(0, c1) @@ -40,7 +40,7 @@ def testset_coords(self): When user set the coordinates, this means: 'change the current coordinates of atom i' and not 'change the initial coordinates of atom i' so here we check that this is the case""" - self.c.Translate(self.tr) # do some translation + self.c.translate(self.tr) # do some translation self.c.euler_rotate(2.0, 4.0, 5.0) # do a rotation co = Coord3D(3, 2, 1) # new coordinates to be added self.c.set_coords(0, co) diff --git a/Tests/test_misc.py b/Tests/test_misc.py index f603bee..95635d8 100644 --- a/Tests/test_misc.py +++ b/Tests/test_misc.py @@ -19,7 +19,7 @@ def setUp(self): def testBasicrmsd(self): rigtmp = Rigidbody(self.rigid1) self.assertEqual(rmsd(self.rigid1, self.rigid1), 0.0) - self.rigid1.Translate(Coord3D(4, 0, 0)) + self.rigid1.translate(Coord3D(4, 0, 0)) self.assertEqual(rmsd(rigtmp, self.rigid1), 4) def testErrorsrmsd(self): @@ -44,19 +44,19 @@ def testrmsdAtomSelection2(self): def testTranslation1(self): CoM1 = self.rigid1.find_center() - self.rigid1.Translate(Coord3D(3.0, -55.67, 1)) + self.rigid1.translate(Coord3D(3.0, -55.67, 1)) CoM2 = self.rigid1.find_center() diff = CoM2 - CoM1 self.assertAlmostEqual(norm2(diff + Coord3D(-3.0, 55.67, -1.0)), 0.0) - self.rigid1.Translate(Coord3D(-3.0, 55.67, -1.0)) # translate back + self.rigid1.translate(Coord3D(-3.0, 55.67, -1.0)) # translate back self.assertAlmostEqual(rmsd(self.rigid1, self.rigid2), 0.0) def testTranslation2(self): vec1 = Coord3D(-123.54, 45.62, -99.003) vec2 = Coord3D(36.3125, 2.78, -36.378) - self.rigid2.Translate(vec1 + vec2) - self.rigid2.Translate(vec1 - vec2) - self.rigid2.Translate(Coord3D() - 2 * vec1) # should be a global null translation + round error + self.rigid2.translate(vec1 + vec2) + self.rigid2.translate(vec1 - vec2) + self.rigid2.translate(Coord3D() - 2 * vec1) # should be a global null translation + round error self.assertAlmostEqual(rmsd(self.rigid2, self.rigid3), 0) diff --git a/Tests/test_movement.py b/Tests/test_movement.py index 2da4a84..76c09af 100644 --- a/Tests/test_movement.py +++ b/Tests/test_movement.py @@ -163,7 +163,7 @@ def identity(n): def get_movement_matrix(mov): """Return a Movement matrix.""" - return string_to_matrix(mov.toString()) + return string_to_matrix(mov.to_string()) def string_to_matrix(s): diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index 19fe461..70567fd 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -32,8 +32,8 @@ def test_Rigidbody_has_unsafeget_coords(self): def test_Rigidbody_has_set_coords(self): self.assertTrue(hasattr(Rigidbody, 'set_coords')) - def test_Rigidbody_has_Translate(self): - self.assertTrue(hasattr(Rigidbody, 'Translate')) + def test_Rigidbody_has_translate(self): + self.assertTrue(hasattr(Rigidbody, 'translate')) def test_Rigidbody_has_find_center(self): self.assertTrue(hasattr(Rigidbody, 'find_center')) @@ -148,10 +148,10 @@ def testget_coords(self): coords = self.r.get_coords(3) assertCoordsAlmostEqual(self, coords, Coord3D(-16.159, 189.782, 106.402)) - def testTranslate(self): + def testtranslate(self): tr = Coord3D(3.2, 2.98, 14.22) s = Rigidbody(self.r) - s.Translate(tr) + s.translate(tr) coords = s.get_coords(3) ref = Coord3D(-16.159 + 3.2, 189.782 + 2.98, 106.402 + 14.22) assertCoordsAlmostEqual(self, coords, ref) @@ -189,8 +189,8 @@ def testUnsafeget_coords(self): B = Coord3D(1.23, 6.33, 1.234) self.r.rotate(A, B, 2.2345) r2.rotate(A, B, 2.2345) - self.r.Translate(Coord3D(34.23, 123.45, 11.972)) - r2.Translate(Coord3D(34.23, 123.45, 11.972)) + self.r.translate(Coord3D(34.23, 123.45, 11.972)) + r2.translate(Coord3D(34.23, 123.45, 11.972)) r2.sync_coords() # same rotation and translation for r and r2: should have exact diff --git a/Tests/test_superpose.py b/Tests/test_superpose.py index 4a7349a..874a424 100644 --- a/Tests/test_superpose.py +++ b/Tests/test_superpose.py @@ -44,7 +44,7 @@ def testTransRot(self): x = (random.random() - 0.5) * 50.0 y = (random.random() - 0.5) * 50.0 z = (random.random() - 0.5) * 50.0 - prot2.Translate(ptools.Coord3D(x, y, z)) + prot2.translate(ptools.Coord3D(x, y, z)) a = (random.random() - 0.5) * 50.0 b = (random.random() - 0.5) * 50.0 c = (random.random() - 0.5) * 50.0 diff --git a/bindings/atom.pyx b/bindings/atom.pyx index 3be2579..e925dc8 100644 --- a/bindings/atom.pyx +++ b/bindings/atom.pyx @@ -21,8 +21,8 @@ cdef extern from "atom.h" namespace "PTools": CppAtom(CppAtomproperty, CppCoord3D) string ToString() - string ToPdbString() - void Translate(CppCoord3D&) + string to_pdb_string() + void translate(CppCoord3D&) CppCoord3D coords cdef double cppdist "PTools::dist" (CppAtom& , CppAtom& ) @@ -180,11 +180,11 @@ cdef class Atom(Atomproperty): def __str__(self): return self.ToString() - def ToPdbString(self): - return (self.thisptr).ToPdbString().c_str() + def to_pdb_string(self): + return (self.thisptr).to_pdb_string().c_str() - def Translate(self,Coord3D co): - (self.thisptr).Translate(deref(co.thisptr)) + def translate(self,Coord3D co): + (self.thisptr).translate(deref(co.thisptr)) def dist(Atom at1, Atom at2): diff --git a/bindings/attractrigidbody.pyx b/bindings/attractrigidbody.pyx index 6609b98..c99d3a4 100644 --- a/bindings/attractrigidbody.pyx +++ b/bindings/attractrigidbody.pyx @@ -119,9 +119,9 @@ cdef class AttractRigidbody (Rigidbody) : return ret - def Translate(self, Coord3D co): + def translate(self, Coord3D co): cdef CppRigidbody* rig = self.thisptr - rig.Translate(deref(co.thisptr)) + rig.translate(deref(co.thisptr)) def euler_rotate(self, double phi, double ssi, double rot): cdef CppRigidbody* rig = self.thisptr diff --git a/bindings/coordsarray.pyx b/bindings/coordsarray.pyx index 10c965d..c176aab 100644 --- a/bindings/coordsarray.pyx +++ b/bindings/coordsarray.pyx @@ -7,7 +7,7 @@ cdef extern from "coordsarray.h" namespace "PTools": unsigned int size() void get_coords(unsigned int, CppCoord3D&) void set_coords(unsigned int, CppCoord3D&) - void Translate(CppCoord3D&) + void translate(CppCoord3D&) void euler_rotate(double , double, double) @@ -49,8 +49,8 @@ cdef class CoordsArray: def set_coords(self, i, Coord3D co): self.thisptr.set_coords(i, deref(co.thisptr)) - def Translate(self, Coord3D co): - self.thisptr.Translate(deref(co.thisptr)) + def translate(self, Coord3D co): + self.thisptr.translate(deref(co.thisptr)) def euler_rotate(self, double phi, double ssi, double rot): self.thisptr.euler_rotate(phi, ssi, rot) \ No newline at end of file diff --git a/bindings/movement.pyx b/bindings/movement.pyx index a77b291..daedf3a 100644 --- a/bindings/movement.pyx +++ b/bindings/movement.pyx @@ -24,7 +24,7 @@ cdef extern from "Movement.h" namespace "PTools": Array2D[double] m void apply(CppRigidbody&) void Print() const - string toString() const; + string to_string() const; cdef cppclass CppShift "PTools::Shift"(CppMovement): CppShift(double alpha) @@ -70,8 +70,8 @@ cdef class Movement: def Print(self): self.thisptr.Print() - def toString(self): - return self.thisptr.toString() + def to_string(self): + return self.thisptr.to_string() cdef class Shift(Movement): diff --git a/bindings/pdbio.pyx b/bindings/pdbio.pyx index 71741cf..0a472d5 100644 --- a/bindings/pdbio.pyx +++ b/bindings/pdbio.pyx @@ -3,18 +3,18 @@ from libcpp.string cimport string cdef extern from "pdbio.h" namespace "PTools": - cdef void CppWritePDB "PTools::WritePDB" (CppRigidbody&, string) + cdef void Cppwrite_pdb "PTools::write_pdb" (CppRigidbody&, string) cdef void CppReadAtom "PTools::readAtom" (string, CppAtom) except+ -def WritePDB(Rigidbody rig, bytes filename): +def write_pdb(Rigidbody rig, bytes filename): """writes a rigidbody object to a PDB file""" if rig is None: raise RuntimeError("expected Rigidbody, None given") cdef string cpp_filename = filename - CppWritePDB(deref(rig.thisptr), cpp_filename) + Cppwrite_pdb(deref(rig.thisptr), cpp_filename) def strToAtom(bytes line): diff --git a/bindings/rigidbody.pyx b/bindings/rigidbody.pyx index 64d7c55..a6266f5 100644 --- a/bindings/rigidbody.pyx +++ b/bindings/rigidbody.pyx @@ -22,7 +22,7 @@ cdef extern from "rigidbody.h" namespace "PTools": void unsafeget_coords(unsigned int, CppCoord3D &) void set_coords(unsigned int, CppCoord3D &) void rotate(CppCoord3D &, CppCoord3D &, double) - void Translate(CppCoord3D &) + void translate(CppCoord3D &) CppCoord3D find_center() void sync_coords() void euler_rotate(double, double, double) @@ -139,8 +139,8 @@ cdef class Rigidbody: def set_coords(self, int i, Coord3D co): self.thisptr.set_coords(i, deref(co.thisptr)) - def Translate(self, Coord3D tr): - self.thisptr.Translate(deref(tr.thisptr)) + def translate(self, Coord3D tr): + self.thisptr.translate(deref(tr.thisptr)) def find_center(self): cdef Coord3D c = Coord3D() diff --git a/headers/DNA.h b/headers/DNA.h index 5208e02..1a77346 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -41,7 +41,7 @@ namespace PTools std::string print_param(); ///write in a file the atoms data following the PDB format - void WritePDB(std::string); + void write_pdb(std::string); ///change the database use for the BasePair. the new database must contain the same names for pdb that the old one. void change_representation(std::string); @@ -60,7 +60,7 @@ namespace PTools ///apply a vector to the DNA as a rigidbody - void Translate(Coord3D coord); + void translate(Coord3D coord); ///return the local Matrix of the specified BasePair (for the position i the Matrix to go from i-1 to i) Matrix GetLocalMatrix(int pos)const; diff --git a/headers/Movement.h b/headers/Movement.h index 7ac16c6..dafbf0a 100644 --- a/headers/Movement.h +++ b/headers/Movement.h @@ -36,7 +36,7 @@ namespace PTools void Print() const; /// Return a string representing the Movement' matrix. - std::string toString() const; + std::string to_string() const; }; //fonction pour les matrices, a relocaliser dans la partie ptools adapter diff --git a/headers/atom.h b/headers/atom.h index 8a12db2..48712cb 100644 --- a/headers/atom.h +++ b/headers/atom.h @@ -79,10 +79,10 @@ struct Atom : public Atomproperty std::string ToString() const; /// convert atom (properties and coordinates) to classical PDB-like string - std::string ToPdbString() const ; + std::string to_pdb_string() const ; /// translation of an atom - void Translate(const Coord3D& tr); + void translate(const Coord3D& tr); }; diff --git a/headers/coord3d.h b/headers/coord3d.h index c09d26d..347b978 100644 --- a/headers/coord3d.h +++ b/headers/coord3d.h @@ -24,7 +24,7 @@ struct Coord3D inline bool operator==(const Coord3D& b) {return (b.x==x && b.y==y && b.z==z); }; Coord3D& Normalize(); ///< Normalize vector to unity (in place) - std::string toString(bool newline=true); + std::string to_string(bool newline=true); }; diff --git a/headers/coordsarray.h b/headers/coordsarray.h index d8335b7..0b26c37 100644 --- a/headers/coordsarray.h +++ b/headers/coordsarray.h @@ -102,8 +102,8 @@ class CoordsArray void set_coords(const uint k, const Coord3D& co); - /// Translate the whole object - void Translate(const Coord3D& tr); + /// translate the whole object + void translate(const Coord3D& tr); /// Euler Rotation void euler_rotate(dbl phi, dbl ssi, dbl rot); diff --git a/headers/mcopff.h b/headers/mcopff.h index 77b914c..ab40cee 100644 --- a/headers/mcopff.h +++ b/headers/mcopff.h @@ -33,11 +33,11 @@ std::vector _copies; }; - void Translate(const Coord3D& co) + void translate(const Coord3D& co) { for(uint i =0; i< _copies.size(); ++i) { - _copies[i].Translate(co); + _copies[i].translate(co); } }*/ @@ -68,7 +68,7 @@ class Mcoprigid //multicopy rigidbody void euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot); - void Translate(const Coord3D& c); + void translate(const Coord3D& c); void PrintWeights(); diff --git a/headers/pdbio.h b/headers/pdbio.h index 7d76d00..6fb0b9a 100644 --- a/headers/pdbio.h +++ b/headers/pdbio.h @@ -19,7 +19,7 @@ namespace PTools void readAtom(const std::string & line, Atom& at); ///< create an Atom from a PDB-formatted string void ReadPDB(std::istream& fichier,Rigidbody& protein ); ///< read a PDB file from a file pointer and load data in Rigidbody void ReadPDB(const std::string name,Rigidbody& protein ); ///< read a PDB file from a filename and load data in Rigidbody -void WritePDB(const Rigidbody& rigid, std::string filename); ///< write a PDB file given a Rigidbody and a filename +void write_pdb(const Rigidbody& rigid, std::string filename); ///< write a PDB file given a Rigidbody and a filename } diff --git a/headers/rigidbody.h b/headers/rigidbody.h index a2380bf..f20bd50 100644 --- a/headers/rigidbody.h +++ b/headers/rigidbody.h @@ -141,7 +141,7 @@ class Rigidbody:private CoordsArray /// translate the whole object - void Translate(const Coord3D& tr); + void translate(const Coord3D& tr); /// apply a 4x4 matrix void apply_matrix(const Matrix & mat); diff --git a/headers/screw.h b/headers/screw.h index 09bc048..384bd14 100644 --- a/headers/screw.h +++ b/headers/screw.h @@ -43,10 +43,10 @@ struct Screw std::string print() { std::stringstream result; - result << "rotation axis: " << unitVector.toString() ; + result << "rotation axis: " << unitVector.to_string() ; result << "angle: " << angle << "\n" ; result << "translation norm: " << Norm(unitVector) << "\n" ; - result << "axis point: " << point.toString(); + result << "axis point: " << point.to_string(); return result.str(); } }; diff --git a/ptools/__init__.py b/ptools/__init__.py index 09f36ca..8380ce0 100644 --- a/ptools/__init__.py +++ b/ptools/__init__.py @@ -9,7 +9,7 @@ Coord3D, CoordsArray, DNA, dist, dist2, Lbfgs, Matrix, mat44_to_screw, Movement, Rigidbody, Rise, rmsd, Roll, ScorpionForceField, Screw, Shift, Slide, - Superpose_t, Surface, Tilt, Twist, Version, WritePDB, + Superpose_t, Surface, Tilt, Twist, Version, write_pdb, cross_product, dot_product, norm, norm2, strToAtom, superpose) diff --git a/ptools/commands/heligeom_cmd.py b/ptools/commands/heligeom_cmd.py index 31fe16f..cfe0bd0 100644 --- a/ptools/commands/heligeom_cmd.py +++ b/ptools/commands/heligeom_cmd.py @@ -147,7 +147,7 @@ def groove_width_calculation(hp, mono1): for j in xrange(nbpoint): ldist = [] start.rotate(O, O + axe, hp.angle / nbpoint) - start.Translate(axe * hp.normtranslation / nbpoint) + start.translate(axe * hp.normtranslation / nbpoint) for k in xrange(int(round(dmin + (dmax - dmin) / 2)), int(round(dmax))): pstart = getpstart(start, hp, k, k) @@ -213,7 +213,7 @@ def extend(hp, mono1, nb, Z=False, seq=False): i += 1 for j in xrange(nb - 1): monoTest.rotate(O, O + axe, hp.angle) - monoTest.Translate(axe * hp.normtranslation) + monoTest.translate(axe * hp.normtranslation) monoTest = changeChain(monoTest, string.ascii_uppercase[i % 26]) if seq: print(monoTest.print_pdb()) @@ -263,7 +263,7 @@ def heliConstruct(mono1, hp, N, Z=False, seq=False, writefile=None): else: if writefile is not None: # Write to file with name provided - ptools.WritePDB(final, writefile) + ptools.write_pdb(final, writefile) return final diff --git a/ptools/docking.py b/ptools/docking.py index 33317c2..ae5b04a 100644 --- a/ptools/docking.py +++ b/ptools/docking.py @@ -130,9 +130,9 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, receptor = ptools.AttractRigidbody(rec) center = ligand.find_center() - ligand.Translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 + ligand.translate(ptools.Coord3D() - center) # set ligand center of mass to 0,0,0 ligand.euler_rotate(surreal(rot[0]), surreal(rot[1]), surreal(rot[2])) - ligand.Translate(trans) + ligand.translate(trans) for minim in minimlist: minimcounter += 1 @@ -160,10 +160,10 @@ def run_attract(lig, rec, translations, rotations, minimlist, ff_specs, options, output = ptools.AttractRigidbody(ligand) center = output.find_center() - output.Translate(ptools.Coord3D() - center) + output.translate(ptools.Coord3D() - center) output.euler_rotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) - output.Translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) - output.Translate(center) + output.translate(ptools.Coord3D(surreal(X[3]), surreal(X[4]), surreal(X[5]))) + output.translate(center) ligand = ptools.AttractRigidbody(output) diff --git a/ptools/reduce.py b/ptools/reduce.py index ae2099c..bfc838e 100644 --- a/ptools/reduce.py +++ b/ptools/reduce.py @@ -79,14 +79,14 @@ def name(self, value): """Set bead name.""" self.atomType = value - def toatom(self): + def to_atom(self): """Return a ptools.Atom instance with current bead properties and coordinates.""" return ptools.Atom(self, self.coords) def topdb(self): """Return the bead description as a PDB formatted string.""" - return self.toatom().ToPdbString() + return self.to_atom().to_pdb_string() def is_incomplete(self): """Return True if the number of atoms found to build the bead is @@ -516,7 +516,7 @@ def print_output_model(self, path=''): """ forcefield = self.forcefield header = 'HEADER {} REDUCED PDB FILE'.format(forcefield) - content = '\n'.join(bead.toatom().ToPdbString() for bead in self.beads) + content = '\n'.join(bead.to_atom().to_pdb_string() for bead in self.beads) f = sys.stdout if path: f = open(path, 'wt') diff --git a/src/DNA.cpp b/src/DNA.cpp index 9bfbc60..9e1f848 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -573,7 +573,7 @@ string DNA::print_param() } -void DNA::WritePDB(std::string fileName) +void DNA::write_pdb(std::string fileName) { ofstream myfile; myfile.open(fileName.c_str()); @@ -868,13 +868,13 @@ void DNA::change_type(int pos, std::string type, std::string filename) { ChangeFormat(); } -void DNA::Translate(Coord3D coord) +void DNA::translate(Coord3D coord) { unsigned int strandsize = strand.size(); for (unsigned int i=0; i atomType.c_str(); @@ -44,7 +44,7 @@ std::string Atom::ToPdbString() const } //! translate an atom with a Coord3D vector -void Atom::Translate(const Coord3D& tr) +void Atom::translate(const Coord3D& tr) { coords = coords+tr; } diff --git a/src/attractforcefield.cpp b/src/attractforcefield.cpp index a38d112..5c82d93 100644 --- a/src/attractforcefield.cpp +++ b/src/attractforcefield.cpp @@ -368,12 +368,12 @@ dbl BaseAttractForceField::Function(const Vdouble& stateVars ) } - m_movedligand[i].Translate(m_ligcenter[i]); + m_movedligand[i].translate(m_ligcenter[i]); if (m_movedligand[i].hastranslation) { assert(svptr+2 < stateVars.size()); - m_movedligand[i].Translate(Coord3D(stateVars[svptr],stateVars[svptr+1],stateVars[svptr+2])); + m_movedligand[i].translate(Coord3D(stateVars[svptr],stateVars[svptr+1],stateVars[svptr+2])); svptr+=3; } diff --git a/src/coord3d.cpp b/src/coord3d.cpp index 47cd4f2..bf8f741 100644 --- a/src/coord3d.cpp +++ b/src/coord3d.cpp @@ -15,7 +15,7 @@ Coord3D& Coord3D::Normalize(){ -std::string Coord3D::toString(bool newline) +std::string Coord3D::to_string(bool newline) { std::stringstream result; result << x << " " << y << " " << z ; diff --git a/src/coordsarray.cpp b/src/coordsarray.cpp index dce572a..944f0b8 100644 --- a/src/coordsarray.cpp +++ b/src/coordsarray.cpp @@ -61,7 +61,7 @@ CoordsArray::CoordsArray(const CoordsArray & ca) //copy constructor } -void CoordsArray::Translate(const Coord3D& tr) +void CoordsArray::translate(const Coord3D& tr) { //updates rotation/translation matrix: this->mat44[0][3]+=tr.x; @@ -190,7 +190,7 @@ _modified(); * * Note that for this new implementation only the 4x4 rotational/translational * matrix is updated. This may allow a big speedup (to be tested) and a -* higher flexibility ( rig.Translate(a); rig.Translate(minus(a)); may now be delayed +* higher flexibility ( rig.translate(a); rig.translate(minus(a)); may now be delayed * until the coordinates are really needed. * If coordinates are never asked (why?), then no costly calculation is performed ! */ diff --git a/src/mcopff.cpp b/src/mcopff.cpp index 262100b..e92fa82 100644 --- a/src/mcopff.cpp +++ b/src/mcopff.cpp @@ -40,15 +40,15 @@ void Mcoprigid::euler_rotate(const dbl& phi, const dbl& ssi, const dbl& rot) } -void Mcoprigid::Translate(const Coord3D& c) +void Mcoprigid::translate(const Coord3D& c) { //translates the main body: - _main.Translate(c); + _main.translate(c); //for each multicopy region, translates the copy: for (uint i=0; i < _vregion.size(); i++) for (uint j=0; j<_vregion[i].size(); j++) - _vregion[i][j].Translate(c); + _vregion[i][j].translate(c); } @@ -157,7 +157,7 @@ dbl McopForceField::Function(const Vdouble & v) lig.euler_rotate(v[0],v[1],v[2]); - lig.Translate(Coord3D(v[3],v[4],v[5])); + lig.translate(Coord3D(v[3],v[4],v[5])); //2) calculates the energy @@ -259,7 +259,7 @@ for (uint i=0; i <_receptor._vregion.size(); i++) } //TODO DEBUG: -std::cout << "differences between the two forces: " << (ligtransForces - receptortransForces).toString() << std::endl ; +std::cout << "differences between the two forces: " << (ligtransForces - receptortransForces).to_string() << std::endl ; } diff --git a/src/pdbio.cpp b/src/pdbio.cpp index f07bc45..72cfdb5 100644 --- a/src/pdbio.cpp +++ b/src/pdbio.cpp @@ -195,7 +195,7 @@ void ReadPDB(const std::string name,Rigidbody& protein ) { } -void WritePDB(const Rigidbody& rigid, std::string filename) +void write_pdb(const Rigidbody& rigid, std::string filename) { FILE* file= fopen(filename.c_str(),"w") ; diff --git a/src/rigidbody.cpp b/src/rigidbody.cpp index cfdc615..34e6feb 100644 --- a/src/rigidbody.cpp +++ b/src/rigidbody.cpp @@ -112,7 +112,7 @@ Coord3D Rigidbody::find_center() const void Rigidbody::CenterToOrigin() { Coord3D c = find_center(); - Translate(Coord3D()-c); + translate(Coord3D()-c); } dbl Rigidbody::radius_of_gyration() @@ -142,9 +142,9 @@ dbl Rigidbody::radius() } -void Rigidbody::Translate(const Coord3D& tr) +void Rigidbody::translate(const Coord3D& tr) { - CoordsArray::Translate(tr); + CoordsArray::translate(tr); } void Rigidbody::euler_rotate(dbl phi, dbl ssi, dbl rot) @@ -308,10 +308,10 @@ std::string Rigidbody::print_pdb() const for (uint i=0; i < size-1 ; i++) { Atom at(mAtomProp[i], this->get_coords(i)); - output = output + at.ToPdbString() + "\n" ; + output = output + at.to_pdb_string() + "\n" ; } Atom at(mAtomProp[size-1], this->get_coords(size-1)); - output += at.ToPdbString(); // append the last pdb string, without "\n" + output += at.to_pdb_string(); // append the last pdb string, without "\n" return output; From cbbdf0775b3f48b679f2237229b160dd9faacdc3 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Thu, 27 Jul 2017 18:02:34 +0200 Subject: [PATCH 16/22] Renames finished for now. All tests pass. --- CHANGELOG | 4 ++++ NAMES_TXN | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 29954ad..eee0468 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,3 +26,7 @@ - modify setup.py to compile lbfgsb.f directly - added chrg_scorpion_wrap.cpp to interface with chrg_scorpion.f - shortened test for reduce scorpion --cgopt + +25-26 July 2017 CHR +- renamed 69 method names (.py, .pyx, .cpp, .h) to lowercase with underscores, except Print. +- Complete list in NAMES_TXN diff --git a/NAMES_TXN b/NAMES_TXN index 1a7a896..a499773 100644 --- a/NAMES_TXN +++ b/NAMES_TXN @@ -40,7 +40,7 @@ ### Print print # Error when converting, not done # RadiusGyration radius_of_gyration # Radius radius -# ## Reducer reducer +# ## Reducer reducer # Redundant change when no "(" is used # Reduce reduce # removeclosest remove_closest # # rigidXMat44 rigidXMat44 # Will change manually, forgot why From 446057c30fc9ccda5df731f5540a8352335ccb4f Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Fri, 28 Jul 2017 11:07:41 +0200 Subject: [PATCH 17/22] (remove temporary files used for renaming) --- CLASS_NAMES_PYTHON | 23 ---- METHOD_NAMES | 71 ------------ METHOD_NAMES_TXN | 73 ------------ NAMES | 267 -------------------------------------------- NAMES_TXN | 73 ------------ NAMES_TXN_all | 73 ------------ NAMES_WITH_CONTEXT | 273 --------------------------------------------- README_NAMES | 65 ----------- TEST_TXN | 2 - names.py | 155 ------------------------- test.T | 1 - test.T_ori | 1 - 12 files changed, 1077 deletions(-) delete mode 100644 CLASS_NAMES_PYTHON delete mode 100644 METHOD_NAMES delete mode 100644 METHOD_NAMES_TXN delete mode 100644 NAMES delete mode 100644 NAMES_TXN delete mode 100644 NAMES_TXN_all delete mode 100644 NAMES_WITH_CONTEXT delete mode 100644 README_NAMES delete mode 100644 TEST_TXN delete mode 100644 names.py delete mode 100644 test.T delete mode 100644 test.T_ori diff --git a/CLASS_NAMES_PYTHON b/CLASS_NAMES_PYTHON deleted file mode 100644 index d9639cc..0000000 --- a/CLASS_NAMES_PYTHON +++ /dev/null @@ -1,23 +0,0 @@ -Extractor -AttractPairList -AttractRigidbody -Rigidbody -BasePair -DNA -BDNA -Twist -Rise -Roll -Tilt -Screw -Shift -Twist -Surface -Coord3D -Matrix -Atom -Atomproperty -FillAtom -NamedTemporaryFile -OptionParser -StringIO diff --git a/METHOD_NAMES b/METHOD_NAMES deleted file mode 100644 index e70e5bd..0000000 --- a/METHOD_NAMES +++ /dev/null @@ -1,71 +0,0 @@ -ABrotate -Add -AddAtom -AddCoord -addfinalizer -AddLigand -ApplyLocal -ApplyMatrix -Apply -AttractEulerRotate -Backbone -CA -ChangeRepresentation -ChangeType -CopyAtom -createRigid -CreateRigid -Dist -Dist2 -FindCenter -GetAtomProperty -GetChainId -getCoords -GetCoords -GetMatrix -GetMinimizedVarsAtIter -GetMinimizedVars -GetNumberIter -GetResidId -GetRigidBody -getStructure -GetType -getVdw -MatTrans2screw -Print -PrintMatrix -PrintParam -PrintPDB -Radius -RadiusGyration -Reduce -Reducer -removeclosest -rigidXMat44 -Rmsd -SelectAllAtoms -SelectAtomID -SelectAtomType -SelectChainId -SelectResidType -SelectResRange -SetAtom -SetAtomProperty -SetChainId -setCoords -SetCoords -setdefault -SetResidId -SetRestraint -SetRigid -setRotation -setTranslation -Size -surfpointParams -syncCoords -toatom -ToPdbString -toString -Translate -unsafeGetCoords -WritePDB diff --git a/METHOD_NAMES_TXN b/METHOD_NAMES_TXN deleted file mode 100644 index 8f8fc48..0000000 --- a/METHOD_NAMES_TXN +++ /dev/null @@ -1,73 +0,0 @@ -ABrotate rotate -AddAtom add_atom -AddCoord add_coord -Add add -addfinalizer add_finalizer -AddLigand add_ligand -ApplyLocal apply_local -ApplyMatrix apply_matrix -Apply apply -AttractEulerRotate euler_rotate -Backbone backbone -CA get_CA -ChangeRepresentation change_representation -ChangeType change_type -CopyAtom copy_atom -createRigid create_rigid -CreateRigid create_rigid -crossproduct cross_product -Dist2 dist2 -Dist dist -dotproduct dot_product -FindCenter find_center -GetAtomProperty get_atom_property -GetChainId get_chainid -getCoords get_coords -GetCoords get_coords -GetMatrix get_matrix -GetMinimizedVarsAtIter get_minimized_vars_at_iter -GetMinimizedVars get_minimized_vars -GetNumberIter get_number_iter -GetResidId get_resid -GetRigidBody get_rigid -getStructure get_structure -GetType get_type -getVdw get_vdw -MatTrans2screw mat44_to_screw -PrintMatrix print_matrix -PrintParam print_param -PrintPDB print_pdb -Print print -RadiusGyration radius_of_gyration -Radius radius -Reducer reducer -Reduce reduce -removeclosest remove_closest -rigidXMat44 rigidXMat44_CHANGEMANUALLY -Rmsd rmsd -SelectAllAtoms select_all_atoms -SelectAtomID select_atomid -SelectAtomType select_atomtype -SelectChainId select_chainid -SelectResidType select_restype -SelectResRange select_resid_range -SetAtomProperty set_atom_property -SetAtom set_atom -SetChainId set_chainid -setCoords set_coords -SetCoords set_coords -setdefault set_default -SetResidId set_resid -SetRestraint set_restraint -SetRigid set_rigid -setRotation set_rotation -setTranslation set_translation -Size size -surfpointParams surfpoint_params -syncCoords sync_coords -toatom to_atom -ToPdbString to_pdb_string -toString to_string -Translate translate -unsafeGetCoords unsafe_get_coords -WritePDB write_pdb diff --git a/NAMES b/NAMES deleted file mode 100644 index 77e1987..0000000 --- a/NAMES +++ /dev/null @@ -1,267 +0,0 @@ -ABrotate -abspath -add -Add -AddAtom -AddCoord -addfinalizer -AddLigand -add_argument -add_mutually_exclusive_group -add_option -add_parser -add_subparsers -ADNA -append -Apply -ApplyLocal -ApplyMatrix -apply_matrix -ArgumentParser -assertAlmostEqual -assertEqual -assertFalse -assertLess -assertListEqual -assertMatrixAlmostEqual -assertNotEqual -assertRaises -assertRaisesRegexp -assertSameDimensions -assertTrue -assert_equal -atan -Atom -AttractEulerRotate -AttractPairList -AttractRigidbody -b64decode -b64encode -Backbone -BasePair -BDNA -CA -ceil -center_to_origin -ChangeRepresentation -ChangeType -check_composition -check_ff_version_match -check_file_exists -close -cmp -compile -compress -compress_file -Coord3D -CopyAtom -copyfile -cos -Counter -create -createRigid -CreateRigid -create_subparser -critical -decompress -dedent -deepcopy -degrees -detach -dirname -DNA -endswith -error -exception_names_to_exception_list -exists -exit -exp -extend -Extractor -fabs -FillAtom -finalize_options -FindCenter -floor -flush -format -format_matrix -from_file -from_stream -from_string -func -get -GetAtomProperty -GetChainId -getCoords -GetCoords -getcwd -GetMatrix -getmembers -GetMinimizedVars -GetMinimizedVarsAtIter -GetNumberIter -getopt -GetResidId -GetRigidBody -getStructure -GetType -get_atom_charges_map -get_atom_radii_map -get_config_vars -get_group -get_matrix -get_rotation -get_tag_delimiter -get_translation -glob -group -groupby -groupdict -groups -has_duplicate_atoms -index -info -initialize_options -insert -isclass -is_incomplete -items -iteritems -join -keys -load -main -match -Matrix -MatTrans2screw -minimize -Movement -NamedTemporaryFile -nonbon8 -Normalize -not_ -now -number_of_minimizations -number_of_rotations -number_of_translations -open -optimize -optimize_charges -OptionParser -outergrid -parse_args -parse_attract_output -parse_command_line -pop -Popen -Print -PrintMatrix -PrintParam -PrintPDB -print_help -print_output_model -radians -Radius -RadiusGyration -random -randrange -read -readline -readlines -readouterr -read_aminon -read_attract_output -read_attract_parameters -read_forcefield_from_reduced -read_name_conversion_file -read_reduction_parameters -read_rotations -read_rotdat -read_topology -read_translations -realpath -reduce -Reduce -Reducer -remove -removeclosest -rename_atoms_and_residues -replace -residuetag -residue_reduction_errors -reverse -Rigidbody -rigidXMat44 -Rise -Rmsd -Roll -run_attract -Screw -search -seed -seek -SelectAllAtoms -SelectAtomID -SelectAtomType -SelectChainId -SelectResidType -SelectResRange -SetAtom -SetAtomProperty -SetChainId -SetCoords -setCoords -setdefault -SetResidId -SetRestraint -SetRigid -setRotation -setTranslation -set_coords -set_defaults -set_verbosity -Shift -sin -size -Size -skipif -Slide -sort -split -splitlines -sqrt -start -startswith -stat -strftime -StringIO -strip -sub -subDNA -SubDNA -submit -superpose -Surface -surfpoint -surfpointParams -syncCoords -system -tan -Tilt -toatom -ToPdbString -toString -Translate -Twist -uniform -unsafeGetCoords -upper -urlopen -values -walk -warn -warning -write -writelines -WritePDB diff --git a/NAMES_TXN b/NAMES_TXN deleted file mode 100644 index a499773..0000000 --- a/NAMES_TXN +++ /dev/null @@ -1,73 +0,0 @@ -# ABrotate rotate -# AddAtom add_atom -# AddCoord add_coord -# Add add -# addfinalizer add_finalizer -# AddLigand add_ligand -# ApplyLocal apply_local -# ApplyMatrix apply_matrix -# Apply apply -# AttractEulerRotate euler_rotate -# Backbone backbone -# CA( get_CA( -# ChangeRepresentation change_representation -# ChangeType change_type -# CopyAtom copy_atom -# createRigid create_rigid -# CreateRigid create_rigid -# crossproduct cross_product -## Dist2 dist2 # Redundant change when no "(" is used -# Dist dist -# dotproduct dot_product -# FindCenter find_center -# GetAtomProperty get_atom_property -# GetChainId get_chainid -# getCoords get_coords -# GetCoords get_coords -# GetMatrix get_matrix -# GetMinimizedVarsAtIter get_minimized_vars_at_iter -# GetMinimizedVars get_minimized_vars -# GetNumberIter get_number_iter -# GetResidId get_resid -# GetRigidBody get_rigid -# getStructure get_structure -# GetType get_type -# getVdw get_vdw -# MatTrans2screw mat44_to_screw -# PrintMatrix print_matrix -# PrintParam print_param -# PrintPDB print_pdb -### Print print # Error when converting, not done -# RadiusGyration radius_of_gyration -# Radius radius -# ## Reducer reducer # Redundant change when no "(" is used -# Reduce reduce -# removeclosest remove_closest -# # rigidXMat44 rigidXMat44 # Will change manually, forgot why -# Rmsd rmsd -SelectAllAtoms select_all_atoms -SelectAtomID select_atomid -SelectAtomType select_atomtype -SelectChainId select_chainid -SelectResidType select_restype -SelectResRange select_resid_range -SetAtomProperty set_atom_property -SetAtom set_atom -SetChainId set_chainid -setCoords set_coords -SetCoords set_coords -setdefault set_default -SetResidId set_resid -SetRestraint set_restraint -SetRigid set_rigid -setRotation set_rotation -setTranslation set_translation -Size size -surfpointParams surfpoint_params -syncCoords sync_coords -toatom to_atom -ToPdbString to_pdb_string -toString to_string -Translate translate -unsafeGetCoords unsafe_get_coords -WritePDB write_pdb diff --git a/NAMES_TXN_all b/NAMES_TXN_all deleted file mode 100644 index 8704bb2..0000000 --- a/NAMES_TXN_all +++ /dev/null @@ -1,73 +0,0 @@ -ABrotate( rotate( -AddAtom( add_atom( -AddCoord( add_coord( -Add( add( -addfinalizer( add_finalizer( -AddLigand( add_ligand( -ApplyLocal( apply_local( -ApplyMatrix( apply_matrix( -Apply( apply( -AttractEulerRotate( euler_rotate( -Backbone( backbone( -CA( get_CA( -ChangeRepresentation( change_representation( -ChangeType( change_type( -CopyAtom( copy_atom( -createRigid( create_rigid( -CreateRigid create_rigid( -crossproduct( cross_product( -Dist2( dist2( -Dist( dist( -dotproduct( dot_product( -FindCenter( find_center( -GetAtomProperty( get_atom_property( -GetChainId( get_chainid( -getCoords( get_coords( -GetCoords( get_coords( -GetMatrix( get_matrix( -GetMinimizedVarsAtIter( get_minimized_vars_at_iter( -GetMinimizedVars( get_minimized_vars( -GetNumberIter( get_number_iter( -GetResidId( get_resid( -GetRigidBody( get_rigid( -getStructure( get_structure( -GetType( get_type( -getVdw( get_vdw( -MatTrans2screw( mat44_to_screw( -PrintMatrix( print_matrix( -PrintParam( print_param( -PrintPDB( print_pdb( -Print( print( -RadiusGyration radius_of_gyration( -Radius( radius( -Reducer( reducer( -Reduce( reduce( -removeclosest remove_closest( -rigidXMat44( rigidXMat44_CHANGEMANUALLY( -Rmsd( rmsd( -SelectAllAtoms( select_all_atoms( -SelectAtomID( select_atomid( -SelectAtomType( select_atomtype( -SelectChainId( select_chainid( -SelectResidType( select_restype( -SelectResRange select_resid_range( -SetAtomProperty( set_atom_property( -SetAtom( set_atom( -SetChainId( set_chainid( -setCoords( set_coords( -SetCoords( set_coords( -setdefault( set_default( -SetResidId( set_resid( -SetRestraint( set_restraint( -SetRigid( set_rigid( -setRotation( set_rotation( -setTranslation( set_translation( -Size( size( -surfpointParams( surfpoint_params( -syncCoords( sync_coords( -toatom( to_atom( -ToPdbString( to_pdb_string( -toString( to_string( -Translate( translate( -unsafeGetCoords( unsafe_get_coords( -WritePDB( write_pdb( diff --git a/NAMES_WITH_CONTEXT b/NAMES_WITH_CONTEXT deleted file mode 100644 index 829f76e..0000000 --- a/NAMES_WITH_CONTEXT +++ /dev/null @@ -1,273 +0,0 @@ -ABrotate : #bestok.ABrotate( hp.point, hp.point + hp.unitVector, hp.angle ) -abspath : return os.path.abspath(dirname) -add : tot.add(d2) -Add : dna.Add(new,mov) -AddAtom : newRig.AddAtom(a) -AddCoord : c.AddCoord(coo2) -addfinalizer : request.addfinalizer(teardown) -AddLigand : forcefield.AddLigand(lig) -add_argument : parser.add_argument('-o', '--output', -add_mutually_exclusive_group : group = parser.add_mutually_exclusive_group() -add_option : parser.add_option("--after", action="store", type="string", dest="chaft", help="sequence to be added at the 3-extremity of the DNA") -add_parser : parser = parent.add_parser('extract', help=__doc__) -add_subparsers : subparsers = parser.add_subparsers() -ADNA : mov = ptools.ADNA() -append : axislist.append(model) -Apply : newPB.Apply(m) -ApplyLocal : dna.ApplyLocal(Roll(30), dna.Size() / 2) -ApplyMatrix : mobil.ApplyMatrix(m) -apply_matrix : ligand.apply_matrix(m) -ArgumentParser : parser = argparse.ArgumentParser(description=__doc__, -assertAlmostEqual : self.assertAlmostEqual(ener, -51.6955215854) -assertEqual : self.assertEqual(dna.Size(), 231) -assertFalse : self.assertFalse(coordinates_equal(origin, self.r.FindCenter())) # assertEqual won't work -assertLess : self.assertLess(abs(dz + 5.0), tolerance) -assertListEqual : self.assertListEqual(ref, res) -assertMatrixAlmostEqual : self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) -assertNotEqual : self.assertNotEqual(s, '') -assertRaises : self.assertRaises(RuntimeError, Rmsd, "hello", self.rigid1) -assertRaisesRegexp : with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): -assertSameDimensions : self.assertSameDimensions(source, target) -assertTrue : self.assertTrue(filecmp.cmp(TEST_LIGAND_RED_SCORPION_CGOPT, self.output_name)) -assert_equal : errors += trans1.assert_equal(trans2) -atan : #beta = math.atan(hpori.normtranslation*2*math.pi/(2*rayon*hpori.angle)) -Atom : return ptools.Atom(self, self.coords) -Atomproperty : at = ptools.Atomproperty() -AttractEulerRotate : output.AttractEulerRotate(surreal(X[0]), surreal(X[1]), surreal(X[2])) -AttractPairList : pl = ptools.AttractPairList(receptor, ligand, surreal(500)) -AttractRigidbody : lig = ptools.AttractRigidbody(lig) -b64decode : compressed = base64.b64decode(f) -b64encode : encoded = base64.b64encode(compressed) -Backbone : ligBBInterface = ligprobe.Backbone() & selectListOfResidues(ligprobe,ligResidues) #interface bb residues of docked ligand -BasePair : bp = ptools.BasePair(self.dna[0].GetRigidBody()) -BDNA : mov = ptools.BDNA() -CA : refca = ref.CA() -ceil : if enerk(rec,templig,1+math.ceil(nbmono),144) > 10: -center_to_origin : self.r.center_to_origin() -ChangeRepresentation : dna.ChangeRepresentation(PB_AA) -ChangeType : dna.ChangeType(0, "A", TEST_BP_RED) -check_composition : coarse_res.check_composition() -check_ff_version_match : ff_name = ptools.io.check_ff_version_match(args.receptor_name, args.ligand_name) -check_file_exists : ptools.io.check_file_exists(args.ligand) -close : #f.close() -cmp : assert filecmp.cmp(TEST_SINGLEMINIM_MINIMIZATION_OUT, output_name) is True -compile : regexp = re.compile("[0-9]+:[0-9]+") # filter keys of the form "23:356" -compress : compressed = bz2.compress(all) -compress_file : print(docking.compress_file('attract.inp')) -Coord3D : axe = ptools.Coord3D(0, 0, 1) -CopyAtom : ABrotate( model.CopyAtom(0).GetCoords(), model.CopyAtom(1).GetCoords(), bp, math.radians(angle) ) -copyfile : shutil.copyfile(TEST_DOCKING_TRANSLATION, 'translation.dat') -cos : #axn = math.cos(beta) * axe + -math.sin(beta) * vectn/Norm(vectn) -Counter : counter = collections.Counter(self.found_atoms) -create : bead = beadcreator.create() -createRigid : rtot = tot.createRigid() -CreateRigid : #dnaRig= dnaRig + dna.CreateRigid() -create_subparser : translate_cmd.create_subparser(subparsers) -critical : ptools.io.critical("option --delgrid requires --ff=scorpion", -crossproduct : res = ptools.crossproduct(self.coo1, self.coo2) -decompress : file = bz2.decompress(compressed) -dedent : content = textwrap.dedent(""" -deepcopy : self._lstofAtoms = copy.deepcopy(lstofAtoms) -degrees : pitch = abs(hp.normtranslation*(360./(abs(math.degrees(hp.angle))))) -detach : self.mat.detach() -dirname : project_root = os.path.dirname(cwd) -Dist : tempdist = ptools.Dist(pstart.CopyAtom(0), sup.CopyAtom(k)) -DNA : dna = ptools.DNA(PDB_BASE_PAIR, PDB_DNA) -dotproduct : s = ptools.dotproduct(v, hp.unitVector) -endswith : if filename.endswith(suffix): -error : parser.error("please specify molecule type (--prot or --dna) and atomic file") -exception_names_to_exception_list : ignore_exceptions = ptools.exceptions.exception_names_to_exception_list(args.ignore_error) -exists : if not os.path.exists(name): -exit : sys.exit(1) -exp : #print >>sys.stderr, "*", i, oldener, newener, Rmsd(ref,ligTemp), fpib, delta, math.exp(-delta/ftemp) -extend : boolean_options.extend(['use_legacy_boost']) -Extractor : e = extract.Extractor(outputfile) # extracts output structures or reuse the generated database -fabs : nbb = 2*math.pi/math.fabs(hp.angle) -FillAtom : coarseResList[id].FillAtom(atom.atomType, atom.coords.x, atom.coords.y, atom.coords.z) -finalize_options : _build_ext.finalize_options(self) -FindCenter : pj = monoj.FindCenter() -floor : listn = [int(math.floor(nbb)), int(math.ceil(nbb))] -flush : file.flush() -format : copyright = u"{}, {}".format(datetime.datetime.now().year, AUTHORS) -format_matrix : other.format_matrix()) -from_file : return AttractOutput.from_file(path) -from_stream : return cls.from_stream(StringIO.StringIO(content)) -from_string : return AttractOutput.from_string(content) -func : args.func(args) -get : descriptions = beadCorresp.get(residname, []) -GetAtomProperty : ires = rtot.GetAtomProperty(i).GetResidId() -GetChainId : cc = at.GetChainId() -getCoords : coord = outergrid.getCoords(i) -GetCoords : X= Atom(at,proj.GetCoords()+(AB*distX)) -getcwd : cwd = os.getcwd() -GetMatrix : m=(Twist( 35.9063052632 )+Roll( -2.66592947368 )+Tilt( -1.80234789474 )+Slide( -1.34487389474 )+Shift( -0.425181378947 )).GetMatrix(); -getmembers : return [name for name, obj in inspect.getmembers(sys.modules[__name__]) -GetMinimizedVars : X = lbfgs_minimizer.GetMinimizedVars() # optimized freedom variables after minimization -GetMinimizedVarsAtIter : traj = lbfgs_minimizer.GetMinimizedVarsAtIter(iteration) -GetNumberIter : ntraj = lbfgs_minimizer.GetNumberIter() -getopt : options, patterns = getopt.getopt(sys.argv[1:], 'o:r:', -GetResidId : jres = ati.GetResidId() -GetRigidBody : bp = dna[i].GetRigidBody() -getStructure : lig3 = e.getStructure(lig, "%i:%i" % (transNB, rotNB)) -GetType : nami = ati.GetType() -get_atom_charges_map : aa_charges_map = self.get_atom_charges_map() -get_atom_radii_map : aa_radii_map = self.get_atom_radii_map() -get_config_vars : vars = sysconfig.get_config_vars() -get_group : translations = docking.get_group(translations, args.ngroups, args.ngroup) -get_matrix : m = docking_result.get_matrix(args.transid, args.rotid) -get_rotation : r = t.get_rotation(rotid) -get_tag_delimiter : tag_delimiter = ptools.Atomproperty.get_tag_delimiter() -get_translation : t = self.get_translation(transid) -glob : patternFiles = glob.glob(pathName) -group : addTest(suite, m.group(2), lineNo) -groupby : residue_list = itertools.groupby(self.atoms, -groupdict : minim = match.groupdict() -groups : g = m.groups() -has_duplicate_atoms : elif self.has_duplicate_atoms(): -index : print nb/2.,min(ldist),int(round(dmin+(dmax-dmin)/2))+ldist.index(min(ldist)) -info : log.info("{:s} found at {:s}".format(fortran_library_name, fortlib)) -initialize_options : _build_ext.initialize_options(self) -insert : sys.path.insert(0, project_root) -isclass : if inspect.isclass(obj) and issubclass(obj, ResidueReductionError)] -is_incomplete : if not bead.is_incomplete()] -items : for residname, cgnames in residNames.items(): -iteritems : for key, value in minim.iteritems(): -join : prgname = os.path.join(thispath, "reduce_attract2.py") -keys : if namo in equiv.keys(): -load : data = yaml.load(f) -main : unittest.main() -match : if regexp.match(k): -Matrix : self.mat = ptools.Matrix(self.nrows, self.ncols) -MatTrans2screw : hp = ptools.MatTrans2screw(ptools.superpose(mono2, mono1).matrix) -minimize : lbfgs_minimizer.minimize(niter) -Movement : mov = ptools.Movement() -NamedTemporaryFile : tmpfile = tempfile.NamedTemporaryFile(mode, **kwargs) -nonbon8 : ener = forcefield.nonbon8(rec,lig,pl) -norm : return ptools.norm(ptools.crossproduct(a, b)) -Normalize : AB.Normalize() -not_ : sel_not_ca = sel_ca.not_() # operator NOT -now : now = datetime.datetime.now() -number_of_minimizations : other.number_of_minimizations()) -number_of_rotations : return [t.number_of_rotations() for t in self.translations] -number_of_translations : other.number_of_translations()) -open : d = shelve.open(databasefile, flag='r') -optimize : optimized = cgopt.optimize(self.number_of_atoms, -optimize_charges : reducer.optimize_charges(args.delgrid) -OptionParser : parser = optparse.OptionParser(description='Process some integers.') -outergrid : outergrid = surf.outergrid(grid, rec, distance_to_receptor) -parse_args : (options, args) = parser.parse_args() -parse_attract_output : output_test = ptools.io.parse_attract_output(out) -parse_command_line : cmd_args = ptools_cli.parse_command_line(args) -pop : line = clean.pop(0).split() -Popen : return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0] -Print : self.mat.Print() -PrintMatrix : print lig.PrintMatrix() -PrintParam : for i in dna.PrintParam().split("\n"): -PrintPDB : print d.PrintPDB() -print_help : parser.print_help() -print_output_model : reducer.print_output_model(args.output) -print_pdb : print(final.print_pdb()) -radians : ABrotate (p, p+choice([vecti,vectj,vectk]), ligTemp, math.radians(uniform(-5, 5))) -Radius : radmax = rec.Radius() -RadiusGyration : radg = rec.RadiusGyration() -random : if random.random() <= math.exp(-delta) : -randrange : return random.randrange(-max_float, +max_float) -read : all = fobject.read() -readline : line = rotdat.readline().split() -readlines : lines = f.readlines() -readouterr : out, err = capfd.readouterr() -read_aminon : params = io.read_aminon(tmpfile.name) -read_attract_output : docking_result = ptools.io.read_attract_output(args.attract_output) -read_attract_parameters : nbminim, lignames, minimlist, rstk = ptools.io.read_attract_parameters(args.conf) -read_forcefield_from_reduced : io.read_forcefield_from_reduced(tmpfile.name) -read_name_conversion_file : self.read_name_conversion_file() -read_reduction_parameters : self.read_reduction_parameters() -read_rotations : rotations = docking.read_rotations() -read_rotdat : self.read_rotdat() -read_topology : self.read_topology() -read_translations : translations = docking.read_translations() -realpath : thisscript = os.path.realpath(__file__) -reduce : reducer.reduce(ignore_exceptions=ignore_exceptions) -Reduce : coarseRes = coarseResList[i].Reduce(resName, resId) -Reducer : reducer = ptools.reduce.Reducer(atomicname, redname) -remove : self._lstofAtoms.remove(atomtype) -removeclosest : outergrid = surf.removeclosest(outergrid, options.density) -rename_atoms_and_residues : self.rename_atoms_and_residues() -replace : return '"' + string.replace(str, '\\', '\\\\') + '"' -residuetag : key=lambda atom: atom.residuetag()) -residue_reduction_errors : args.ignore_error = ptools.exceptions.residue_reduction_errors() -reverse : cgch.reverse() -Rigidbody : ligand = ptools.Rigidbody(args.ligand) -rigidXMat44 : structure = extract.rigidXMat44(lig, s.ext.matrix) -Rise : mov = ptools.Rise(self.alpha) -Rmsd : return ptools.Rmsd(l1.CA().CreateRigid(), l2.CA().CreateRigid()) -Roll : mov = ptools.Roll(self.alpha) -run_attract : docking.run_attract(lig, rec, translations, rotations, minimlist, ff_specs, args, ref, ftraj) -Screw : self.s = ptools.Screw() -search : elif world_re.search(line): -seed : random.seed(42) -seek : tmpfile.seek(0) -SelectAllAtoms : monoTest = mono1.SelectAllAtoms().CreateRigid() -SelectAtomID : # lastpoint = axpdb.SelectAtomID(407).CreateRigid() # -SelectAtomType : sseg2 = seg2.SelectAtomType("C1'").CreateRigid() -SelectChainId : #m1= groove.SelectChainId("A").CreateRigid() -SelectResidType : met1A = self.rig.SelectResidType("MET") & self.rig.SelectResRange(1, 5) & self.rig.SelectChainId("A") -SelectResRange : seg2= lig.SelectResRange(4,7).CreateRigid () -SetAtom : self.r.SetAtom(3, atom) -SetAtomProperty : proch.SetAtomProperty(j,at) -SetChainId : at.SetChainId(letter) -setCoords : out.setCoords(i, coords2) -SetCoords : ato.SetCoords(coo) -setdefault : residuMap.setdefault(residueIdentifier, []).append(at) -SetResidId : atto.SetResidId(i+1) -SetRestraint : # forcefield.SetRestraint(rstk) -SetRigid : atsel.SetRigid(rigidbody) -setRotation : rec.setRotation(False) -setTranslation : rec.setTranslation(False) -set_coords : self.atom.set_coords(Coord3D(-12, 12, 17)) -set_defaults : parser.set_defaults(func=run) -set_verbosity : log.set_verbosity(log.INFO) -Shift : mov = ptools.Shift(self.alpha) -sin : raynew = rayon*math.sin(hpori.angle/2)/math.sin(angnew/2) -size : k2 = d2.size() -Size : bp = dna[dna.Size()-1].GetRigidBody() -skipif : #skip_on_osx = pytest.mark.skipif(sys.platform == 'darwin', -Slide : mov = ptools.Slide(self.alpha) -sort : lChain.sort() -split : shift +=float(i.split()[20]) -splitlines : lines = content.splitlines() -sqrt : distX = math.sqrt((D**2)-(startProj**2))#V -start : line = line[:e.start()] -startswith : elif ligne.startswith("MAT") : -stat : statout = os.stat(filename) -strftime : print "Finished at: ",now.strftime("%A %B %d %Y, %H:%M") -StringIO : fileobj = StringIO.StringIO(content) -strip : if line.strip() and not line.startswith('#'): -sub : return re.sub(r'\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(', -subDNA : dnat = tot.subDNA(k1, k1+kd) # ok -SubDNA : #ato13 = dna2.SubDNA(10,11).CreateRigid().CopyAtom(1) -submit : beadcreator.submit(atom) -superpose : m = ptools.superpose(Zaxis, Protaxis).matrix -Surface : surf = ptools.Surface(30, 30, SOLVATION_PARAMETER_FILE) -surfpoint : grid = surf.surfpoint(rec, 1.4) -surfpointParams : surf.surfpointParams(5000, distance_to_receptor) -syncCoords : r2.syncCoords() -system : os.system("python applyscrew.py X2.pdb X4.pdb ABC_5.pdb --ch %s --nb 1 > pentamer.pdb" %letter) -tan : #print "beta ", beta*180./math.pi, "tg(beta) ", math.tan(beta) -Tilt : mov = ptools.Tilt(self.alpha) -toatom : return self.toatom().ToPdbString() -ToPdbString : #print a.ToPdbString(), -toString : print >> sys.stderr,"P:\t"+screw.point.toString()+"omega:\t"+screw.unitVector.toString()+"theta angle:\t [radian] "+str(screw.angle)+"\t [degree] "+ str(math.degrees(screw.angle))+"\ntrans:\t"+str(screw.normtranslation) -Translate : ligTemp.Translate(choice([vecti,vectj,vectk])*(uniform(-3, 3))) -Twist : mov = ptools.Twist(self.alpha) -uniform : raytmp = raynew + random.uniform(-3, 3) -unsafeGetCoords : r2.unsafeGetCoords(i, co2) -upper : ff = get_header_tokens()[1].upper() -urlopen : pdb = urllib2.urlopen("http://www.rcsb.org/pdb/files/%s.pdb" % pdbname) -values : for atom_parameters in self.atom_reduction_parameters.values()] -walk : # editing the 'dirnames' list will stop os.walk() from recursing into there. -warn : warnings.warn("only check the call, not the result") -warning : ptools.io.warning(msg) -write : sys.stderr.write("The bead %i of residue %s is incomplete. Please check your pdb!\n" -writelines : output.writelines(["static ", suite['name'], " ", suite['object'], ";\n\n"]) -WritePDB : final.WritePDB(writefile) diff --git a/README_NAMES b/README_NAMES deleted file mode 100644 index f02ce6f..0000000 --- a/README_NAMES +++ /dev/null @@ -1,65 +0,0 @@ -CHR 24 juillet 2017 - -Making more canonical identifiers in ptools (après discussion avec Chantal et Benoist) - -A. Goals - -1. Method and function names should start with a small letter -2. Underscores between words lowercase) should be preferred to camelCase - - -B. "Domains" - -1. Python modules and scripts -2. Cython bindings -3. C/C++ code -4. Fortran code - - -C. Guiding principles - -1. All work should be done in a branch ("renames") -2. To eliminate a manual step for distinguishing C++ and python calls, both C++ and python names will be changed -3. Python scripts alone will be searched in identify names to be changed. This means it is possible that some naming inconsistencies may result on the C++ side. This won't matter in a python-only future. -4. No fortran names will be changed; no fortran subroutines/functions are called directly by python anyway. -5. Automated tools will be used as much as possible to find candidates for renaming and to do the renaming (see "names.py") -6. Attention to the order of the substitutions -- any shorter word should be translated AFTER longer words containing it. - - -D. Detailed protocol: - -1. Find names using regular expressions: any name with letters and numbers and _, preceded by '.' and followed by '(' - - $ sed --in-place 's/CONTEXT = True/CONTEXT = False/' names.py - $ python names.py find ../ptools ../ptools-vrac > NAMES - - $ sed --in-place 's/CONTEXT = False/CONTEXT = True/' names.py - $ python names.py find ../ptools ../ptools-vrac > NAMES_WITH_CONTEXT - -2. Eliminate as many known PTools class names as possible - - $ grep -vf CLASS_NAMES_PYTHON NAMES > METHOD_NAMES - -3. Manually eliminate any names referring to external modules, classes, or names that are already OK. It helps to look in NAMES_WITH_CONTEXT, or grep other context examples if in doubt. - - $ vi METHOD_NAMES - -4. Add 2nd column with new method names (translations) - - $ cp METHOD_NAMES METHOD_NAMES_TXN - $ vi !$ - -5. Verify that no old names are present in multiple locations in the names list - - $ grep -f METHOD_NAMES METHOD_NAMES_TXN - $ grep -cf METHOD_NAMES METHOD_NAMES_TXN (compare count to wc METHOD_NAMES) - -6. Verify the order of the substitutions list! Any shorter word should be translated AFTER longer words containing it. Note that the translations are thus processed as a list, not a dictionary. - -7. To overwrite just the source file changes with the committed version - - - all changes: git checkout -- . - - - specific filetypes: git checkout -- "*.py" "*.pyx" "*.cpp" "*.h" - -8. I added new Makefile targets "undo" and "rename" for the commands often used in this branch diff --git a/TEST_TXN b/TEST_TXN deleted file mode 100644 index 2b8f6cf..0000000 --- a/TEST_TXN +++ /dev/null @@ -1,2 +0,0 @@ -ApplyMatrix( apply_matrix( -Apply( apply( diff --git a/names.py b/names.py deleted file mode 100644 index 029331d..0000000 --- a/names.py +++ /dev/null @@ -1,155 +0,0 @@ -import sys -import os -import subprocess -import time -import re - -# Set CONTEXT True to print latest context line for each match found -CONTEXT = True -DRY_RUN = False -STRIP_TERMINALS = False - -def find_names_in_file(filename, names={}, context=CONTEXT): - """Use regex to find all class.method and module.class names in one file, return as keys in names dict.""" - #e = re.compile('\.[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*') - #e = re.compile('\.[a-zA-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*\(') - e = re.compile('\.[a-zA-Z]+[a-zA-Z0-9_]*\(') - with open(filename) as fin: - for linee in fin.readlines(): - line = linee.strip() - match = e.search(line) - try: - # Note: matching group includes leading "." and trailing "(" - name = match.group() - if context: - names[name] = line - else: - names[name] = None - except AttributeError: - # Failure to match returns an object without a group() method - pass - pass - return names - - -def find_names(searchdirs='./', suffix=".py"): - """Find all class.method and module.class names in all files in searchdirs, return as keys in names dict.""" - names = {} - - for searchdir in searchdirs: - - # From the os.walk example at https://stackoverflow.com/a/120701 - for dirname, dirnames, filenames in os.walk(searchdir): - - for filename in filenames: - if filename.endswith(suffix): - fullname = os.path.join(dirname, filename) - find_names_in_file(fullname, names=names) - - # Advanced usage: - # editing the 'dirnames' list will stop os.walk() from recursing into there. - if '.git' in dirnames: - # don't go into any .git directories. - dirnames.remove('.git') - - return names - - -def print_names(namesdict, key=lambda x: x.upper(), print_values=CONTEXT): - """Print names dictionary in sorted order. May need to re-order some entries to avoid renaming problems.""" - for name in sorted(namesdict.keys(), key=key): - if print_values: - print name, " : ", namesdict[name] - else: - print name - - -def print_substitutions(subslist, print_values=CONTEXT): - """Print substitutions list in order.""" - for entry in subslist: - if print_values: - old, new = entry - print old, " : ", new - else: - print entry[0] - - -def read_substitutions(filename): - """Read data from file to create substitutions list.""" - substitutions = [] - with open(filename) as fin: - for line in fin.readlines(): - #print filename, line.strip() - if line.startswith("#"): - pass - entry = line.strip().split() - if len(entry) == 2: - substitutions.append(entry) - return substitutions - - -def parse_entry(entry, strip_terminals=False): - """Return target and new value for substitution entry with or without terminal "." and "(" characters.""" - target = entry[0] if not strip_terminals else entry[0][1:-1] - newvalue = entry[1] if not strip_terminals else entry[1][1:-1] - return target, newvalue - - -def rename_all(substitutions, dry_run=DRY_RUN, strip_terminals=STRIP_TERMINALS): - """Use unix sed command to rename identifiers in all relevant files.""" - # find . -name \*.h -exec sed --in-place 's/rotate/rotate/g' {} \; - # find . -name \*.cpp -exec sed --in-place 's/rotate/rotate/g' {} \; - # find . -name \*.pyx -exec sed --in-place 's/rotate/rotate/g' {} \; - # find . -name \*.py -exec sed --in-place 's/rotate/rotate/g' {} \; - # find . -name \*.rst -exec sed --in-place 's/rotate/rotate/g' {} \; - # make clean - # make install - # make test - - ## TEST: Use .T suffix and a file named "test.T" for testing - #suffixes = [".T"] - suffixes = [".h", ".cpp", ".py", ".pyx"] - #suffixes = [".rst"] - - name_arg_template = "*%s" - sed_command_template = "s/%s/%s/g" - - for entry in substitutions: - if len(entry) != 2: - continue - old, new = parse_entry(entry, strip_terminals=strip_terminals) - print "Renaming %s --> %s" % (old, new) - for suffix in suffixes: - name_arg = name_arg_template % (suffix) - sed_command = sed_command_template % (old, new) - print "sed command is: ", sed_command - if dry_run: - if strip_terminals: - olde = old - else: - # Escape the metacharacters - olde = "\\%s\\%s" % (old[:-1], old[-1]) - print "Escaping ", old, olde - args = ('find', '.', '-name', name_arg, '-exec', 'egrep', '-Hs', olde, '{}', ';') - else: - args = ('find', '.', '-name', name_arg, '-exec', 'sed', '-i', sed_command, '{}', ';') - print args - subprocess.Popen(args) - time.sleep(1) - return - - -if __name__ == "__main__": - - task = sys.argv[1] - - if task.startswith('find'): - searchdirs = sys.argv[2:] - names = find_names(searchdirs) - print_names(names) - - elif task.startswith('rename'): - namesfile = sys.argv[2] - substitutions = read_substitutions(namesfile) - rename_all(substitutions) - diff --git a/test.T b/test.T deleted file mode 100644 index d48e9ae..0000000 --- a/test.T +++ /dev/null @@ -1 +0,0 @@ -First apply_matrix and now a little apply_matrix(a,b) diff --git a/test.T_ori b/test.T_ori deleted file mode 100644 index 9d8eb03..0000000 --- a/test.T_ori +++ /dev/null @@ -1 +0,0 @@ -First ApplyMatrix and now a little ApplyMatrix(a,b) From 779808ac1d6cdd60bed7bab3089a8dc786b39d7f Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Fri, 28 Jul 2017 16:09:21 +0200 Subject: [PATCH 18/22] Renamed tests too --- Tests/cpp/ptoolstest.h | 30 +++++++++++++++--------------- Tests/heligeom/test_heligeom.py | 8 ++++---- Tests/test_atomselection.py | 20 ++++++++++---------- Tests/test_attractforcefield.py | 4 ++-- Tests/test_attractrigidbody.py | 2 +- Tests/test_coordsarray.py | 6 +++--- Tests/test_dna.py | 4 ++-- Tests/test_misc.py | 20 ++++++++++---------- Tests/test_movement.py | 26 +++++++++++++------------- Tests/test_pairlist.py | 2 +- Tests/test_rigidbody.py | 14 +++++++------- Tests/test_superpose.py | 2 +- 12 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index a9a71d1..736623a 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -23,7 +23,7 @@ Coord3D coo1, coo2, coo3; coo2 = Coord3D(1.0, 2.0, 7.5); } - void testPlusOperator() + void test_plus_operator() { coo3 = coo1 + coo2 ; TS_ASSERT_EQUALS(coo3.x, 4.0); @@ -33,14 +33,14 @@ Coord3D coo1, coo2, coo3; } - void testMinusOperator(){ + void test_minus_operator(){ coo3 = coo1 - coo2; TS_ASSERT_EQUALS(coo3.x, 2.0); TS_ASSERT_EQUALS(coo3.y, 2.0); TS_ASSERT_EQUALS(coo3.z, -2.5); } - void testPlusEqualOperator() + void test_plus_equal_operator() { coo3 = Coord3D(coo1); coo3 += coo2; @@ -62,13 +62,13 @@ Coord3D A, B; - void setUp() + void seuUp() { r = Rigidbody(TEST_1FIN_R_PDB); } - void testCopy() + void test_copy() { s = Rigidbody(r); TS_ASSERT_EQUALS(s.size(), r.size()) @@ -76,7 +76,7 @@ Coord3D A, B; } - void testsize() + void test_size() { TS_ASSERT_EQUALS(r.size(), 2365); } @@ -92,7 +92,7 @@ Coord3D A, B; } - void testUnsafeget_coords() + void test_unsafe_get_coords() { // """in principle get_coords(i,co) and unsafeget_coords(i,co) should // lead to the exact same coordinates if a sync has been done before @@ -134,7 +134,7 @@ Rigidbody rigid1, rigid2, rigid3; rigid3=Rigidbody(rigid2); } - void testBasicrmsd() + void test_basic_rmsd() { Rigidbody rigtmp(rigid1); TS_ASSERT_EQUALS(rmsd(rigid1, rigid1), 0.0); @@ -142,7 +142,7 @@ Rigidbody rigid1, rigid2, rigid3; TS_ASSERT_EQUALS(rmsd(rigtmp, rigid1), 4); } - void testTranslation1() + void test_translation1() { Coord3D CoM1 = rigid1.find_center() ; rigid1.translate(Coord3D(3.0, -55.67, 1)); @@ -153,7 +153,7 @@ Rigidbody rigid1, rigid2, rigid3; TS_ASSERT(rmsd(rigid1, rigid2) < 1e-6); } - void testTranslation2(){ + void test_translation2(){ Coord3D vec1 = Coord3D (-123.54, 45.62, -99.003); Coord3D vec2 = Coord3D (36.3125, 2.78, -36.378); rigid2.translate(vec1+vec2); @@ -189,14 +189,14 @@ class TestCoordsArray: public CxxTest::TestSuite TS_ASSERT(c.size() == 2); } - void testGetAtom() + void test_get_atom() { Coord3D c1 ; c.get_coords(0, c1); TS_ASSERT( Norm2(c1 - Coord3D(3.0, 4.0, 5.0))<1e-6 ); } - void testBasicTranslation() + void test_basic_translation() { c.translate(tr); Coord3D c1; @@ -263,7 +263,7 @@ Rigidbody prot1; random.seed(123); } - void testTransRot() + void test_trans_rot() { double x,y,z,a,b,c; @@ -320,7 +320,7 @@ class TestRot: public CxxTest::TestSuite public: - void testTransRot() + void test_trans_rot() { srand(time(NULL)); @@ -347,7 +347,7 @@ class TestRot: public CxxTest::TestSuite } } - void testVissage() + void test_vissage() { for(int i=0; i<1000; i++) diff --git a/Tests/heligeom/test_heligeom.py b/Tests/heligeom/test_heligeom.py index c1a93b4..73f8416 100644 --- a/Tests/heligeom/test_heligeom.py +++ b/Tests/heligeom/test_heligeom.py @@ -24,13 +24,13 @@ def surreal(r): class TestHeligeom(unittest.TestCase): - def testGenerateBDNA(self): + def test_generate_BDNA(self): dna = DNA(TEST_BP_PDB, "AAAAAATCGATCTATC", ADNA()) # tout atom result = dna.print_pdb() expected = open(TEST_BDNA_EXPECTED_PDB).read() self.assertEqual(result, expected) - def testBasicManipulation(self): + def test_basic_manipulation(self): # translate the DNA in coarse grain representation dna = DNA(TEST_BP_RED, TEST_BDNA_EXPECTED_PDB) self.assertEqual(dna[0].size(), 11) @@ -61,13 +61,13 @@ def testBasicManipulation(self): expected = f.read() self.assertEqual(result, expected) - def testCGfromPDBFile(self): + def test_cg_from_pdb_file(self): dna = DNA(TEST_BP_PDB, TEST_BDNA_EXPECTED_PDB) # gros grain result = dna.print_pdb() expected = open(TEST_CG_FROM_PDBFILE_EXPECTED_PDB).read() self.assertEqual(result, expected) - def testEnergy(self): + def test_energy(self): prot = AttractRigidbody(TEST_1A74_PROT_RED) dna = AttractRigidbody(TEST_1A74_OPT_RED) diff --git a/Tests/test_atomselection.py b/Tests/test_atomselection.py index aa35596..1ae57df 100644 --- a/Tests/test_atomselection.py +++ b/Tests/test_atomselection.py @@ -13,36 +13,36 @@ class TestAtomSelection(unittest.TestCase): def setUp(self): self.rig = Rigidbody(TEST_1F88_PDB) - def testSelectAll(self): + def test_select_all(self): allAtoms = self.rig.select_all_atoms() self.assertEqual(len(allAtoms), 5067) - def testSelectget_CA(self): + def test_select_get_CA(self): CAatoms = self.rig.get_CA() self.assertEqual(len(CAatoms), 643) - def testselect_atomtype_simple(self): + def test_select_atomtype_simple(self): CAatoms = self.rig.select_atomtype("CA") self.assertEqual(len(CAatoms), 643) - def testselect_atomtype_wildcard(self): + def test_select_atomtype_wildcard(self): CAatoms = self.rig.select_atomtype("C*") self.assertEqual(len(CAatoms), 3379) - def testSelectbackbone(self): + def test_select_backbone(self): bbAtoms = self.rig.backbone() self.assertEqual(len(bbAtoms), 2572) - def testselect_resid_range(self): + def test_select_resid_range(self): res_1_35 = self.rig.select_resid_range(1, 35) self.assertEqual(len(res_1_35), 566) # two chains - def testselect_resid_rangeNegativeResId(self): + def test_select_resid_range_negative_resid(self): rigid = Rigidbody(TEST_2AAV_PDB) selection = rigid.select_resid_range(-4, -1) & rigid.get_CA() self.assertEqual(len(selection), 4) - def testAnd(self): + def test_and(self): res_1_35 = self.rig.select_resid_range(1, 35) CAatoms = self.rig.select_atomtype("CA") @@ -64,12 +64,12 @@ def testcreate_rigid(self): rigid = met1A.create_rigid() self.assertEqual(len(rigid), 8) - def testNotOperator(self): + def test_not_operator(self): sel_ca = self.rig.get_CA() sel_not_ca = ~ sel_ca # operator NOT self.assertEqual(len(sel_ca) + len(sel_not_ca), len(self.rig)) - def testAlternateNotOperator(self): + def test_alternate_not_operator(self): sel_ca = self.rig.get_CA() sel_not_ca = sel_ca.not_() # operator NOT self.assertEqual(len(sel_ca) + len(sel_not_ca), len(self.rig)) diff --git a/Tests/test_attractforcefield.py b/Tests/test_attractforcefield.py index 85636f5..06f9a07 100644 --- a/Tests/test_attractforcefield.py +++ b/Tests/test_attractforcefield.py @@ -12,7 +12,7 @@ class TestAttractForceField2(unittest.TestCase): """ test if calculated energies are stable through library versions """ - def testFF2k(self): + def test_ff2k(self): a = AttractRigidbody(TEST_PK6C_RED) c = AttractRigidbody(TEST_PK6A_RED) @@ -27,7 +27,7 @@ def testFF2k(self): self.assertAlmostEqual(FF.Function(x), -32.9487770656) # energy from ptools 0.3 self.assertAlmostEqual(FF.Function(x), FF.get_vdw() + FF.getCoulomb()) - def testNonbon8Present(self): + def test_nonbon8_present(self): self.assertTrue(hasattr(AttractForceField2, 'nonbon8')) diff --git a/Tests/test_attractrigidbody.py b/Tests/test_attractrigidbody.py index ffe18e2..feab34e 100644 --- a/Tests/test_attractrigidbody.py +++ b/Tests/test_attractrigidbody.py @@ -11,7 +11,7 @@ def setUp(self): rigid = Rigidbody(TEST_LIGAND_PDB) self.attrigid = AttractRigidbody(rigid) - def testlen(self): + def test_len(self): self.assertEqual(len(self.attrigid), 2365) diff --git a/Tests/test_coordsarray.py b/Tests/test_coordsarray.py index ae522d1..c8e3c44 100644 --- a/Tests/test_coordsarray.py +++ b/Tests/test_coordsarray.py @@ -20,12 +20,12 @@ def setUp(self): def testsize(self): self.assertEqual(len(self.c), 2) - def testGetAtom(self): + def test_get_coords(self): c1 = Coord3D() self.c.get_coords(0, c1) assertCoordsAlmostEqual(self, c1, Coord3D(3.0, 4.0, 5.0)) - def testBasicTranslation(self): + def test_basic_translation(self): self.c.translate(self.tr) c1 = Coord3D() c2 = Coord3D() @@ -33,7 +33,7 @@ def testBasicTranslation(self): self.c.get_coords(1, c2) assertCoordsAlmostEqual(self, c1, Coord3D(6.0, 8.5, 2.0)) - def testset_coords(self): + def test_set_coords(self): """brief explanation: For lazy evaluation, corrdinates are stored unrotated/untranslated along with the rotation/translation 4x4 matrix. diff --git a/Tests/test_dna.py b/Tests/test_dna.py index d960737..570060a 100644 --- a/Tests/test_dna.py +++ b/Tests/test_dna.py @@ -32,7 +32,7 @@ def test_has_change_type(self): def test_has_apply_local(self): self.assertTrue(hasattr(DNA, 'apply_local')) - def test_has_SubDNA(self): + def test_has_subDNA(self): self.assertTrue(hasattr(DNA, 'SubDNA')) def test_has_change_representation(self): @@ -73,7 +73,7 @@ def test_apply_local(self): warnings.warn("only check the call, not the result") self.dna.apply_local(ptools.Roll(30), self.dna.size() / 2) - def test_SubDNA(self): + def test_subDNA(self): warnings.warn("only check the call, not the result") self.dna.SubDNA(2, self.dna.size() - 3) diff --git a/Tests/test_misc.py b/Tests/test_misc.py index 95635d8..7081a13 100644 --- a/Tests/test_misc.py +++ b/Tests/test_misc.py @@ -16,13 +16,13 @@ def setUp(self): self.rigid2 = Rigidbody(self.rigid1) self.rigid3 = Rigidbody(self.rigid2) - def testBasicrmsd(self): + def test_basic_rmsd(self): rigtmp = Rigidbody(self.rigid1) self.assertEqual(rmsd(self.rigid1, self.rigid1), 0.0) self.rigid1.translate(Coord3D(4, 0, 0)) self.assertEqual(rmsd(rigtmp, self.rigid1), 4) - def testErrorsrmsd(self): + def test_errors_rmsd(self): rigid1 = Rigidbody() rigid2 = Rigidbody() # cannot calculate an rmsd on an empty object @@ -32,17 +32,17 @@ def testErrorsrmsd(self): self.assertRaises(RuntimeError, rmsd, self.rigid1, "hello") self.assertRaises(RuntimeError, rmsd, "hello", self.rigid1) - def testrmsdAtomSelection1(self): + def test_rmsd_atomselection1(self): # tests rmsd with an AtomSelection object atsel = self.rigid1.select_all_atoms() self.assertEqual(rmsd(atsel, self.rigid2), 0) - def testrmsdAtomSelection2(self): + def test_rmsd_atomselection2(self): # tests rmsd with an AtomSelection object atsel = self.rigid1.select_all_atoms() self.assertEqual(rmsd(self.rigid2, atsel), 0) - def testTranslation1(self): + def test_translation1(self): CoM1 = self.rigid1.find_center() self.rigid1.translate(Coord3D(3.0, -55.67, 1)) CoM2 = self.rigid1.find_center() @@ -51,7 +51,7 @@ def testTranslation1(self): self.rigid1.translate(Coord3D(-3.0, 55.67, -1.0)) # translate back self.assertAlmostEqual(rmsd(self.rigid1, self.rigid2), 0.0) - def testTranslation2(self): + def test_translation2(self): vec1 = Coord3D(-123.54, 45.62, -99.003) vec2 = Coord3D(36.3125, 2.78, -36.378) self.rigid2.translate(vec1 + vec2) @@ -75,7 +75,7 @@ def setUp(self): self.rig = rig - def testRotZ(self): + def test_rot_z(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 0, 1), math.pi / 2) # i should now be j co1 = self.rig.copy_atom(0).coords @@ -95,7 +95,7 @@ def testRotZ(self): self.assertAlmostEqual(co3.y, 0) self.assertAlmostEqual(co3.z, 1) - def testRotX(self): + def test_rot_x(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(1, 0, 0), math.pi / 2) # i is still i @@ -116,7 +116,7 @@ def testRotX(self): self.assertAlmostEqual(co3.y, -1) self.assertAlmostEqual(co3.z, 0) - def testRotY(self): + def test_rot_y(self): self.rig.rotate(Coord3D(0, 0, 0), Coord3D(0, 1, 0), math.pi / 2) # i becomes -j @@ -137,7 +137,7 @@ def testRotY(self): self.assertAlmostEqual(co3.y, 0) self.assertAlmostEqual(co3.z, 0) - def testRotZ_trans(self): + def test_rot_z_trans(self): self.rig.rotate(Coord3D(1, 1, 1), Coord3D(1, 1, 3), math.pi / 2) co1 = self.rig.copy_atom(0).coords diff --git a/Tests/test_movement.py b/Tests/test_movement.py index 76c09af..2acd2cd 100644 --- a/Tests/test_movement.py +++ b/Tests/test_movement.py @@ -41,7 +41,7 @@ class MatrixAssertions: # Floatting points numbers are tested to be equal at a precision of 1E-5. ALMOST_EQUAL_DECIMAL = 5 - def assertIsSquare(self, source, n=0): + def assert_is_square(self, source, n=0): """Assert that a matrix is square. If `n` > 0, check the dimension of the matrix is `n`. @@ -55,7 +55,7 @@ def assertIsSquare(self, source, n=0): err = 'matrix is not {1}x{1} (dims are ({2},{2})'.format(n, nrow) raise AssertionError(err) - def assertSameDimensions(self, source, target): + def assert_same_dimensions(self, source, target): """Assert that two matrices have the same dimensions.""" nrow = len(source) ncol = len(source[0]) @@ -64,9 +64,9 @@ def assertSameDimensions(self, source, target): err = err.format(nrow, ncol, len(target), len(target[0])) raise AssertionError(err) - def assertMatrixAlmostEqual(self, source, target): + def assert_matrix_almost_equal(self, source, target): """Assert that two square matrices elements are almost equal.""" - self.assertSameDimensions(source, target) + self.assert_same_dimensions(source, target) nrow, ncol = len(source), len(source[0]) for i in xrange(nrow): for j in xrange(ncol): @@ -85,22 +85,22 @@ def setUp(self): def test_Movement(self): mov = ptools.Movement() - self.assertMatrixAlmostEqual(get_movement_matrix(mov), zeros(4, 4)) + self.assert_matrix_almost_equal(get_movement_matrix(mov), zeros(4, 4)) def test_Shift(self): mov = ptools.Shift(self.alpha) self.target[0][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Slide(self): mov = ptools.Slide(self.alpha) self.target[1][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Rise(self): mov = ptools.Rise(self.alpha) self.target[2][3] = self.alpha - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Twist(self): mov = ptools.Twist(self.alpha) @@ -108,7 +108,7 @@ def test_Twist(self): self.target[0][1] = -math.sin(self.ralpha) self.target[1][0] = math.sin(self.ralpha) self.target[1][1] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Roll(self): mov = ptools.Roll(self.alpha) @@ -116,7 +116,7 @@ def test_Roll(self): self.target[0][2] = math.sin(self.ralpha) self.target[2][0] = -math.sin(self.ralpha) self.target[2][2] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_Tilt(self): mov = ptools.Tilt(self.alpha) @@ -124,7 +124,7 @@ def test_Tilt(self): self.target[1][2] = -math.sin(self.ralpha) self.target[2][1] = math.sin(self.ralpha) self.target[2][2] = math.cos(self.ralpha) - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_ADNA(self): mov = ptools.ADNA() @@ -135,7 +135,7 @@ def test_ADNA(self): [-0.03595566, 0.03697002, 0.99866932, 3.3059932], [0.00000000, 0.00000000, 0.00000000, 1.0000000], ] - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def test_BDNA(self): mov = ptools.BDNA() @@ -146,7 +146,7 @@ def test_BDNA(self): [0.04651246, -0.03141768, 0.998423518, 3.2887760], [0.00000000, 0.00000000, 0.000000000, 1.0000000], ] - self.assertMatrixAlmostEqual(get_movement_matrix(mov), self.target) + self.assert_matrix_almost_equal(get_movement_matrix(mov), self.target) def zeros(n, m): diff --git a/Tests/test_pairlist.py b/Tests/test_pairlist.py index 86cfd20..6d8598b 100644 --- a/Tests/test_pairlist.py +++ b/Tests/test_pairlist.py @@ -34,7 +34,7 @@ def setUp(self): self.ar = AttractRigidbody(r) self.al = AttractRigidbody(l) - def testAtomPair(self): + def test_atompair(self): atp = AtomPair() atp.atlig = 23 atp.atrec = 45 diff --git a/Tests/test_rigidbody.py b/Tests/test_rigidbody.py index 70567fd..2686e26 100644 --- a/Tests/test_rigidbody.py +++ b/Tests/test_rigidbody.py @@ -111,7 +111,7 @@ def setUp(self): at.coords = Coord3D(0, 0, 1) self.r2.add_atom(at) - def testCopy(self): + def test_copy(self): s = Rigidbody(self.r) self.assertEqual(len(s), len(self.r)) self.assertEqual(self.r.find_center(), s.find_center()) @@ -171,16 +171,16 @@ def testset_atom(self): assertCoordsAlmostEqual(self, atom2.coords, Coord3D(3, 4, 5)) assertCoordsAlmostEqual(self, coords2, Coord3D(3, 4, 5)) - def testset_atomWithOutOfBoundsPosition(self): + def testset_atom_with_out_of_bounds_position(self): maxpos = len(self.r) - 1 with self.assertRaisesRegexp(IndexError, 'out of bounds'): self.r.set_atom_property(maxpos + 1, Atom()) - def testset_atomWithNegativePosition(self): + def testset_atom_with_negative_position(self): with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): self.r.set_atom_property(-1, Atom()) - def testUnsafeget_coords(self): + def test_unsafe_get_coords(self): """in principle get_coords(i,co) and unsafeget_coords(i,co) should lead to the exact same coordinates if a sync has been done before calling the 'unsafe' version""" @@ -223,16 +223,16 @@ def testset_atom_property(self): prop = self.r.get_atom_property(0) self.assertEqual(prop.residType, 'AAA') - def testset_atom_propertyWithOutOfBoundsPosition(self): + def test_set_atom_property_with_out_of_bounds_position(self): maxpos = len(self.r) - 1 with self.assertRaisesRegexp(IndexError, 'out of bounds'): self.r.set_atom_property(maxpos + 1, Atomproperty()) - def testset_atom_propertyWithNegativePosition(self): + def test_set_atom_property_with_negative_position(self): with self.assertRaisesRegexp(OverflowError, "can't convert negative value to unsigned int"): self.r.set_atom_property(-1, Atomproperty()) - def testNegativeResId(self): + def test_negative_residId(self): rigid = Rigidbody(TEST_2AAV_PDB) at1 = rigid.copy_atom(0) self.assertEqual(at1.residId, -4) diff --git a/Tests/test_superpose.py b/Tests/test_superpose.py index 874a424..2177392 100644 --- a/Tests/test_superpose.py +++ b/Tests/test_superpose.py @@ -36,7 +36,7 @@ class TestSuperposition(unittest.TestCase): def setUp(self): self.prot1 = ptools.Rigidbody(TEST_LIGAND_PDB) - def testTransRot(self): + def test_trans_rot(self): prot2 = ptools.Rigidbody(self.prot1) for i in xrange(20): From 86f063cd2ac7f9e8c4ff4b4efdb57951b8f6665b Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Fri, 28 Jul 2017 16:15:22 +0200 Subject: [PATCH 19/22] rename SubDNA() to subDNA() --- Tests/heligeom/test_heligeom.py | 2 +- Tests/test_attract_misc.py | 4 ++-- Tests/test_dna.py | 4 ++-- bindings/dna.pyx | 6 +++--- headers/DNA.h | 2 +- src/DNA.cpp | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Tests/heligeom/test_heligeom.py b/Tests/heligeom/test_heligeom.py index 73f8416..b64fc5a 100644 --- a/Tests/heligeom/test_heligeom.py +++ b/Tests/heligeom/test_heligeom.py @@ -51,7 +51,7 @@ def test_basic_manipulation(self): dna.apply_local(Roll(30), dna.size() / 2) # trim the extremities - dna = dna.SubDNA(2, dna.size() - 3) + dna = dna.subDNA(2, dna.size() - 3) # change to a All Atom representation dna.change_representation(TEST_BP_PDB) diff --git a/Tests/test_attract_misc.py b/Tests/test_attract_misc.py index 80751ef..f2d9a0e 100644 --- a/Tests/test_attract_misc.py +++ b/Tests/test_attract_misc.py @@ -83,7 +83,7 @@ def setUp(self): self.niter = 100 self.forcefield = AttractForceField1(TEST_TOYMINIM_FF_PARAM, self.cutoff) - def test_find_analytical_solution_when_displaced_along_Y(self): + def test_find_analytical_solution_when_displaced_along_y(self): """Minimization should displace ligand by -5A along Y-axis to minimum-energy position.""" receptor = AttractRigidbody(TEST_TOYMINIM_RECEPTOR) receptor.set_translation(False) @@ -108,7 +108,7 @@ def test_find_analytical_solution_when_displaced_along_Y(self): self.assertAlmostEqual(dy, -5.0) self.assertAlmostEqual(dz, 0.0) - def test_find_analytical_solution_when_displaced_along_X_Y_Z(self): + def test_find_analytical_solution_when_displaced_along_x_y_z(self): """Minimization should displace ligand by -5A along each axis to minimum-energy position.""" # PGTOL not easily changeable through ptools, needs to be set tighter to get closer to optimum tolerance = 5e-5 diff --git a/Tests/test_dna.py b/Tests/test_dna.py index 570060a..c709553 100644 --- a/Tests/test_dna.py +++ b/Tests/test_dna.py @@ -33,7 +33,7 @@ def test_has_apply_local(self): self.assertTrue(hasattr(DNA, 'apply_local')) def test_has_subDNA(self): - self.assertTrue(hasattr(DNA, 'SubDNA')) + self.assertTrue(hasattr(DNA, 'subDNA')) def test_has_change_representation(self): self.assertTrue(hasattr(DNA, 'change_representation')) @@ -75,7 +75,7 @@ def test_apply_local(self): def test_subDNA(self): warnings.warn("only check the call, not the result") - self.dna.SubDNA(2, self.dna.size() - 3) + self.dna.subDNA(2, self.dna.size() - 3) def test_change_representation(self): warnings.warn("only check the call, not the result") diff --git a/bindings/dna.pyx b/bindings/dna.pyx index 6242011..70b5903 100644 --- a/bindings/dna.pyx +++ b/bindings/dna.pyx @@ -7,7 +7,7 @@ cdef extern from "DNA.h" namespace "PTools": CppDNA(CppDNA&) CppDNA(string&, string&, CppMovement&) CppDNA(string&, string&) #with default value for third parameter - CppDNA SubDNA(int, int) + CppDNA subDNA(int, int) CppBasePair operator[](int) unsigned int size() void add(CppBasePair, const CppMovement &) @@ -60,11 +60,11 @@ cdef class DNA: def size(self): return self.thisptr.size() - def SubDNA(self, int start, int end): + def subDNA(self, int start, int end): ret = DNA() if ret.thisptr: del ret.thisptr - cdef CppDNA cdna = self.thisptr.SubDNA(start, end) + cdef CppDNA cdna = self.thisptr.subDNA(start, end) ret.thisptr = new CppDNA(cdna) return ret diff --git a/headers/DNA.h b/headers/DNA.h index 1a77346..1870c43 100644 --- a/headers/DNA.h +++ b/headers/DNA.h @@ -93,7 +93,7 @@ namespace PTools void add(BasePair bp, const Movement & mov = BDNA()); ///return the specified subDNA - DNA SubDNA(uint start, uint end)const; + DNA subDNA(uint start, uint end)const; ///replace the basePair of this DNA by the basePair of a given DNA starting from a given position to the end of one of the DNAs void Replace(const DNA & d,int start); diff --git a/src/DNA.cpp b/src/DNA.cpp index 9e1f848..6163bc3 100644 --- a/src/DNA.cpp +++ b/src/DNA.cpp @@ -826,11 +826,11 @@ void DNA::add(BasePair bp, const Movement & mov) this->ChangeFormat(); } -DNA DNA::SubDNA(uint start, uint end)const +DNA DNA::subDNA(uint start, uint end)const { if (std::max(start, end) > this->size() ) { - throw std::out_of_range("out of range in SubDNA"); + throw std::out_of_range("out of range in subDNA"); } DNA newdna = DNA(); @@ -844,8 +844,8 @@ DNA DNA::SubDNA(uint start, uint end)const void DNA::Replace(const DNA & d,int start) { - DNA preDNA = this->SubDNA(0,start); - DNA postDNA =this->SubDNA(start+d.size(),this->size()); + DNA preDNA = this->subDNA(0,start); + DNA postDNA =this->subDNA(start+d.size(),this->size()); Movement initMov = Movement(strand[0].get_matrix()); strand.clear(); From 81798e0655918060b02fdc38ad0363e7508a1e04 Mon Sep 17 00:00:00 2001 From: Charles Robert Date: Fri, 28 Jul 2017 16:21:54 +0200 Subject: [PATCH 20/22] other minor renames --- Tests/test_atom.py | 16 ++++++++-------- Tests/test_matrix.py | 8 ++++---- bindings/matrix.pyx | 6 +++--- headers/basetypes.h | 2 +- src/basetypes.cpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Tests/test_atom.py b/Tests/test_atom.py index 0a6cd7c..24a1af8 100644 --- a/Tests/test_atom.py +++ b/Tests/test_atom.py @@ -6,28 +6,28 @@ class TestAtomBindings(unittest.TestCase): - def test_Atom_has_atomType(self): + def test_atom_has_atomType(self): self.assertTrue(hasattr(Atom, 'atomType')) - def test_Atom_has_residType(self): + def test_atom_has_residType(self): self.assertTrue(hasattr(Atom, 'residType')) - def test_Atom_has_residId(self): + def test_atom_has_residId(self): self.assertTrue(hasattr(Atom, 'residId')) - def test_Atom_has_atomId(self): + def test_atom_has_atomId(self): self.assertTrue(hasattr(Atom, 'atomId')) - def test_Atom_has_atomCharge(self): + def test_atom_has_atomCharge(self): self.assertTrue(hasattr(Atom, 'atomCharge')) - def test_Atom_has_atomElement(self): + def test_atom_has_atomElement(self): self.assertTrue(hasattr(Atom, 'atomElement')) - def test_Atom_has_coords(self): + def test_atom_has_coords(self): self.assertTrue(hasattr(Atom, 'coords')) - def test_Atom_has_set_coords(self): + def test_atom_has_set_coords(self): self.assertTrue(hasattr(Atom, 'set_coords')) diff --git a/Tests/test_matrix.py b/Tests/test_matrix.py index 8e7105e..c38892a 100644 --- a/Tests/test_matrix.py +++ b/Tests/test_matrix.py @@ -25,8 +25,8 @@ def test_has_get_nrows(self): def test_has_get_ncolumns(self): self.assertTrue(hasattr(ptools.Matrix, 'get_ncolumns')) - def test_has_getDim(self): - self.assertTrue(hasattr(ptools.Matrix, 'getDim')) + def test_has_get_dim(self): + self.assertTrue(hasattr(ptools.Matrix, 'get_dim')) def test_has_Print(self): self.assertTrue(hasattr(ptools.Matrix, 'Print')) @@ -46,8 +46,8 @@ def test_get_nrows(self): def test_get_columns(self): self.assertEqual(self.mat.get_ncolumns(), self.ncols) - def test_getDim(self): - self.assertEqual(self.mat.getDim(), (self.nrows, self.ncols)) + def test_get_dim(self): + self.assertEqual(self.mat.get_dim(), (self.nrows, self.ncols)) def test_detach(self): # Just check that function call doesn't raise any error. diff --git a/bindings/matrix.pyx b/bindings/matrix.pyx index 8a7068e..621ce78 100644 --- a/bindings/matrix.pyx +++ b/bindings/matrix.pyx @@ -12,7 +12,7 @@ cdef extern from "basetypes.h": string str() int get_nrows() int get_ncolumns() - pair[int,int] getDim() + pair[int,int] get_dim() void Print() cdef cppclass cppSuperpose_t "Superpose_t" : @@ -60,8 +60,8 @@ cdef class Matrix: def get_ncolumns(self): return self.thisptr.get_ncolumns() - def getDim(self): - return self.thisptr.getDim() + def get_dim(self): + return self.thisptr.get_dim() def Print(self): self.thisptr.Print() diff --git a/headers/basetypes.h b/headers/basetypes.h index a6822e8..b009108 100644 --- a/headers/basetypes.h +++ b/headers/basetypes.h @@ -180,7 +180,7 @@ class Array2D } ///get size of the array - std::pair getDim() const + std::pair get_dim() const { std::pair out; out.first = m_rows; diff --git a/src/basetypes.cpp b/src/basetypes.cpp index e3ab29d..009f202 100644 --- a/src/basetypes.cpp +++ b/src/basetypes.cpp @@ -30,7 +30,7 @@ namespace PTools void MakeIdentity(Matrix & mat) { - std::pair sz = mat.getDim(); + std::pair sz = mat.get_dim(); assert(sz.first == sz.second); for (int i=0; i Date: Fri, 28 Jul 2017 18:13:21 +0200 Subject: [PATCH 21/22] revert ptoolstest.h to bc9551.. --- Tests/cpp/ptoolstest.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Tests/cpp/ptoolstest.h b/Tests/cpp/ptoolstest.h index 736623a..a9a71d1 100644 --- a/Tests/cpp/ptoolstest.h +++ b/Tests/cpp/ptoolstest.h @@ -23,7 +23,7 @@ Coord3D coo1, coo2, coo3; coo2 = Coord3D(1.0, 2.0, 7.5); } - void test_plus_operator() + void testPlusOperator() { coo3 = coo1 + coo2 ; TS_ASSERT_EQUALS(coo3.x, 4.0); @@ -33,14 +33,14 @@ Coord3D coo1, coo2, coo3; } - void test_minus_operator(){ + void testMinusOperator(){ coo3 = coo1 - coo2; TS_ASSERT_EQUALS(coo3.x, 2.0); TS_ASSERT_EQUALS(coo3.y, 2.0); TS_ASSERT_EQUALS(coo3.z, -2.5); } - void test_plus_equal_operator() + void testPlusEqualOperator() { coo3 = Coord3D(coo1); coo3 += coo2; @@ -62,13 +62,13 @@ Coord3D A, B; - void seuUp() + void setUp() { r = Rigidbody(TEST_1FIN_R_PDB); } - void test_copy() + void testCopy() { s = Rigidbody(r); TS_ASSERT_EQUALS(s.size(), r.size()) @@ -76,7 +76,7 @@ Coord3D A, B; } - void test_size() + void testsize() { TS_ASSERT_EQUALS(r.size(), 2365); } @@ -92,7 +92,7 @@ Coord3D A, B; } - void test_unsafe_get_coords() + void testUnsafeget_coords() { // """in principle get_coords(i,co) and unsafeget_coords(i,co) should // lead to the exact same coordinates if a sync has been done before @@ -134,7 +134,7 @@ Rigidbody rigid1, rigid2, rigid3; rigid3=Rigidbody(rigid2); } - void test_basic_rmsd() + void testBasicrmsd() { Rigidbody rigtmp(rigid1); TS_ASSERT_EQUALS(rmsd(rigid1, rigid1), 0.0); @@ -142,7 +142,7 @@ Rigidbody rigid1, rigid2, rigid3; TS_ASSERT_EQUALS(rmsd(rigtmp, rigid1), 4); } - void test_translation1() + void testTranslation1() { Coord3D CoM1 = rigid1.find_center() ; rigid1.translate(Coord3D(3.0, -55.67, 1)); @@ -153,7 +153,7 @@ Rigidbody rigid1, rigid2, rigid3; TS_ASSERT(rmsd(rigid1, rigid2) < 1e-6); } - void test_translation2(){ + void testTranslation2(){ Coord3D vec1 = Coord3D (-123.54, 45.62, -99.003); Coord3D vec2 = Coord3D (36.3125, 2.78, -36.378); rigid2.translate(vec1+vec2); @@ -189,14 +189,14 @@ class TestCoordsArray: public CxxTest::TestSuite TS_ASSERT(c.size() == 2); } - void test_get_atom() + void testGetAtom() { Coord3D c1 ; c.get_coords(0, c1); TS_ASSERT( Norm2(c1 - Coord3D(3.0, 4.0, 5.0))<1e-6 ); } - void test_basic_translation() + void testBasicTranslation() { c.translate(tr); Coord3D c1; @@ -263,7 +263,7 @@ Rigidbody prot1; random.seed(123); } - void test_trans_rot() + void testTransRot() { double x,y,z,a,b,c; @@ -320,7 +320,7 @@ class TestRot: public CxxTest::TestSuite public: - void test_trans_rot() + void testTransRot() { srand(time(NULL)); @@ -347,7 +347,7 @@ class TestRot: public CxxTest::TestSuite } } - void test_vissage() + void testVissage() { for(int i=0; i<1000; i++) From caab8df1e682afd296dca2a07314ea97bac5289f Mon Sep 17 00:00:00 2001 From: charlestonchas Date: Tue, 5 Dec 2017 11:54:10 +0100 Subject: [PATCH 22/22] Update INSTALL.rst to explicitly mention python 2.7 dependency More and more people have python 3 by default --- INSTALL.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INSTALL.rst b/INSTALL.rst index 483fbc2..24f3831 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -11,7 +11,7 @@ Quick setup guide This is the very minimal set of instructions required to install Ptools in a Python virtual environment. -It assumes all Ptools dependencies have been duly installed:: +It assumes python 2.7 and all Ptools dependencies have been duly installed:: $ virtualenv ptools-env $ source ptools-env/bin/activate @@ -29,6 +29,7 @@ Building and installing Ptools The Ptools library has few dependencies namely : +- python 2.7.xx - a C++ compiler (e.g. the `GNU Compiler`_), - a developers version of the Python_ interpreter, - the Boost_ library, @@ -185,4 +186,4 @@ location as described in `f2c.h: No such file or directory`_. .. _GNU Compiler: http://gcc.gnu.org/ .. _Python: http://www.python.org/ .. _Git: http://git-scm.com/ -.. _pip: https://pypi.python.org/pypi/pip \ No newline at end of file +.. _pip: https://pypi.python.org/pypi/pip