def _get_orthologs(self, limit):
    "\n        This will process each of the specified pairwise orthology files,\n        creating orthology associations based on the specified orthology code.\n        this currently assumes that each of the orthology files is identically\n        formatted. Relationships are made between genes here.\n\n        There is also a nominal amount of identifier re-formatting:\n        MGI:MGI --> MGI\n        Ensembl --> ENSEMBL\n\n        we skip any genes where we don't know how to map the gene identifiers.\n        For example, Gene:Huwe1 for RAT is not an identifier, so we skip any\n        mappings to this identifier.  Often, the there are two entries for the\n        same gene (base on equivalent Uniprot id), and so we are not actually\n        losing any information.\n\n        We presently have a hard-coded filter to select only orthology\n        relationships where one of the pair is in our species of interest\n        (Mouse and Human, for the moment).\n        This will be added as a configurable parameter in the future.\n\n        Genes are also added to a grouping class defined with a PANTHER id.\n\n        Triples:\n        <gene1_id> RO:othologous <gene2_id>\n        <assoc_id> :hasSubject <gene1_id>\n        <assoc_id> :hasObject <gene2_id>\n        <assoc_id> :hasPredicate <RO:orthologous>\n        <assoc_id> dc:evidence ECO:phylogenetic_evidence\n\n        <panther_id> a DATA:gene_family\n        <panther_id> RO:has_member <gene1_id>\n        <panther_id> RO:has_member <gene2_id>\n\n        :param limit:\n        :return:\n\n        "
    logger.info('getting orthologs')
    if self.testMode:
        g = self.testgraph
    else:
        g = self.graph
    model = Model(g)
    unprocessed_gene_ids = set()
    for k in self.files.keys():
        f = '/'.join((self.rawdir, self.files[k]['file']))
        matchcounter = 0
        mytar = tarfile.open(f, 'r:gz')
        fname = mytar.getmembers()[0]
        logger.info('Parsing %s', fname.name)
        line_counter = 0
        with mytar.extractfile(fname) as csvfile:
            for line in csvfile:
                if re.match('^#', line.decode()):
                    logger.info('Skipping header line')
                    continue
                line_counter += 1
                if ((line_counter % 1000000) == 0):
                    logger.info('Processed %d lines from %s', line_counter, fname.name)
                line = line.decode().strip()
                (a, b, orthology_class, ancestor_taxon, panther_id) = line.split('\t')
                (species_a, gene_a, protein_a) = a.split('|')
                (species_b, gene_b, protein_b) = b.split('|')
                if (self.testMode and (not ((re.sub('UniProtKB=', '', protein_a) in self.test_ids) or (re.sub('UniProtKB=', '', protein_b) in self.test_ids)))):
                    continue
                taxon_a = self._map_taxon_abbr_to_id(species_a)
                taxon_b = self._map_taxon_abbr_to_id(species_b)
                if ((self.tax_ids is not None) and (int(re.sub('NCBITaxon:', '', taxon_a.rstrip())) not in self.tax_ids) and (int(re.sub('NCBITaxon:', '', taxon_b.rstrip())) not in self.tax_ids)):
                    continue
                else:
                    matchcounter += 1
                    if ((limit is not None) and (matchcounter > limit)):
                        break
                gene_a = re.sub('=', ':', gene_a)
                gene_b = re.sub('=', ':', gene_b)
                clean_gene = self._clean_up_gene_id(gene_a, species_a)
                if (clean_gene is None):
                    unprocessed_gene_ids.add(gene_a)
                gene_a = clean_gene
                clean_gene = self._clean_up_gene_id(gene_b, species_b)
                if (clean_gene is None):
                    unprocessed_gene_ids.add(gene_b)
                gene_b = clean_gene
                if ((gene_a is None) or (gene_b is None)):
                    continue
                rel = self._map_orthology_code_to_RO(orthology_class)
                evidence_id = 'ECO:0000080'
                assoc = OrthologyAssoc(g, self.name, gene_a, gene_b, rel)
                assoc.add_evidence(evidence_id)
                model.addClassToGraph(gene_a, None)
                model.addClassToGraph(gene_b, None)
                g.addTriple(gene_a, model.object_properties['in_taxon'], taxon_a)
                g.addTriple(gene_b, model.object_properties['in_taxon'], taxon_b)
                assoc.add_association_to_graph()
                assoc.add_gene_family_to_graph(':'.join(('PANTHER', panther_id)))
                if ((not self.testMode) and (limit is not None) and (line_counter > limit)):
                    break
        logger.info('finished processing %s', f)
        logger.warning('The following gene ids were unable to be processed: %s', str(unprocessed_gene_ids))
    return
This will process each of the specified pairwise orthology files,
creating orthology associations based on the specified orthology code.
this currently assumes that each of the orthology files is identically
formatted. Relationships are made between genes here.

There is also a nominal amount of identifier re-formatting:
MGI:MGI --> MGI
Ensembl --> ENSEMBL

we skip any genes where we don't know how to map the gene identifiers.
For example, Gene:Huwe1 for RAT is not an identifier, so we skip any
mappings to this identifier.  Often, the there are two entries for the
same gene (base on equivalent Uniprot id), and so we are not actually
losing any information.

We presently have a hard-coded filter to select only orthology
relationships where one of the pair is in our species of interest
(Mouse and Human, for the moment).
This will be added as a configurable parameter in the future.

Genes are also added to a grouping class defined with a PANTHER id.

Triples:
<gene1_id> RO:othologous <gene2_id>
<assoc_id> :hasSubject <gene1_id>
<assoc_id> :hasObject <gene2_id>
<assoc_id> :hasPredicate <RO:orthologous>
<assoc_id> dc:evidence ECO:phylogenetic_evidence

<panther_id> a DATA:gene_family
<panther_id> RO:has_member <gene1_id>
<panther_id> RO:has_member <gene2_id>

:param limit:
:return:
def _get_orthologs(self, limit):
    "\n        This will process each of the specified pairwise orthology files,\n        creating orthology associations based on the specified orthology code.\n        this currently assumes that each of the orthology files is identically\n        formatted. Relationships are made between genes here.\n\n        There is also a nominal amount of identifier re-formatting:\n        MGI:MGI --> MGI\n        Ensembl --> ENSEMBL\n\n        we skip any genes where we don't know how to map the gene identifiers.\n        For example, Gene:Huwe1 for RAT is not an identifier, so we skip any\n        mappings to this identifier.  Often, the there are two entries for the\n        same gene (base on equivalent Uniprot id), and so we are not actually\n        losing any information.\n\n        We presently have a hard-coded filter to select only orthology\n        relationships where one of the pair is in our species of interest\n        (Mouse and Human, for the moment).\n        This will be added as a configurable parameter in the future.\n\n        Genes are also added to a grouping class defined with a PANTHER id.\n\n        Triples:\n        <gene1_id> RO:othologous <gene2_id>\n        <assoc_id> :hasSubject <gene1_id>\n        <assoc_id> :hasObject <gene2_id>\n        <assoc_id> :hasPredicate <RO:orthologous>\n        <assoc_id> dc:evidence ECO:phylogenetic_evidence\n\n        <panther_id> a DATA:gene_family\n        <panther_id> RO:has_member <gene1_id>\n        <panther_id> RO:has_member <gene2_id>\n\n        :param limit:\n        :return:\n\n        "
    logger.info('getting orthologs')
    if self.testMode:
        g = self.testgraph
    else:
        g = self.graph
    model = Model(g)
    unprocessed_gene_ids = set()
    for k in self.files.keys():
        f = '/'.join((self.rawdir, self.files[k]['file']))
        matchcounter = 0
        mytar = tarfile.open(f, 'r:gz')
        fname = mytar.getmembers()[0]
        logger.info('Parsing %s', fname.name)
        line_counter = 0
        with mytar.extractfile(fname) as csvfile:
            for line in csvfile:
                if re.match('^#', line.decode()):
                    logger.info('Skipping header line')
                    continue
                line_counter += 1
                if ((line_counter % 1000000) == 0):
                    logger.info('Processed %d lines from %s', line_counter, fname.name)
                line = line.decode().strip()
                (a, b, orthology_class, ancestor_taxon, panther_id) = line.split('\t')
                (species_a, gene_a, protein_a) = a.split('|')
                (species_b, gene_b, protein_b) = b.split('|')
                if (self.testMode and (not ((re.sub('UniProtKB=', , protein_a) in self.test_ids) or (re.sub('UniProtKB=', , protein_b) in self.test_ids)))):
                    continue
                taxon_a = self._map_taxon_abbr_to_id(species_a)
                taxon_b = self._map_taxon_abbr_to_id(species_b)
                if ((self.tax_ids is not None) and (int(re.sub('NCBITaxon:', , taxon_a.rstrip())) not in self.tax_ids) and (int(re.sub('NCBITaxon:', , taxon_b.rstrip())) not in self.tax_ids)):
                    continue
                else:
                    matchcounter += 1
                    if ((limit is not None) and (matchcounter > limit)):
                        break
                gene_a = re.sub('=', ':', gene_a)
                gene_b = re.sub('=', ':', gene_b)
                clean_gene = self._clean_up_gene_id(gene_a, species_a)
                if (clean_gene is None):
                    unprocessed_gene_ids.add(gene_a)
                gene_a = clean_gene
                clean_gene = self._clean_up_gene_id(gene_b, species_b)
                if (clean_gene is None):
                    unprocessed_gene_ids.add(gene_b)
                gene_b = clean_gene
                if ((gene_a is None) or (gene_b is None)):
                    continue
                rel = self._map_orthology_code_to_RO(orthology_class)
                evidence_id = 'ECO:0000080'
                assoc = OrthologyAssoc(g, self.name, gene_a, gene_b, rel)
                assoc.add_evidence(evidence_id)
                model.addClassToGraph(gene_a, None)
                model.addClassToGraph(gene_b, None)
                g.addTriple(gene_a, model.object_properties['in_taxon'], taxon_a)
                g.addTriple(gene_b, model.object_properties['in_taxon'], taxon_b)
                assoc.add_association_to_graph()
                assoc.add_gene_family_to_graph(':'.join(('PANTHER', panther_id)))
                if ((not self.testMode) and (limit is not None) and (line_counter > limit)):
                    break
        logger.info('finished processing %s', f)
        logger.warning('The following gene ids were unable to be processed: %s', str(unprocessed_gene_ids))
    return