Check if current folder contains a qual file associated with the fastafile
496717
def get_qual(fastafile, suffix=QUALSUFFIX, check=True):
    
    qualfile1 = fastafile.rsplit(".", 1)[0] + suffix
    qualfile2 = fastafile + suffix

    if check:
        if op.exists(qualfile1):
            logging.debug("qual file `{0}` found".format(qualfile1))
            return qualfile1
        elif op.exists(qualfile2):
            logging.debug("qual file `{0}` found".format(qualfile2))
            return qualfile2
        else:
            logging.warning("qual file not found")
            return None

    return qualfile1
490869
def check_path(options, rootdir=None, candidates=None, code=None):
    
    if not candidates:
        candidates = []
        for path_ in options.paths:
            path = op.abspath(path_)
            if op.isdir(path):
                for root, _, files in walk(path):
                    candidates += [op.relpath(op.join(root, f), CURDIR)
                                   for f in files]
            else:
                candidates.append(path)

    if rootdir is None:
        rootdir = path if op.isdir(path) else op.dirname(path)

    paths = []
    for path in candidates:

        if not options.force and not any(l.allow(path)
                                         for _, l in options.linters):
            continue

        if not op.exists(path):
            continue

        paths.append(path)

    if options.concurrent:
        return check_async(paths, options, rootdir)

    errors = []
    for path in paths:
        errors += run(path=path, code=code, rootdir=rootdir, options=options)
    return errors
1196629
def check_files(self, paths=None):
        """"""
        if paths is None:
            paths = self.paths
        report = self.options.report
        runner = self.runner
        report.start()
        try:
            for path in paths:
                if os.path.isdir(path):
                    self.input_dir(path)
                elif not self.excluded(path):
                    runner(path)
        except KeyboardInterrupt:
            print('... stopped')
        report.stop()
        return report
922267
def contains_parent_dir(fpath, dirs):
    
    # Note: this function is used nowhere in pygccxml but is used
    # at least by pypluplus; so it should stay here.

    return bool([x for x in dirs if _f(fpath, x)])
327489
def _task_file_exists(self, task_fs):
        
        for filename in ["task.{}".format(ext) for ext in self.get_available_task_file_extensions()]:
            if task_fs.exists(filename):
                return True
        return False
727962
def do_files_exist(filenames):
  """"""
  preexisting = [tf.io.gfile.exists(f) for f in filenames]
  return any(preexisting)
71177
def findinfiles_callback(self):
        """"""
        widget = QApplication.focusWidget()
        if not self.ismaximized:
            self.dockwidget.setVisible(True)
            self.dockwidget.raise_()
        text = ''
        try:
            if widget.has_selected_text():
                text = widget.get_selected_text()
        except AttributeError:
            # This is not a text widget deriving from TextEditBaseWidget
            pass
        self.findinfiles.set_search_text(text)
        if text:
            self.findinfiles.find()
557220
def file_exists(self) -> bool:
        
        cfg_path = self.file_path
        assert cfg_path

        return path.isfile(cfg_path)
994783
def _HasFile(self, file_name):
    """"""
    if self._zip:
      return file_name in self._zip.namelist()
    else:
      file_path = os.path.join(self._path, file_name)
      return os.path.exists(file_path) and os.path.isfile(file_path)
787217
function (dir, filelist, ext, currentBundleOptions) {
    var path = path || require('path');
    var fs = fs || require('fs');
    var files = fs.readdirSync(dir);
    filelist = filelist || [];
    files.forEach(function (file) {
        if (fs.statSync(path.join(dir, file)).isDirectory()) {
            filelist = walkSync(path.join(dir, file), filelist, ext, currentBundleOptions);
        }
        else {
            if (file.match(new RegExp("." + ext + "$")) && !isExcluded(file, currentBundleOptions))
                filelist.push(path.join(dir, file));
        }
    });
    return filelist;
}
543312
function checkContainsPathComponent(dirs, path) {
    return _.find(dirs, function(dir) {
      var v = path.indexOf(dir);
      return v == 0;
    });
  }
867476
def fileExists(fName, dire=pDir()):
    
    if os.path.isfile(os.path.join(dire, fName)):
        return True
    return False
676409
def check_folders(name):
    """"""

    if os.getcwd().endswith('analyses'):
        correct = input('You are in an analyses folder. This will create '
                        'another analyses folder inside this one. Do '
                        'you want to continue? (y/N)')
        if correct != 'y':
            return False

    if not os.path.exists(os.path.join(os.getcwd(), 'analyses')):
        correct = input('This is the first analysis here. Do '
                        'you want to continue? (y/N)')
        if correct != 'y':
            return False

    if os.path.exists(os.path.join(os.getcwd(), 'analyses', name)):
        correct = input('An analysis with this name exists already. Do '
                        'you want to continue? (y/N)')
        if correct != 'y':
            return False

    return True
527361
def is_fasta(filename):
    
    if re.search("\.fa*s[ta]*$", filename, flags=re.I):
        return True
    elif re.search("\.fa$", filename, flags=re.I):
        return True
    else:
        return False
331491
def get_fastq_files(directory, lane, fc_name):
    
    files = glob.glob(os.path.join(directory, "%s_*%s*txt*" % (lane, fc_name)))
    files.sort()
    if len(files) > 2 or len(files) == 0:
        raise ValueError("Did not find correct files for %s %s %s %s" %
                (directory, lane, fc_name, files))
    ready_files = []
    for fname in files:
        if fname.endswith(".gz"):
            cl = ["gunzip", fname]
            subprocess.check_call(cl)
            ready_files.append(os.path.splitext(fname)[0])
        else:
            ready_files.append(fname)
    return ready_files[0], (ready_files[1] if len(ready_files) > 1 else None)
1057891
function checkForChangedFiles(dir) {
    var fileList = fs.readdirSync(dir);
    for (var i=0;i<fileList.length;i++) {
        if (!isWatching(fileList[i])) {
            continue;
        }
        if (!fs.existsSync(dir+fileList[i])) { continue; }
        var stats;
        try {
            stats = fs.statSync(dir + fileList[i]);
        }
        catch (err) {
            // this means the file disappeared between the exists and when we tried to stat it...
            continue;
        }
        if (timeStamps[dir+fileList[i]] === undefined || timeStamps[dir+fileList[i]] !== stats.mtime.getTime()) {
            //console.log("Found 1: ", dir+fileList[i], timeStamps[dir+fileList[i]], stats.mtime.getTime());

            timeStamps[dir+fileList[i]] = stats.mtime.getTime();
            return dir+fileList[i];
        }
    }
    return null;
}
765880
function isFile(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isFile();
  } catch (e) {
    return false;
  }
}