def fastqc(self):
        """Run fastqc system calls"""
        while True:  # while daemon
            threadlock = threading.Lock()
            # Unpack the variables from the queue
            (sample, systemcall, outputdir, fastqcreads) = self.qcqueue.get()
            # Check to see if the output HTML file already exists
            try:
                _ = glob(os.path.join(outputdir, '*.html'))[0]
            except IndexError:
                # Make the output directory
                make_path(outputdir)
                # Run the system calls
                outstr = str()
                errstr = str()
                out, err = run_subprocess(systemcall)
                outstr += out
                errstr += err
                out, err = run_subprocess(fastqcreads)
                outstr += out
                errstr += err
                # Acquire thread lock, and write the logs to file
                threadlock.acquire()
                write_to_logfile(systemcall, systemcall, self.logfile, sample.general.logout, sample.general.logerr,
                                 None, None)
                write_to_logfile(fastqcreads, fastqcreads, self.logfile, sample.general.logout, sample.general.logerr,
                                 None, None)
                write_to_logfile(outstr, errstr, self.logfile, sample.general.logout, sample.general.logerr, None, None)
                threadlock.release()
                # Rename the outputs
                try:
                    shutil.move(os.path.join(outputdir, 'stdin_fastqc.html'),
                                os.path.join(outputdir, '{}_fastqc.html'.format(sample.name)))
                    shutil.move(os.path.join(outputdir, 'stdin_fastqc.zip'),
                                os.path.join(outputdir, '{}_fastqc.zip'.format(sample.name)))
                except IOError:
                    pass
            # Signal to qcqueue that job is done
            self.qcqueue.task_done()
def fastqc ( self ) : while True : threadlock = threading . Lock ( ) ( sample , systemcall , outputdir , fastqcreads ) = self . qcqueue . get ( ) try : _ = glob ( os . path . join ( outputdir , '*.html' ) ) [ 0 ] except IndexError : make_path ( outputdir ) outstr = str ( ) errstr = str ( ) out , err = run_subprocess ( systemcall ) outstr += out errstr += err out , err = run_subprocess ( fastqcreads ) outstr += out errstr += err threadlock . acquire ( ) write_to_logfile ( systemcall , systemcall , self . logfile , sample . general . logout , sample . general . logerr , None , None ) write_to_logfile ( fastqcreads , fastqcreads , self . logfile , sample . general . logout , sample . general . logerr , None , None ) write_to_logfile ( outstr , errstr , self . logfile , sample . general . logout , sample . general . logerr , None , None ) threadlock . release ( ) try : shutil . move ( os . path . join ( outputdir , 'stdin_fastqc.html' ) , os . path . join ( outputdir , '{}_fastqc.html' . format ( sample . name ) ) ) shutil . move ( os . path . join ( outputdir , 'stdin_fastqc.zip' ) , os . path . join ( outputdir , '{}_fastqc.zip' . format ( sample . name ) ) ) except IOError : pass self . qcqueue . task_done ( )
Run fastqc system calls