Linking articles to species-specific phenes.

        :param row:
        :return:
499430
def _process_article_phene_row(self, row):
        
        # article_id, phene_id, added_by
        # look up the article in the hashmap
        phenotype_id = self.id_hash['phene'].get(row['phene_id'])
        article_id = self.id_hash['article'].get(row['article_id'])

        omia_id = self._get_omia_id_from_phene_id(phenotype_id)
        if self.test_mode or omia_id not in self.test_ids['disease'] \
                or phenotype_id is None or article_id is None:
            return

        # make a triple, where the article is about the phenotype
        self.graph.addTriple(
            article_id,
            self.globaltt['is_about'], phenotype_id)

        return
249092
def queuedb_row_factory(cursor, row):
    
    d = {}
    for idx, col in enumerate(cursor.description):
        d[col[0]] = row[idx]

    return d
176413
def _inherited_row(row, base_rows_from_pillar, ret):
    ''''''
    base_rows = []
    for base_row_from_pillar in base_rows_from_pillar:
        base_row = __salt__['pillar.get'](base_row_from_pillar)
        if base_row:
            base_rows.append(base_row)
        elif base_row_from_pillar != _DEFAULT_ROW_PILLAR:
            ret.setdefault('warnings', [])
            warning_message = 'Cannot find row pillar "{0}".'.format(
                base_row_from_pillar)
            if warning_message not in ret['warnings']:
                ret['warnings'].append(warning_message)
    base_rows.append(row)

    result_row = {}
    for row in base_rows:
        result_row.update(row)
    return result_row
330026
def findAllByRow(self, target):
        
        row_matches = []
        for row_index in range(self._raster[0]):
            row = self.getRow(row_index)
            row_matches[row_index] = row.findAll(target)
        return row_matches
693022
def display_rows(self,
                     rows,
                     labels,
                     indent):

        ''''''

        out = []

        if not rows:
            return out

        first_row_type = type(rows[0])
        # all rows must have the same datatype
        consistent = True
        for row in rows[1:]:
            if type(row) != first_row_type:
                consistent = False

        if not consistent:
            return out

        if isinstance(labels, dict):
            labels_temp = []
            for key in sorted(labels):
                labels_temp.append(labels[key])
            labels = labels_temp

        if first_row_type is dict:  # and all the others
            temp_rows = []
            if not labels:
                labels = [six.text_type(label).replace('_', ' ').title() for label in sorted(rows[0])]
            for row in rows:
                temp_row = []
                for key in sorted(row):
                    temp_row.append(six.text_type(row[key]))
                temp_rows.append(temp_row)
            rows = temp_rows
        elif isinstance(rows[0], six.string_types):
            rows = [[row] for row in rows]  # encapsulate each row in a single-element list

        labels_and_rows = [labels] + rows if labels else rows
        has_header = self.has_header and labels

        return self.prepare_rows(labels_and_rows, indent + 4, has_header)
10960
def listing_row_to_object(row)
        l = Listing.new
        row.css('td').each_with_index do |td, i|

          txt = td.text.strip # yes, slightly slower to do this here, but I type less.

          case i
          when 4
            l.sku = txt
          when 5
            l.asin = txt
          when 6
            l.product_name = txt
          when 7
            l.created_at = parse_amazon_time(txt)
          when 8
            l.quantity = (inputs = td.css('input')).any? ? inputs.first['value'].to_i : txt.to_i
          when 10
            l.price = get_price(td)
          when 11
            l.condition = txt
          when 12
            l.low_price = get_low_price(td)
          when 3
            l.status = txt
          end
        end
        l
      end
8563
def get_topic_keyword_dictionary():
    
    topic_keyword_dictionary = dict()
    file_row_gen = get_file_row_generator(get_package_path() + "/twitter/res/topics/topic_keyword_mapping" + ".txt",
                                          ",",
                                          "utf-8")
    for file_row in file_row_gen:
        topic_keyword_dictionary[file_row[0]] = set([keyword for keyword in file_row[1:]])

    return topic_keyword_dictionary
836037
def _address_from_row(self, row):
        
        addr = None
        if "rpc_address" in row:
            addr = row.get("rpc_address")  # peers and local
        if "native_transport_address" in row:
            addr = row.get("native_transport_address")
        if not addr or addr in ["0.0.0.0", "::"]:
            addr = row.get("peer")

        return addr
602516
def ParseRow(header,
             row):
  
  precondition.AssertDictType(row, Text, Text)

  result = rdf_osquery.OsqueryRow()
  for column in header.columns:
    result.values.append(row[column.name])
  return result
50979
def resolved_row(objs, geomatcher):
    """"""
    def get_locations(lst):
        for elem in lst:
            try:
                yield elem['location']
            except TypeError:
                yield elem

    geomatcher['RoW'] = geomatcher.faces.difference(
        reduce(
            set.union,
            [geomatcher[obj] for obj in get_locations(objs)]
        )
    )
    yield geomatcher
    del geomatcher['RoW']
536562
def summarize_taxa(biom):
    
    tamtcounts = defaultdict(int)
    tot_seqs = 0.0

    for row, col, amt in biom['data']:
        tot_seqs += amt
        rtax = biom['rows'][row]['metadata']['taxonomy']
        for i, t in enumerate(rtax):
            t = t.strip()
            if i == len(rtax)-1 and len(t) > 3 and len(rtax[-1]) > 3:
                t = 's__'+rtax[i-1].strip().split('_')[-1]+'_'+t.split('_')[-1]
            tamtcounts[t] += amt

    lvlData = {lvl: levelData(tamtcounts, tot_seqs, lvl) for lvl in ['k', 'p', 'c', 'o', 'f', 'g', 's']}

    return tot_seqs, lvlData
1141040
def to_row(advice):
    ''''''
    return [
        advice.id,
        advice.administration,
        advice.type,
        advice.session.year,
        advice.session.strftime('%d/%m/%Y'),
        advice.subject,
        ', '.join(advice.topics),
        ', '.join(advice.tags),
        ', '.join(advice.meanings),
        ROMAN_NUMS.get(advice.part, ''),
        advice.content,
    ]
1082472
def channeldir_node_to_row(self, path_tuple):
        
        row = dict()
        for key in CONTENT_INFO_HEADER:
            row[key] = None
        row[CONTENT_PATH_KEY] = "/".join(path_tuple)  # use / in .csv on Windows and UNIX
        title = path_tuple[-1].replace('_', ' ')
        for ext in content_kinds.MAPPING.keys():
            if title.endswith(ext):
                title = title.replace('.'+ext, '')
        row[CONTENT_TITLE_KEY] = title
        row[CONTENT_SOURCEID_KEY] = path_tuple[-1]
        return row
915044
def parse_entry(self, row):
        
        var_call = VCFEntry(self.individuals)
        var_call.parse_entry(row)
        return var_call
850271
def _build_story(self, all_rows):
        
        # list to hold all stories
        all_stories = []

        for (info, detail) in all_rows:

            #-- Get the into about a story --#
            # split in 3 cells
            info_cells = info.findAll('td')

            rank = int(info_cells[0].string[:-1])
            title = '%s' % info_cells[2].find('a').string
            link = info_cells[2].find('a').get('href')

            # by default all stories are linking posts
            is_self = False

            # the link doesn't contains "http" meaning an internal link
            if link.find('item?id=') is -1:
                # slice " (abc.com) "
                domain = info_cells[2].findAll('span')[1].string[2:-1]
            else:
                link = '%s/%s' % (BASE_URL, link)
                domain = BASE_URL
                is_self = True
            #-- Get the into about a story --#

            #-- Get the detail about a story --#
            # split in 2 cells, we need only second
            detail_cell = detail.findAll('td')[1]
            # list of details we need, 5 count
            detail_concern = detail_cell.contents

            num_comments = -1

            if re.match(r'^(\d+)\spoint.*', detail_concern[0].string) is not \
                    None:
                # can be a link or self post
                points = int(re.match(r'^(\d+)\spoint.*', detail_concern[
                    0].string).groups()[0])
                submitter = '%s' % detail_concern[2].string
                submitter_profile = '%s/%s' % (BASE_URL, detail_concern[
                    2].get('href'))
                published_time = ' '.join(detail_concern[3].strip().split()[
                                          :3])
                comment_tag = detail_concern[4]
                story_id = int(re.match(r'.*=(\d+)', comment_tag.get(
                    'href')).groups()[0])
                comments_link = '%s/item?id=%d' % (BASE_URL, story_id)
                comment_count = re.match(r'(\d+)\s.*', comment_tag.string)
                try:
                    # regex matched, cast to int
                    num_comments = int(comment_count.groups()[0])
                except AttributeError:
                    # did not match, assign 0
                    num_comments = 0
            else:
                # this is a job post
                points = 0
                submitter = ''
                submitter_profile = ''
                published_time = '%s' % detail_concern[0]
                comment_tag = ''
                try:
                    story_id = int(re.match(r'.*=(\d+)', link).groups()[0])
                except AttributeError:
                    # job listing that points to external link
                    story_id = -1
                comments_link = ''
                comment_count = -1
            #-- Get the detail about a story --#

            story = Story(rank, story_id, title, link, domain, points,
                          submitter, published_time, submitter_profile,
                          num_comments, comments_link, is_self)

            all_stories.append(story)

        return all_stories
544133
def iter_rows(self):
        
        fileobj = self._fileobj
        cls_row = self.cls_row
        fields = self.fields

        for idx in range(self.prolog.records_count):
            data = fileobj.read(1)

            marker = struct.unpack('<1s', data)[0]
            is_deleted = marker == b'*'

            if is_deleted:
                continue

            row_values = []
            for field in fields:
                val = field.cast(fileobj.read(field.len))
                row_values.append(val)

            yield cls_row(*row_values)
1057694
function _fnRowAttributes( row )
	{
		var tr = row.nTr;
		var data = row._aData;
	
		if ( tr ) {
			if ( data.DT_RowId ) {
				tr.id = data.DT_RowId;
			}
	
			if ( data.DT_RowClass ) {
				// Remove any classes added by DT_RowClass before
				var a = data.DT_RowClass.split(' ');
				row.__rowc = row.__rowc ?
					_unique( row.__rowc.concat( a ) ) :
					a;
	
				$(tr)
					.removeClass( row.__rowc.join(' ') )
					.addClass( data.DT_RowClass );
			}
	
			if ( data.DT_RowData ) {
				$(tr).data( data.DT_RowData );
			}
		}
	}