Пример #1
0
def test_greedy_splitext(inp="foo/bar/boing.2.pdb.bz2",
                         ref=("foo/bar/boing", ".2.pdb.bz2")):
    root, ext = util.greedy_splitext(inp)
    assert root == ref[0], "root incorrect"
    assert ext == ref[1], "extension incorrect"
Пример #2
0
def test_greedy_splitext(inp="foo/bar/boing.2.pdb.bz2",
                         ref=("foo/bar/boing", ".2.pdb.bz2")):
    root, ext = util.greedy_splitext(inp)
    assert_equal(root, ref[0], err_msg="root incorrect")
    assert_equal(ext, ref[1], err_msg="extension incorrect")
Пример #3
0
def test_greedy_splitext(inp="foo/bar/boing.2.pdb.bz2",
                         ref=("foo/bar/boing", ".2.pdb.bz2")):
    root, ext = util.greedy_splitext(inp)
    assert_equal(root, ref[0], err_msg="root incorrect")
    assert_equal(ext, ref[1], err_msg="extension incorrect")
Пример #4
0
different trajectory formats.

"""

# from MDAnalysis.tests.datafiles import PRMpbc,TRJpbc_bz2
from MDAnalysis.tests.datafiles import PRM, TRJ_bz2
from MDAnalysis import Universe, Writer
from MDAnalysis.lib.util import greedy_splitext

import os.path

topol = PRM  # PRMpbc
intrj = TRJ_bz2  # TRJpbc_bz2
ext = '.dcd'  # output format determined by extension

root, oldext = greedy_splitext(os.path.basename(intrj))
outtrj = root + ext
outpdb = root + '.pdb'

u = Universe(topol, intrj)

# create a writer instance for the output trajectory
w = Writer(outtrj, u.trajectory.numatoms)

# loop through the trajectory and write a frame for every step
for ts in u.trajectory:
    w.write(ts)
    print "Converted frame %d" % ts.frame
w.close_trajectory()
print "Converted %r --> %r" % (intrj, outtrj)
Пример #5
0
different trajectory formats.

"""

# from MDAnalysis.tests.datafiles import PRMpbc,TRJpbc_bz2
from MDAnalysis.tests.datafiles import PRM, TRJ_bz2
from MDAnalysis import Universe, Writer
from MDAnalysis.lib.util import greedy_splitext

import os.path

topol = PRM  # PRMpbc
intrj = TRJ_bz2  # TRJpbc_bz2
ext = '.dcd'  # output format determined by extension

root, oldext = greedy_splitext(os.path.basename(intrj))
outtrj = root + ext
outpdb = root + '.pdb'

u = Universe(topol, intrj)

# create a writer instance for the output trajectory
w = Writer(outtrj, u.trajectory.numatoms)

# loop through the trajectory and write a frame for every step
for ts in u.trajectory:
    w.write(ts)
    print "Converted frame %d" % ts.frame
w.close_trajectory()
print "Converted %r --> %r" % (intrj, outtrj)