Example #1
0
    def __call__(self, data_file, read_file, reference_file, output="Resequencing", min_length=500):
        # Validate and set-up run-specific values
        self._counter = 0
        data_file = validate_file(data_file)
        read_file = validate_file(read_file)
        reference_file = validate_file(reference_file)
        self.initialize_output(output)

        # Next we run the 5-step Quiver Process
        whitelist_file = self.create_whitelist(read_file)
        self.create_fai(reference_file)
        rgnh5_file = self.create_rgnh5(data_file, whitelist_file)
        cmph5_file = self.run_pbalign(data_file, reference_file, rgnh5_file, min_length)
        consensus_file = self.run_quiver(cmph5_file, reference_file)
        return consensus_file
Example #2
0
    def validate_program(self, programs):
        # First we try to find the program in the local path
        program_paths = [which(program) for program in programs]
        program_paths = [path for path in program_paths if path is not None]
        print programs
        print program_paths
        if program_paths:
            return program_paths[0]
        elif self.setup is None:
            msg = 'No program from the set "%s" found in PATH and no SMRT Analysis supplied' % str(
                programs)
            log.error(msg)
            raise IOError(msg)

        # Fallback to the Setup Script if needed
        setup_programs = [
            os.path.join(self.setup, 'analysis/bin', p) for p in programs
        ]
        setup_programs = [validate_file(p) for p in setup_programs]
        setup_programs = [path for path in setup_programs if path is not None]
        if setup_programs:
            return setup_programs[0]
        else:
            msg = 'No program from the set "%s" found in either PATH or SMRT Analysis env' % str(
                programs)
            log.error(msg)
            raise IOError(msg)
Example #3
0
def get_barcode_reader( barcode_file ):
    barcode_file = validate_file( barcode_file )
    if barcode_file.endswith('.fofn'):
        log.info("Barcode input is Fofn, initializing BarcodeH5Collection")
        return BarcodeH5Fofn( barcode_file )
    elif barcode_file.endswith('.bc.h5'):
        log.info("Barcode input is BcH5, initializing BarcodeH5Reader")
        return BarcodeH5Reader( barcode_file )
    else:
        raise ValueError
Example #4
0
 def validate_setup_path(self, setup):
     setup = os.path.abspath(setup)
     if setup.endswith("/etc/setup.sh"):
         setup = setup[:-13]
         print setup
     setup_script = os.path.join(setup, "etc/setup.sh")
     print setup_script
     if not validate_file(setup_script):
         msg = "Supplied setup-script does not appear to be valid"
         log.error(msg)
         raise ValueError(msg)
     return setup
Example #5
0
    def __call__(self,
                 data_file,
                 read_file,
                 reference_file,
                 output='Resequencing',
                 min_length=500):
        # Validate and set-up run-specific values
        self._counter = 0
        data_file = validate_file(data_file)
        read_file = validate_file(read_file)
        reference_file = validate_file(reference_file)
        self.initialize_output(output)

        # Next we run the 5-step Quiver Process
        whitelist_file = self.create_whitelist(read_file)
        self.create_fai(reference_file)
        rgnh5_file = self.create_rgnh5(data_file, whitelist_file)
        cmph5_file = self.run_pbalign(data_file, reference_file, rgnh5_file,
                                      min_length)
        consensus_file = self.run_quiver(cmph5_file, reference_file)
        return consensus_file
Example #6
0
 def validate_setup_path(self, setup):
     setup = os.path.abspath(setup)
     if setup.endswith('/etc/setup.sh'):
         setup = setup[:-13]
         print setup
     setup_script = os.path.join(setup, 'etc/setup.sh')
     print setup_script
     if not validate_file(setup_script):
         msg = "Supplied setup-script does not appear to be valid"
         log.error(msg)
         raise ValueError(msg)
     return setup
Example #7
0
def get_bash5_reader(bash5_file):
    bash5_file = validate_file(bash5_file)
    if bash5_file.endswith('.fofn'):
        log.info("Raw data input is Fofn, initializing BasH5Collection")
        return BasH5Collection(bash5_file)
    elif bash5_file.endswith('.bas.h5'):
        log.info("Raw data input is BasH5, initializing BasH5Reader")
        return BasH5Reader(bash5_file)
    elif bash5_file.endswith('.bax.h5'):
        log.info("Raw data input is BaxH5, initializing BaxH5Reader")
        return BaxH5Reader(bash5_file)
    else:
        raise ValueError
Example #8
0
def get_bash5_reader(bash5_file):
    bash5_file = validate_file(bash5_file)
    if bash5_file.endswith(".fofn"):
        log.info("Raw data input is Fofn, initializing BasH5Collection")
        return BasH5Collection(bash5_file)
    elif bash5_file.endswith(".bas.h5"):
        log.info("Raw data input is BasH5, initializing BasH5Reader")
        return BasH5Reader(bash5_file)
    elif bash5_file.endswith(".bax.h5"):
        log.info("Raw data input is BaxH5, initializing BaxH5Reader")
        return BaxH5Reader(bash5_file)
    else:
        raise ValueError
Example #9
0
def get_bash5_reader( bash5_file ):
    bash5_file = validate_file( bash5_file )
    if bash5_file.endswith('.fofn'):
        log.info("Raw data input is Fofn, initializing BasH5Collection")
        c = BasH5Collection( bash5_file )
        assert len(c.movieNames) == 1       # Currently we only accept single-movies
        return c
    elif bash5_file.endswith('.bas.h5'):
        log.info("Raw data input is BasH5, initializing BasH5Reader")
        return BasH5Reader( bash5_file )
    elif bash5_file.endswith('.bax.h5'):
        log.info("Raw data input is BaxH5, initializing BaxH5Reader")
        return BaxH5Reader( bash5_file )
    else:
        raise ValueError
Example #10
0
def get_bash5_reader(bash5_file):
    bash5_file = validate_file(bash5_file)
    if bash5_file.endswith('.fofn'):
        log.info("Raw data input is Fofn, initializing BasH5Collection")
        c = BasH5Collection(bash5_file)
        assert len(c.movieNames) == 1  # Currently we only accept single-movies
        return c
    elif bash5_file.endswith('.bas.h5'):
        log.info("Raw data input is BasH5, initializing BasH5Reader")
        return BasH5Reader(bash5_file)
    elif bash5_file.endswith('.bax.h5'):
        log.info("Raw data input is BaxH5, initializing BaxH5Reader")
        return BaxH5Reader(bash5_file)
    else:
        raise ValueError
Example #11
0
    def validate_program(self, programs):
        # First we try to find the program in the local path
        program_paths = [which(program) for program in programs]
        program_paths = [path for path in program_paths if path is not None]
        print programs
        print program_paths
        if program_paths:
            return program_paths[0]
        elif self.setup is None:
            msg = 'No program from the set "%s" found in PATH and no SMRT Analysis supplied' % str(programs)
            log.error(msg)
            raise IOError(msg)

        # Fallback to the Setup Script if needed
        setup_programs = [os.path.join(self.setup, "analysis/bin", p) for p in programs]
        setup_programs = [validate_file(p) for p in setup_programs]
        setup_programs = [path for path in setup_programs if path is not None]
        if setup_programs:
            return setup_programs[0]
        else:
            msg = 'No program from the set "%s" found in either PATH or SMRT Analysis env' % str(programs)
            log.error(msg)
            raise IOError(msg)
Example #12
0
 def check_output(self):
     return validate_file(self.output)
Example #13
0
 def check_output(self):
     return validate_file( self.output )
Example #14
0
 def check_arguments(self):
     assert self.prefix_arg
     assert not validate_file(self.output)
Example #15
0
 def check_arguments(self):
     assert self.prefix_arg
     assert not validate_file(self.output)