parameters: (bamFile)
docstring: make sure bam file has an index
docstring_summary: make sure bam file has an index
docstring_tokens: make sure bam file has an index
function: def checkForBamIndex(bamFile):
      """
      make sure bam file has an index
      """
      # check for multi-extension index format PREFIX.bam -> PREFIX.bam.bai:
      for ext in (".bai", ".csi", ".crai") :
          indexFile=bamFile + ext
          if os.path.isfile(indexFile) : return
  
      # check for older short index format PREFIX.bam -> PREFIX.bai:
      for (oldSuffix,newSuffix) in [ (".bam",".bai") ] :
          if not bamFile.endswith(oldSuffix) : continue
          indexFile=bamFile[:-len(oldSuffix)] + newSuffix
          if os.path.isfile(indexFile) : return
  
      raise OptParseException("Can't find any expected BAM/CRAM index files for: '%s'" % (bamFile))
function_tokens: def checkForBamIndex ( bamFile ) : # check for multi-extension index format PREFIX.bam -> PREFIX.bam.bai: for ext in ( ".bai" , ".csi" , ".crai" ) : indexFile = bamFile + ext if os . path . isfile ( indexFile ) : return # check for older short index format PREFIX.bam -> PREFIX.bai: for ( oldSuffix , newSuffix ) in [ ( ".bam" , ".bai" ) ] : if not bamFile . endswith ( oldSuffix ) : continue indexFile = bamFile [ : - len ( oldSuffix ) ] + newSuffix if os . path . isfile ( indexFile ) : return raise OptParseException ( "Can't find any expected BAM/CRAM index files for: '%s'" % ( bamFile ) )