Ejemplo n.º 1
0
class ForQuiverService(object):
    """ Uses SortService, LoadPulsesService, RepackService to post process
    a cmp.h5 file so that the file can be used by quiver directly.
    """
    @property
    def name(self):
        """Name of ForQuiverService."""
        return "ForQuiverService"

    def __init__(self, fileNames, options):
        """Initialize a ForQuiverService object.

        Input:
            fileNames : pbalign file names
            options   : pbalign options

        """
        self.fileNames = fileNames
        self.options = options
        self._loadpulsesService = LoadPulsesService(
            self.fileNames.pulseFileName,
            self.fileNames.outputFileName,
            self.options)
        self._sortService = SortService(
            self.fileNames.outputFileName,
            self.options)
        self._repackService = RepackService(
            self.fileNames.outputFileName,
            self.fileNames.outputFileName + ".TMP")

    def run(self):
        """ Run the ForQuiver service."""
        logging.info(self.name + ": Sort.")

        self._sortService.checkAvailability()
        self._sortService.run()

        logging.info(self.name + ": LoadPulses.")
        self._loadpulsesService.checkAvailability()
        self._loadpulsesService.run()

        logging.info(self.name + ": Repack.")
        self._repackService.checkAvailability()
        self._repackService.run()
Ejemplo n.º 2
0
    def setUp(self):
        """Set up tests."""
        self.rootDir = "/mnt/secondary-siv/secondarytest/" + \
                       "testdata/BlasrTestData/pbalign"
        self.inCmpFile = path.join(self.rootDir, "data/testsort.cmp.h5")
        self.outCmpFile = mkstemp(suffix=".cmp.h5")[1]

        copyfile(self.inCmpFile, self.outCmpFile)
        self.options = Opt()
        self.obj = SortService(self.outCmpFile, self.options)
Ejemplo n.º 3
0
    def __init__(self, fileNames, options):
        """Initialize a ForQuiverService object.

        Input:
            fileNames : pbalign file names
            options   : pbalign options

        """
        self.fileNames = fileNames
        self.options = options
        self._loadpulsesService = LoadPulsesService(
            self.fileNames.pulseFileName,
            self.fileNames.outputFileName,
            self.options)
        self._sortService = SortService(
            self.fileNames.outputFileName,
            self.options)
        self._repackService = RepackService(
            self.fileNames.outputFileName,
            self.fileNames.outputFileName + ".TMP")
Ejemplo n.º 4
0
class Test_SortService(unittest.TestCase):
    """Test pbtools.pbalign.forquiverservice.sort."""
    def setUp(self):
        """Set up tests."""
        self.rootDir = "/mnt/secondary-siv/secondarytest/" + \
                       "testdata/BlasrTestData/pbalign"
        self.inCmpFile = path.join(self.rootDir, "data/testsort.cmp.h5")
        self.outCmpFile = mkstemp(suffix=".cmp.h5")[1]

        copyfile(self.inCmpFile, self.outCmpFile)
        self.options = Opt()
        self.obj = SortService(self.outCmpFile, self.options)

    def tearDown(self):
        remove(self.outCmpFile)

    def test_run(self):
        """Test SortService.__init__()."""
        print self.obj.cmd
        _output, errCode, _errMsg = self.obj.run()
        self.assertEqual(errCode, 0)