helper - Shared Functionality For the Everything

Introduction

We collect functions here, which should be useful in many places but would make rather empty modules left alone.

Messages

from promod3.core import helper

helper.MsgErrorAndExit("Something failed!", 1)

File Tests

The following example parses an argument (call as pm SCRIPTNAME FILENAME) as a file name and checks whether it is a pdb or mmcif file.

"""Test for file reading."""
from promod3.core import helper
from promod3.core import pm3argparse

p = pm3argparse.PM3ArgumentParser(__doc__)
p.add_argument('file', type=str)
opts = p.Parse()

helper.FileExists('Test file', 1, opts.file)

opts.name, opts.ext, opts.gz = helper.FileExtension('Test file', 2,
                                                    opts.file,
                                                    ('pdb', 'mmcif'),
                                                    gzip=True)

Search

Enter search terms or a module, class or function name.

Contents