return the min UMI(s) need to account for cluster
13562
def _get_best_min_account(self, cluster, adj_list, counts):
        ''' '''
        if len(cluster) == 1:
            return list(cluster)

        sorted_nodes = sorted(cluster, key=lambda x: counts[x],
                              reverse=True)

        for i in range(len(sorted_nodes) - 1):
            if len(remove_umis(adj_list, cluster, sorted_nodes[:i+1])) == 0:
                return sorted_nodes[:i+1]
1143549
def min(self):
        
        return int(self._min) if not np.isinf(self._min) else self._min
461189
def _sam_to_grouped_umi_cl(data, umi_consensus, tx_out_file):
    
    tmp_file = "%s-sorttmp" % utils.splitext_plus(tx_out_file)[0]
    jvm_opts = _get_fgbio_jvm_opts(data, os.path.dirname(tmp_file), 1)
    cores, mem = _get_cores_memory(data)
    bamsormadup = config_utils.get_program("bamsormadup", data)
    cmd = ("{bamsormadup} tmpfile={tmp_file}-markdup inputformat=sam threads={cores} outputformat=bam "
           "level=0 SO=coordinate | ")
    # UMIs in a separate file
    if os.path.exists(umi_consensus) and os.path.isfile(umi_consensus):
        cmd += "fgbio {jvm_opts} AnnotateBamWithUmis -i /dev/stdin -f {umi_consensus} -o {tx_out_file}"
    # UMIs embedded in read name
    else:
        cmd += ("%s %s bamtag - | samtools view -b > {tx_out_file}" %
                (utils.get_program_python("umis"),
                 config_utils.get_program("umis", data["config"])))
    return cmd.format(**locals())
748975
private ArrayList<String[]> findCluster(Cluster cluster, double cutDist, int minPatternPerCls) {

    ArrayList<String[]> clusterTSIdx = new ArrayList<String[]>();

    if (cluster.getDistance() != null) {
      // if (cluster.getDistance() > cutDist) {
      if (cluster.getDistanceValue() > cutDist) {
        if (cluster.getChildren().size() > 0) {
          clusterTSIdx.addAll(findCluster(cluster.getChildren().get(0), cutDist, minPatternPerCls));
          clusterTSIdx.addAll(findCluster(cluster.getChildren().get(1), cutDist, minPatternPerCls));
        }
      }
      else {
        // String[] idxes = cluster.getName().split("&");
        ArrayList<String> itemsInCluster = getNameInCluster(cluster);
        String[] idxes = itemsInCluster.toArray(new String[itemsInCluster.size()]);
        if (idxes.length > minPatternPerCls) {
          clusterTSIdx.add(idxes);
        }
      }
    }

    return clusterTSIdx;
  }
1160792
def read_clusters(self, min_cluster_size):
        """"""
        num_found = 0
        clusters = []
        with open(self.get_path(OslomRunner.OUTPUT_FILE), "r") as reader:
            # Read the output file every two lines
            for line1, line2 in itertools.izip_longest(*[reader] * 2):
                info = OslomRunner.RE_INFOLINE.match(line1.strip()).groups()
                nodes = line2.strip().split(" ")
                if len(nodes) >= min_cluster_size: # Apply min_cluster_size
                    clusters.append({
                        "id": int(info[0]),
                        "bs": float(info[2]),
                        "nodes": [{"id": self.id_remapper.get_str_id(int(n))} for n in nodes],
                    })
                num_found += 1
        return {"num_found": num_found, "clusters": clusters}
713833
def size(default_chunk_size, response_time_max, response_time_actual):
    """"""
    if response_time_actual == 0:
        response_time_actual = 1
    scale = 1 / (response_time_actual / response_time_max)
    size = int(default_chunk_size * scale)
    return min(max(size, 1), default_chunk_size)
126093
int refreshAndGetMin() {
		int min = Integer.MAX_VALUE;

		ResultSubpartition[] allPartitions = partition.getAllPartitions();
		if (allPartitions.length == 0) {
			// meaningful value when no channels exist:
			return 0;
		}

		for (ResultSubpartition part : allPartitions) {
			int size = part.unsynchronizedGetNumberOfQueuedBuffers();
			min = Math.min(min, size);
		}

		return min;
	}
97873
def get_dump_best_secondary(self, max_repl_lag=None):
        
        secondary_lag_tuples = []

        primary_member = self.get_primary_member()
        if not primary_member:
            raise MongoctlException("Unable to determine primary member for"
                                    " cluster '%s'" % self.id)

        master_status = primary_member.get_server().get_member_rs_status()

        if not master_status:
            raise MongoctlException("Unable to determine replicaset status for"
                                    " primary member '%s'" %
                                    primary_member.get_server().id)

        for member in self.get_members():
            if member.get_server().is_secondary():
                repl_lag = member.get_server().get_repl_lag(master_status)
                if max_repl_lag and  repl_lag > max_repl_lag:
                    log_info("Excluding member '%s' because it's repl lag "
                             "(in seconds)%s is more than max %s. " %
                             (member.get_server().id,
                              repl_lag, max_repl_lag))
                    continue
                secondary_lag_tuples.append((member,repl_lag))

        def best_secondary_comp(x, y):
            x_mem, x_lag = x
            y_mem, y_lag = y
            if x_mem.is_passive():
                if y_mem.is_passive():
                    return x_lag - y_lag
                else:
                    return -1
            elif y_mem.is_passive():
                return 1
            else:
                return x_lag - y_lag

        if secondary_lag_tuples:
            secondary_lag_tuples.sort(best_secondary_comp)
            return secondary_lag_tuples[0][0]
565976
def countContigClusters(clus)
      cur = clus; nxt = 0
      loop do
        nxt = getFatEntry(cur)
        break if nxt != cur + 1
        cur = nxt; redo
      end
      raise "Damaged cluster in cluster chain" if nxt == CC_DAMAGED
      cur - clus + 1
    end
1051686
def _get_min_addr(self):
        

        if not self._regions:
            if self.project.arch.name != "Soot":
                l.error("self._regions is empty or not properly set.")
            return None

        return next(self._regions.irange())
203339
def get_substr_slices(umi_length, idx_size):
    '''
    
    '''
    cs, r = divmod(umi_length, idx_size)
    sub_sizes = [cs + 1] * r + [cs] * (idx_size - r)
    offset = 0
    slices = []
    for s in sub_sizes:
        slices.append((offset, offset + s))
        offset += s
    return slices
1155640
public int getTotalClusterCount() {
    int clusterCount = 0;

    for(int i = 0; i < numclusters.length; i++) {
      clusterCount += numclusters[i];
    }

    return clusterCount;
  }
877992
def area_pipe_min(self):
        """"""
        return (self.safety_factor * self.q / self.vel_critical).to(u.cm**2)
156937
def minimum(rule, artifact):
    
    m = 1.0
    for i in range(len(rule.R)):
        e = rule.R[i](artifact)
        if e is not None:
            if e < m:
                m = e
    return m
183113
def min_query(self, query_type='list_nodes_min'):
        '''
        
        '''
        mapper = salt.cloud.Map(self._opts_defaults())
        mapper.opts['selected_query_option'] = 'list_nodes_min'
        return mapper.map_providers_parallel(query_type)
264335
def get_topic_partition_with_error(cluster_config, error, fetch_unavailable_brokers=False):
    """"""

    metadata = get_topic_partition_metadata(cluster_config.broker_list)
    affected_partitions = set()
    if fetch_unavailable_brokers:
        unavailable_brokers = set()
    with ZK(cluster_config) as zk:
        for partitions in metadata.values():
            for partition_metadata in partitions.values():
                if int(partition_metadata.error) == error:
                    if fetch_unavailable_brokers:
                        unavailable_brokers |= get_unavailable_brokers(zk, partition_metadata)
                    affected_partitions.add((partition_metadata.topic, partition_metadata.partition))

    if fetch_unavailable_brokers:
        return affected_partitions, unavailable_brokers
    else:
        return affected_partitions
1365495
def _find_umi(files):
    
    base = os.path.basename(_commonprefix(files))

    def _file_ext(f):
        exts = utils.splitext_plus(os.path.basename(f).replace(base, ""))[0].split("_")
        exts = [x for x in exts if x]
        return exts[0]

    exts = dict([(_file_ext(f), f) for f in files])
    if "I1" in exts:
        return exts["R1"], exts["R2"], exts["I1"]
    else:
        assert "R3" in exts, exts
        return exts["R1"], exts["R3"], exts["R2"]