Check if an analysis is referenced by other anylisis in the given
analysis collection.
347804
function _isAnalysisPartOfOtherAnalyses (analysis, analysisList) {
  return _.any(analysisList, function (otherAnalysisModel) {
    if (!analysis.equals(otherAnalysisModel)) {
      return otherAnalysisModel.findAnalysisById(analysis.get('id'));
    }
    return false;
  });
}
1079780
def after_unassign(reference_analysis):
    
    analysis_events.after_unassign(reference_analysis)
    ref_sample = reference_analysis.aq_parent
    ref_sample.manage_delObjects([reference_analysis.getId()])
1143434
def guard_cancel(analysis_request):
    
    # Ask to partitions
    for partition in analysis_request.getDescendants(all_descendants=False):
        if not isTransitionAllowed(partition, "cancel"):
            return False

    # Look through analyses. We've checked the partitions already, so there is
    # no need to look through analyses from partitions again, but through the
    # analyses directly bound to the current Analysis Request.
    cancellable_states = ["unassigned", "registered"]
    for analysis in analysis_request.objectValues("Analysis"):
        if api.get_workflow_status_of(analysis) not in cancellable_states:
            return False

    return True
128587
def tree_is_in_collection(collection, study_id=None, tree_id=None):
    
    included = collection_to_included_trees(collection)
    study_id = study_id.strip()
    tree_id = tree_id.strip()
    for decision in included:
        if decision['studyID'] == study_id and decision['treeID'] == tree_id:
            return True
    return False
174718
def guard_unassign(duplicate_analysis):
    
    analysis = duplicate_analysis.getAnalysis()
    if wf.isTransitionAllowed(analysis, "unassign"):
        return True
    skip = ["retracted", "rejected", "unassigned"]
    if api.get_review_status(analysis) in skip:
        return True
    return analysis_guards.guard_unassign(duplicate_analysis)
488663
protected boolean shouldAnalyze() {
        if (analyzer instanceof FileTypeAnalyzer) {
            final FileTypeAnalyzer fileTypeAnalyzer = (FileTypeAnalyzer) analyzer;
            return fileTypeAnalyzer.accept(dependency.getActualFile());
        }
        return true;
    }
1348339
def contains_at(self, x, index):
        """"""

        try:
            if is_collection(x):
                for _x in x:
                    if (_x in self.all[index]) or (_x == self.all[index]):
                        return True
                    else:
                        return False
            else:
                return (x in self.all[index])

        except IndexError:
            return False
503686
def collect_analysis(self):
        '''
        
        '''
        analysis = {}
        for field in self.fields.values():
            for analyzer_name in ('analyzer', 'index_analyzer', 'search_analyzer'):
                if not hasattr(field, analyzer_name):
                    continue

                analyzer = getattr(field, analyzer_name)

                if not isinstance(analyzer, Analyzer):
                    continue

                definition = analyzer.get_analysis_definition()
                if definition is None:
                    continue

                for key in definition:
                    analysis.setdefault(key, {}).update(definition[key])

        return analysis
930969
def check(context: click.Context, family: str):
    """"""
    analysis_obj = context.obj['store'].analyses(family=family).first()
    if analysis_obj is None:
        LOG.error('no analysis found')
        context.abort()

    config_path = Path(analysis_obj.config_path)
    if not config_path.exists():
        LOG.error(f"analysis config not found: {config_path}")
        context.abort()
    config_raw = ruamel.yaml.safe_load(config_path.open())
    config_data = files.parse_config(config_raw)

    sampleinfo_raw = ruamel.yaml.safe_load(Path(config_data['sampleinfo_path']).open())
    sampleinfo_data = files.parse_sampleinfo(sampleinfo_raw)

    qcmetrics_path = Path(sampleinfo_data['qcmetrics_path'])
    if not qcmetrics_path.exists():
        LOG.error(f"qc metrics not found: {str(qcmetrics_path)}")
        context.abort()
    qcmetrics_raw = ruamel.yaml.safe_load(qcmetrics_path.open())
    qcmetrics_data = files.parse_qcmetrics(qcmetrics_raw)

    samples = {
        'sample': [],
        'type': [],
        'ped': [],
        'chanjo': [],
        'peddy': [],
        'plink': [],
        'duplicates': [],
    }
    for sample_data in config_data['samples']:
        LOG.debug(f"{sample_data['id']}: parse analysis config")
        samples['sample'].append(sample_data['id'])
        samples['type'].append(sample_data['type'])

    for sample_data in sampleinfo_data['samples']:
        LOG.debug(f"{sample_data['id']}: parse sample info")
        samples['ped'].append(sample_data['sex'])

        with Path(sample_data['chanjo_sexcheck']).open() as chanjo_handle:
            sexcheck_data = files.parse_chanjo_sexcheck(chanjo_handle)

        predicted_sex = sexcheck_data['predicted_sex']
        xy_ratio = sexcheck_data['y_coverage'] / sexcheck_data['x_coverage']
        samples['chanjo'].append(f"{predicted_sex} ({xy_ratio:.3f})")

    for sample_data in qcmetrics_data['samples']:
        LOG.debug(f"{sample_data['id']}: parse qc metrics")
        samples['plink'].append(sample_data['plink_sex'])
        duplicates_percent = sample_data['duplicates'] * 100
        samples['duplicates'].append(f"{duplicates_percent:.3f}%")

    peddy_path = Path(sampleinfo_data['peddy']['sex_check'])
    if peddy_path.exists():
        with peddy_path.open() as sexcheck_handle:
            peddy_data = files.parse_peddy_sexcheck(sexcheck_handle)

        for sample_id in samples['sample']:
            LOG.debug(f"{sample_id}: parse peddy")
            predicted_sex = peddy_data[sample_id]['predicted_sex']
            het_ratio = peddy_data[sample_id]['het_ratio']
            samples['peddy'].append(f"{predicted_sex} ({het_ratio})")
    else:
        LOG.warning(f"missing peddy output: {peddy_path}")

    print(tabulate(samples, headers='keys', tablefmt='psql'))
1136436
function has(tasks, when) {
  if (!tasks) {
    return false;
  }
  if (!when) {
    if (tasks.length) {
      return true;
    }
    return false;
  }
  return !!utils.classify(tasks)[when].length;
}
168663
def has_intersection(self, other):
        
        return bool(lib.SDL_HasIntersection(self._ptr, other._ptr))
462575
def contains_all(self, other):
        """"""
        dtype = getattr(other, 'dtype', None)
        if dtype is None:
            dtype = np.result_type(*other)
        return is_int_dtype(dtype)
386250
def get_analysis_type(self, instance):
        
        if IDuplicateAnalysis.providedBy(instance):
            return 'd'
        elif IReferenceAnalysis.providedBy(instance):
            return instance.getReferenceType()
        elif IRoutineAnalysis.providedBy(instance):
            return 'a'
        return None
979216
def analysis(self, analysis_id: int) -> models.Analysis:
        """"""
        return self.Analysis.query.get(analysis_id)
484832
def is_subset(self, other):
        """"""
        if isinstance(other, Permissions):
            return (self.value & other.value) == self.value
        else:
            raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__class__.__name__))
527851
function checkOld (id, ts) {
    return false
    if(sources[id] && sources[id] >= ts) return true
    sources[id] = ts
  }
43431
def do_action_to_analyses(analysis_request, transition_id, all_analyses=False):
    
    analyses = list()
    if all_analyses:
        analyses = analysis_request.getAnalyses(full_objects=True)
    else:
        analyses = analysis_request.objectValues("Analysis")
    for analysis in analyses:
        do_action_for(analysis, transition_id)