コード例 #1
0
ファイル: processor.py プロジェクト: fdurupinar/indra
 def map_to_up_primary(ids):
     primary_ids = []
     for up_id in ids:
         if not uniprot_client.is_secondary(up_id):
             primary_ids.append(up_id)
             continue
         primary_id = uniprot_client.get_primary_id(up_id)
         primary_ids.append(primary_id)
     # If there are no primary IDs, we return None
     if not primary_ids:
         return None
     # Try to get primary IDs if there are
     # If there is more than one primary ID then we return the first one
     elif len(primary_ids) > 1:
         human_upids = [
             id for id in primary_ids if uniprot_client.is_human(id)
         ]
         if not human_upids:
             logger.info('More than one primary id but none human, '
                         'choosing the first: %s' %
                         ','.join(primary_ids))
             primary_id = primary_ids[0]
         elif len(human_upids) > 1:
             logger.info('More than one human primary id, choosing '
                         'the first: %s' % ','.join(human_upids))
             primary_id = human_upids[0]
         # Only one, so use it
         else:
             primary_id = human_upids[0]
     # One primary ID, so use it
     else:
         primary_id = primary_ids[0]
     # Make sure it's unicode
     return str(primary_id)
コード例 #2
0
ファイル: test_biopax.py プロジェクト: fdurupinar/indra
def test_all_uniprot_ids():
    for obj in bp.model.getObjects().toArray():
        bpe = bpc._cast_biopax_element(obj)
        if bpc._is_protein(bpe):
            uniprot_id = bp._get_uniprot_id(bpe)
            if uniprot_id is not None:
                assert (not uniprot_client.is_secondary(uniprot_id))
                assert (unicode_strs(uniprot_id))
コード例 #3
0
ファイル: test_biopax.py プロジェクト: jmuhlich/indra
def test_all_uniprot_ids():
    for obj in bp.model.getObjects().toArray():
        bpe = bpc._cast_biopax_element(obj)
        if bpc._is_protein(bpe):
            uniprot_id = bp._get_uniprot_id(bpe)
            if uniprot_id is not None:
                assert(not uniprot_client.is_secondary(uniprot_id))
                assert(unicode_strs(uniprot_id))
コード例 #4
0
ファイル: processor.py プロジェクト: jmuhlich/indra
 def map_to_up_primary(ids):
     primary_ids = []
     for up_id in ids:
         if not uniprot_client.is_secondary(up_id):
             primary_ids.append(up_id)
             continue
         primary_id = uniprot_client.get_primary_id(up_id)
         primary_ids.append(primary_id)
     # If there are no primary IDs, we return None
     if not primary_ids:
         return None
     # Try to get primary IDs if there are 
     # If there is more than one primary ID then we return the first one
     if len(primary_ids) > 1:
         logger.info('More than one primary id: %s' %
                     ','.join(primary_ids))
     # Make sure it's unicode
     primary_id = str(primary_ids[0])
     return primary_id
コード例 #5
0
def test_is_secondary_secondary():
    assert uniprot_client.is_secondary('Q96J62')
コード例 #6
0
def test_is_secondary_primary():
    assert not uniprot_client.is_secondary('Q02750')
コード例 #7
0
def test_is_secondary_secondary():
    assert uniprot_client.is_secondary('Q96J62')
コード例 #8
0
def test_is_secondary_primary():
    assert not uniprot_client.is_secondary('Q02750')