Esempio n. 1
0
class tester():
    def setup(self):
        self.p = ArgumentParser()

    def cmd(self, value):
        sys.argv = [os.path.abspath(__file__)]
        for e in value.split():
            sys.argv.append(e)

    @property
    def v(self):
        return self.p.parse_args(print_banner=False)

    def add(self, *args, **kwargs):
        self.p.add_argument(*args, **kwargs)

    def test_0(self):
        self.add('a', nargs='+')
        self.cmd('-a 1 2')
        eq_(self.v.a, ['1', '2'])

    def test_1(self):
        self.add('a', nargs='+', type=int)
        self.cmd('-a 1 2')

        eq_(self.v.a, [1, 2])

    def test_2(self):
        self.add('a', type=int)
        self.cmd('-a 4')
        eq_(self.v.a, 4)

    def test_3(self):
        self.add('a', type=float)
        self.cmd('-a 5')
        eq_(self.v.a, 5.0)

    @raises(SystemExit)
    def test_4(self):
        sys.stderr = open('/dev/null', 'w')
        self.add('a', choices=[1, 2], type=float)
        self.cmd('-a 5')
        eq_(self.v.a, 5.0)
        sys.stderr = sys.__stderr__

    def test_5(self):
        self.add('a', choices=['1', '2'], type=int)
        self.cmd('-a 1')
        eq_(self.v.a, 1.0)

#  @expected_failure

    def test_6(self):
        self.add('a', choices=[1, 2], type=int)
        self.cmd('-a 1')
        eq_(self.v.a, 1)

    def test_7(self):
        self.add('a', action='store_true', type=bool)
        self.cmd('-a')
        eq_(self.v.a, True)

    def test_71(self):
        self.add('a', action='store_false', type=bool)
        self.cmd('-a')
        eq_(self.v.a, False)

    def test_8(self):
        self.add('a', action='store_true')
        self.cmd('-a')
        eq_(self.v.a, True)

    def test_81(self):
        self.add('b', action='store_false')
        self.cmd('-b')
        eq_(self.v.b, False)

    def test_9(self):
        self.add('a', default=False, action='store_true', type=bool)
        self.cmd('')
        eq_(self.v.a, False)

    def test_10(self):
        self.add('a', action='store_true', type=bool)
        self.cmd('')
        eq_(self.v.a, False)
relevant XTCs inside that directory (PROJECT/TRAJ*/frame*.xtc).

Output:
  -- 'Trajectories' directory containing all the merged lh5 files
  -- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
     calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")
    
    parser.add_argument('project', type=str, help='''The ProjectInfo (.h5) to
        write to disk. Contains metadata associated with your project''')
    parser.add_argument('pdb')
    parser.add_argument('input_dir', help='''Path to the parent directory
        containing subdirectories with MD (.xtc/.dcd) data. See the description above
        for the appropriate formatting for directory architecture.''')
    parser.add_argument('source', help='''Data source: "file", "file_dcd" or
        "fah". For "file" & "file_dcd" formats, each of the trajectories needs to be
        in a different directory. For example, if you supply input_dir='XTC', then
        it is expected that the directory 'XTC' contains a set of subdirectories, each
        of which contains one or more files of a single MD trajectory that will be concatenated
        together. The glob pattern used would be XTC/*/*.xtc'. If 'fah', then standard
        folding@home-style directory architecture is required.''',
        default='file', choices=['fah', 'file', 'file_dcd'])
    parser.add_argument('min_length', help='''Minimum number of frames per trajectory
        required to include data in Project.  Used to discard extremely short
        trajectories.''', default=0, type=int)
Esempio n. 3
0
  -- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
     calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")

    parser.add_argument('project',
                        type=str,
                        help='''The ProjectInfo (.h5) file
        that contains a mapping of the previous work done. If you specify a file that
        exists on disk, conversion will pick up where it left off and simply add data
        to what has already been done. If you specify a file that doesn't exist, the
        conversion starts from the beginning and writes a ProjectInfo file with that name
        at the end of the conversion. NOTE: If you specify a ProjectInfo file, the conversion
        automatically retrieves the conversion parameters you were using before and uses
        them - all other options you specify will be IGNORED.''')
    parser.add_argument('pdb')
    parser.add_argument('input_dir',
                        help='''Path to the parent directory
        containing subdirectories with MD (.xtc/.dcd) data. See the description above
        for the appropriate formatting for directory architecture.''')
    parser.add_argument('source',
                        help='''Data source: "file", "file_dcd" or
        "fah". This is the style of trajectory data that gets fed into MSMBuilder.
        If a file, then it requires each trajectory be housed in a separate directory
        like (PROJECT/TRAJ*/frame*.xtc). If 'fah', then standard FAH-style directory
        architecture is required.''',
Esempio n. 4
0
class tester():
    def setup(self):
        self.p = ArgumentParser()
    
    def cmd(self, value):
        sys.argv = [os.path.abspath(__file__)]
        for e in value.split():
            sys.argv.append(e)
    
    @property
    def v(self):
        return self.p.parse_args(print_banner=False)

    def add(self, *args, **kwargs):
        self.p.add_argument(*args, **kwargs)

    def test_0(self):
        self.add('a', nargs='+')
        self.cmd('-a 1 2')
        eq_(self.v.a, ['1', '2'])
 
    def test_1(self):
        self.add('a', nargs='+', type=int)
        self.cmd('-a 1 2')
        
        eq_(self.v.a, [1, 2])
        
    def test_2(self):
        self.add('a', type=int)
        self.cmd('-a 4')
        eq_(self.v.a, 4)
    
    def test_3(self):
        self.add('a', type=float)
        self.cmd('-a 5')
        eq_(self.v.a, 5.0)
    
    @raises(SystemExit)
    def test_4(self):
        sys.stderr = open('/dev/null', 'w')
        self.add('a', choices=[1,2], type=float)
        self.cmd('-a 5')
        eq_(self.v.a, 5.0)
        sys.stderr = sys.__stderr__
    
    def test_5(self):
        self.add('a', choices=['1', '2'], type=int)
        self.cmd('-a 1')
        eq_(self.v.a, 1.0)
    
    def test_6(self):
        self.add('a', choices=[1, 2], type=int)
        self.cmd('-a 1')
        eq_(self.v.a, 1)
        
    def test_7(self):
        self.add('a', action='store_true', type=bool)
        self.cmd('-a')
        eq_(self.v.a, True)
    
    def test_71(self):
        self.add('a', action='store_false', type=bool)
        self.cmd('-a')
        eq_(self.v.a, False)
    
    def test_8(self):
        self.add('a', action='store_true')
        self.cmd('-a')
        eq_(self.v.a, True)
    
    def test_81(self):
        self.add('b', action='store_false')
        self.cmd('-b')
        eq_(self.v.b, False)

    def test_9(self):
        self.add('a', default=False, action='store_true', type=bool)
        self.cmd('')
        eq_(self.v.a, False)    

    def test_10(self):
        self.add('a', action='store_true', type=bool)
        self.cmd('')
        eq_(self.v.a, False)
Esempio n. 5
0
relevant XTCs inside that directory (PROJECT/TRAJ*/frame*.xtc).

Output:
  -- 'Trajectories' directory containing all the merged lh5 files
  -- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
     calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")
    
    parser.add_argument('project', type=str, help='''The ProjectInfo (.h5) to
        write to disk. Contains metadata associated with your project''')
    parser.add_argument('pdb')
    parser.add_argument('input_dir', help='''Path to the parent directory
        containing subdirectories with MD (.xtc/.dcd) data. See the description above
        for the appropriate formatting for directory architecture.''')
    parser.add_argument('source', help='''Data source: "file", "file_dcd" or
        "fah". This is the style of trajectory data that gets fed into MSMBuilder.
        If a file, then it requires each trajectory be housed in a separate directory
        like (PROJECT/TRAJ*/frame*.xtc). If 'fah', then standard FAH-style directory
        architecture is required.''', default='file', choices=['fah', 'file', 'file_dcd'])
    parser.add_argument('min_length', help='''Minimum number of frames per trajectory
        required to include data in Project.  Used to discard extremely short
        trajectories.''', default=0, type=int)
    parser.add_argument('stride', help='''Integer number to subsample by.
        Every "u-th" frame will be taken from the data and converted to msmbuilder
        format''', default=1, type=int)
Esempio n. 6
0
Can read any format compatible with mdtraj.

Output:
-- 'Trajectories' directory containing all the merged h5 files
-- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
 calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")
parser.add_argument('project', type=str, help='''The ProjectInfo (.h5) to
    write to disk. Contains metadata associated with your project''')
parser.add_argument('pdb')
parser.add_argument('input_dir', help='''Path to the parent directory
    containing subdirectories with MD data. See the description above
    for the appropriate formatting for directory architecture.''')
parser.add_argument('source', help='''Data source: "file", or
    "fah". For "file" format, each of the trajectories needs to be
    in a different directory. For example, if you supply input_dir='XTC', then
    it is expected that the directory 'XTC' contains a set of subdirectories, each
    of which contains one or more files of a single MD trajectory that will be concatenated
    together. The glob pattern used would be XTC/*/*.*'. If 'fah', then standard
    folding@home-style directory architecture is required. If the IEXT option
    is given, the glob pattern will be restricted to the given file extension
    (behavior is the same for file and fah)''',
                    default='file', choices=['fah', 'file'])
parser.add_argument('min_length', help='''Minimum number of frames per trajectory
Esempio n. 7
0
  -- 'Trajectories' directory containing all the merged lh5 files
  -- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
     calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")
    
    parser.add_argument('project', type=str, help='''The ProjectInfo (.h5) file
        that contains a mapping of the previous work done. If you specify a file that
        exists on disk, conversion will pick up where it left off and simply add data
        to what has already been done. If you specify a file that doesn't exist, the
        conversion starts from the beginning and writes a ProjectInfo file with that name
        at the end of the conversion. NOTE: If you specify a ProjectInfo file, the conversion
        automatically retrieves the conversion parameters you were using before and uses
        them - all other options you specify will be IGNORED.''')
    parser.add_argument('pdb')
    parser.add_argument('input_dir', help='''Path to the parent directory
        containing subdirectories with MD (.xtc/.dcd) data. See the description above
        for the appropriate formatting for directory architecture.''')
    parser.add_argument('source', help='''Data source: "file", "file_dcd" or
        "fah". This is the style of trajectory data that gets fed into MSMBuilder.
        If a file, then it requires each trajectory be housed in a separate directory
        like (PROJECT/TRAJ*/frame*.xtc). If 'fah', then standard FAH-style directory
        architecture is required.''', default='file', choices=['fah', 'file', 'file_dcd'])
    parser.add_argument('min_length', help='''Minimum number of frames per trajectory
        required to include data in Project.  Used to discard extremely short
        trajectories.''', default=0, type=int)
Can read any format compatible with mdtraj.

Output:
-- 'Trajectories' directory containing all the merged h5 files
-- 'ProjectInfo' file containing information MSMBuilder uses in subsequent
 calculations.

NOTE: There has been a change from previous versions of MSMBuilder with
regards to the way snapshots are discarded. In the 'FAH' style reader,
there is an automatic check to see if any two snapshots are the same at
the beginning/end of consecutive xtc/dcd files. If they are the same, one
gets discarded. Further, the FahProject object retains a little more discard
functionality.
""")
parser.add_argument('project',
                    type=str,
                    help='''The ProjectInfo (.h5) to
    write to disk. Contains metadata associated with your project''')
parser.add_argument('pdb')
parser.add_argument('input_dir',
                    help='''Path to the parent directory
    containing subdirectories with MD data. See the description above
    for the appropriate formatting for directory architecture.''')
parser.add_argument('source',
                    help='''Data source: "file", or
    "fah". For "file" format, each of the trajectories needs to be
    in a different directory. For example, if you supply input_dir='XTC', then
    it is expected that the directory 'XTC' contains a set of subdirectories, each
    of which contains one or more files of a single MD trajectory that will be concatenated
    together. The glob pattern used would be XTC/*/*.*'. If 'fah', then standard
    folding@home-style directory architecture is required. If the IEXT option
    is given, the glob pattern will be restricted to the given file extension