Generate read group names from item inputs.
352398
def prep_rg_names(item, config, fc_name, fc_date):
    
    if fc_name and fc_date:
        lane_name = "%s_%s_%s" % (item["lane"], fc_date, fc_name)
    else:
        lane_name = item["description"]
    return {"rg": item["description"],
            "sample": item["description"],
            "lane": lane_name,
            "pl": (tz.get_in(["algorithm", "platform"], item)
                   or tz.get_in(["algorithm", "platform"], item, "illumina")).lower(),
            "lb": tz.get_in(["metadata", "library"], item),
            "pu": tz.get_in(["metadata", "platform_unit"], item) or lane_name}
988923
def itemlist(item, sep, suppress_trailing=True):
    """"""
    return condense(item + ZeroOrMore(addspace(sep + item)) + Optional(sep.suppress() if suppress_trailing else sep))
498697
def group_attrib(self):
        '''
        
        '''
        group_attributes = [g.attrib for g in self.dataset.groups if self in g]
        if group_attributes:
            return concat_namedtuples(*group_attributes)
476218
def attrgetcol(self, groupname, attrname):
        """"""
        values = []
        for rownr in range(self.attrnrows(groupname)):
            values.append(self.attrget(groupname, attrname, rownr))
        return values
614234
def _serialize_input_list(input_value):
        """"""
        input_list = []
        for item in input_value:
            if isinstance(item, list):
                input_list.append(Task._serialize_input_list(item))
            else:
                if isinstance(item, File):
                    item = Task._to_api_file_format(item)
                input_list.append(item)
        return input_list
580900
def _group_similar(items: List[T],
                   comparer: Callable[[T, T], bool]) -> List[List[T]]:
    
    groups = []  # type: List[List[T]]
    used = set()  # type: Set[int]
    for i in range(len(items)):
        if i not in used:
            group = [items[i]]
            for j in range(i + 1, len(items)):
                if j not in used and comparer(items[i], items[j]):
                    used.add(j)
                    group.append(items[j])
            groups.append(group)
    return groups
875245
def decode_data(self, input_data):
        """"""
        self.group_type_list = decode_array(input_data["groupTypeList"])
        self.x_coord_list = decode_array(input_data["xCoordList"])
        self.y_coord_list = decode_array(input_data["yCoordList"])
        self.z_coord_list = decode_array(input_data["zCoordList"])
        if "bFactorList" in input_data:
            self.b_factor_list = decode_array(input_data["bFactorList"])
        else:
            self.b_factor_list = []
        if "occupancyList" in input_data:
            self.occupancy_list = decode_array(input_data["occupancyList"])
        else:
            self.occupancy_list = []
        if "atomIdList" in input_data:
            self.atom_id_list = decode_array(input_data["atomIdList"])
        else:
            self.atom_id_list = []
        if "altLocList" in input_data:
            self.alt_loc_list = decode_array(input_data["altLocList"])
        else:
            self.alt_loc_list = []
        if "insCodeList" in input_data:
            self.ins_code_list = decode_array(input_data["insCodeList"])
        else:
            self.ins_code_list = []
        self.group_id_list = decode_array(input_data["groupIdList"])
        self.group_list = input_data["groupList"]
        if "sequenceIndexList" in input_data:
            self.sequence_index_list = decode_array(input_data["sequenceIndexList"])
        else:
            self.sequence_index_list = []
        self.chains_per_model = input_data["chainsPerModel"]
        self.groups_per_chain = input_data["groupsPerChain"]
        if "chainNameList" in input_data:
            self.chain_name_list = decode_array(input_data["chainNameList"])
        else:
            self.chain_name_list = []
        self.chain_id_list = decode_array(input_data["chainIdList"])
        if "spaceGroup" in input_data:
            self.space_group = input_data["spaceGroup"]
        else:
            self.space_group = None
        if "bondAtomList" in input_data:
            self.bond_atom_list = decode_array(input_data["bondAtomList"])
        else:
            self.bond_atom_list = None
        if "bondOrderList" in input_data:
            self.bond_order_list = decode_array(input_data["bondOrderList"])
        else:
            self.bond_order_list = None
        if sys.version_info[0] < 3:
            if "mmtfVersion" in input_data:
                self.mmtf_version = input_data["mmtfVersion"]
            else:
                self.mmtf_version = None
            if "mmtfProducer" in input_data:
                self.mmtf_producer = input_data["mmtfProducer"]
            else:
                self.mmtf_producer = None
            if "structureId" in input_data:
                self.structure_id = input_data["structureId"]
            else:
                self.structure_id = None
        else:
            if "mmtfVersion" in input_data:
                self.mmtf_version = input_data["mmtfVersion"]
            else:
                self.mmtf_version = None
            if "mmtfProducer" in input_data:
                self.mmtf_producer = input_data["mmtfProducer"]
            else:
                self.mmtf_producer = None
            if "structureId" in input_data:
                self.structure_id = input_data["structureId"]
            else:
                self.structure_id = None
        if "title" in input_data:
            if sys.version_info[0] < 3:
                self.title = input_data["title"]
            else:
                self.title = input_data["title"]
        if "experimentalMethods" in input_data:
            self.experimental_methods = input_data["experimentalMethods"]
        else:
            self.experimental_methods = None
        if "depositionDate" in input_data:
            self.deposition_date = input_data["depositionDate"]
        else:
            self.deposition_date = None
        if "releaseDate" in input_data:
            self.release_date = input_data["releaseDate"]
        else:
            self.release_date = None
        if "entityList" in input_data:
            self.entity_list = input_data["entityList"]
        else:
            self.entity_list = []
        if "bioAssemblyList" in input_data:
            self.bio_assembly = input_data["bioAssemblyList"]
        else:
            self.bio_assembly = []
        if "rFree" in input_data:
            self.r_free = input_data["rFree"]
        else:
            self.r_free = None
        if "rWork" in input_data:
            self.r_work = input_data["rWork"]
        else:
            self.r_work = None
        if "resolution" in input_data:
            self.resolution = input_data["resolution"]
        else:
            self.resolution = None
        if "unitCell" in input_data:
            self.unit_cell = input_data["unitCell"]
        else:
            self.unit_cell = None
        if "secStructList" in input_data:
            self.sec_struct_list = decode_array(input_data["secStructList"])
        # Now all the numbers to defien the
        self.num_bonds = int(input_data["numBonds"])
        self.num_chains = int(input_data["numChains"])
        self.num_models = int(input_data["numModels"])
        self.num_atoms = int(input_data["numAtoms"])
        self.num_groups = int(input_data["numGroups"])
280160
def allReadGroups(self):
        
        for dataset in self.getDatasets():
            for readGroupSet in dataset.getReadGroupSets():
                for readGroup in readGroupSet.getReadGroups():
                    yield readGroup
1129343
function readGetItemData(message, tokens) {
	message.itemNames = [];
	for (var i = 0; i < tokens.length; i = i + 2) {
		message.itemNames.push(protocol.decodeString(tokens[i + 1]));
	}
}
163165
def _rec_get_names(args, names=None):
    """"""
    if names is None:
        names = []
    for arg in args:
        if isinstance(arg, node_classes.Tuple):
            _rec_get_names(arg.elts, names)
        else:
            names.append(arg.name)
    return names
273000
def generate(tagGroups, terms):
    

    rv = []
    for pid in tagGroups:
        # In testing we may not have complete set
        if pid not in terms.keys():
            continue

        groupData = terms[pid]
        groupName = "[%s] %s" % (pid, groupData['name'])
        groupDesc = groupData['desc']
        children = []
        group = dict(name=groupName, desc=groupDesc, set=children)
        rv.append(group)

        for cid in groupData['children']:
            cData = terms[cid]
            cName = "[%s] %s" % (cid, cData['name'])
            cDesc = cData['desc']
            child = dict(name=cName, desc=cDesc)
            children.append(child)

    return json.dumps(rv, indent=2)
446345
def _get_dsnames(cls, data, ignore_keys=['attrs', 'plotter', 'ds'],
                     concat_dim=False):
        """"""
        def filter_ignores(item):
            return item[0] not in ignore_keys and isinstance(item[1], dict)
        if 'fname' in data:
            return {tuple(
                [data['fname'], data['store']] +
                ([data.get('concat_dim')] if concat_dim else []))}
        return set(chain(*map(partial(cls._get_dsnames, concat_dim=concat_dim,
                                      ignore_keys=ignore_keys),
                              dict(filter(filter_ignores,
                                          six.iteritems(data))).values())))
703728
function readGetItems(message, tokens) {
	message.userName = protocol.decodeString(tokens[1]);
	message.groupName = protocol.decodeString(tokens[3]);
	message.sessionId = protocol.decodeString(tokens[5]);
}
1352789
def getAllReadGroupSets(self):
        
        for dataset in self.getAllDatasets():
            iterator = self._client.search_read_group_sets(
                dataset_id=dataset.id)
            for readGroupSet in iterator:
                yield readGroupSet
1353914
def batch(items, size):
    """"""
    return [items[x:x + size] for x in xrange(0, len(items), size)]
738187
def loadSettings(self, groupName=None):
        
        groupName = groupName if groupName else self.settingsGroupName
        settings = QtCore.QSettings()
        logger.info("Reading {!r} from: {}".format(groupName, settings.fileName()))

        settings.beginGroup(groupName)
        self.clear()
        try:
            for key in settings.childKeys():
                if key.startswith('item'):
                    dct = ast.literal_eval(settings.value(key))
                    regItem = self._itemClass.createFromDict(dct)
                    self.registerItem(regItem)
        finally:
            settings.endGroup()
1144238
def read_examples(input_file):
    """"""
    examples = []
    unique_id = 0
    with open(input_file, "r", encoding='utf-8') as reader:
        while True:
            line = reader.readline()
            if not line:
                break
            line = line.strip()
            text_a = None
            text_b = None
            m = re.match(r"^(.*) \|\|\| (.*)$", line)
            if m is None:
                text_a = line
            else:
                text_a = m.group(1)
                text_b = m.group(2)
            examples.append(
                InputExample(unique_id=unique_id, text_a=text_a, text_b=text_b))
            unique_id += 1
    return examples