def _validateArgs( self, args ): if "out" not in args.keys(): msg = "No valid output file for BLASR supplied!" log.error( msg ) raise BlasrIOError( msg ) elif utils.isValidFile( args["out"] ): utils.removeFile( args["out"] )
def _validateOutput( self, outFile ): if utils.isValidFile( outFile ): return outFile else: msg = 'An unknown error occurred - output file "{0}" isn''t valid'.format(outFile) log.error( msg ) raise BlasrIOError( msg )
def __validateInput(self, inputArg): """ Valid the input argument and convert to a single absolute filepath """ if utils.isValidDirectory(inputArg): log.info( "Input appears to be a directory, looking for analysis FASTQ result" ) contents = os.listdir(inputArg) absDir = op.abspath(inputArg) if "amplicon_analysis.fastq" in contents: absPath = op.join(absDir, "amplicon_analysis.fastq") if utils.isValidFastq(absPath): return absPath elif "loci_analysis.fastq" in contents: absPath = op.join(absDir, "loci_analysis.fastq") if utils.isValidFastq(absPath): return absPath else: msg = "No valid analysis FASTQ files found in the input directory!" log.error(msg) raise IOError(msg) elif utils.isValidFile(inputArg): if utils.isValidFasta(inputArg): return op.abspath(inputArg) elif utils.isValidFastq(inputArg): return op.abspath(inputArg) else: msg = "Input is not a valid FASTQ or FASTQ file!" log.error(msg) raise IOError(msg) else: msg = "Input is not a valid analysis file or directory!" log.error(msg) raise IOError(msg)
def _validateQuery( self, query ): if query not in self._validFiles: if utils.isValidFile( query ): self._validFiles.append( query ) else: msg = "Supplied query file for BLASR isn't valid" log.error( msg ) raise BlasrIOError( msg )
def _formatCommand( self, query, reference, args ): """Format a dictionary of arguments into a callable list""" command = [self._exe, query, reference] for arg, value in args.iteritems(): if len(arg) == 1: arg = '-' + str(arg) else: arg = '--' + str(arg) if value is True: command += [arg] else: command += [arg, str(value)] # Add in the index, if available if "sa" not in args: saFile = reference + ".sa" if reference in self._refWithIndex: command += ["--sa", saFile] elif utils.isValidFile( saFile ): command += ["--sa", saFile] return command
def exonReferenceExists(): return utils.isValidFile(_EXON_REF)
def cDNAReferenceExists(): return utils.isValidFile(_CDNA_REF)
def genomicReferenceExists(): return utils.isValidFile(_GENOMIC_REF)