Пример #1
0
 def _get_goids_all(self, go_sources):
     """Given GO ID sources and optionally the relationship attribute, return all GO IDs."""
     go2obj_user = {}
     objrel = CurNHigher(self.relationships, self.godag)
     objrel.get_go2obj_cur_n_high(go2obj_user, go_sources)
     goids = set(go2obj_user)
     for goterm in go2obj_user.values():
         if goterm.alt_ids:
             goids.update(goterm.alt_ids)
     return goids
Пример #2
0
 def _get_goids_all(self, go_sources):
     """Given GO ID sources and optionally the relationship attribute, return all GO IDs."""
     go2obj_user = {}
     objrel = CurNHigher(self.relationships, self.godag)
     objrel.get_id2obj_cur_n_high(go2obj_user, go_sources)
     goids = set(go2obj_user)
     for goterm in go2obj_user.values():
         if goterm.alt_ids:
             goids.update(goterm.alt_ids)
     return goids
Пример #3
0
 def _init_gos(self, go_sources_arg, relationships_arg):
     """Initialize GO sources."""
     # No GO sources provided
     if not go_sources_arg:
         assert self.go2obj_orig, "go2obj MUST BE PRESENT IF go_sources IS NOT"
         self.go_sources = set(self.go2obj_orig)
         self.go2obj = self.go2obj_orig
         sys.stdout.write("**NOTE: {N:,} SOURCE GO IDS\n".format(N=len(self.go_sources)))
         return
     # GO sources provided
     go_sources = self._init_go_sources(go_sources_arg, self.go2obj_orig)
     # Create new go2obj_user subset matching GO sources
     # Fill with source and parent GO IDs and alternate GO IDs
     go2obj_user = {}
     objrel = CurNHigher(relationships_arg, self.go2obj_orig)
     objrel.get_go2obj_cur_n_high(go2obj_user, go_sources)
     # Add additional GOTerm information, if needed for user task
     kws_gos = {k:v for k, v in self.kws.items() if k in self.kws_aux_gos}
     if kws_gos:
         self._add_goterms_kws(go2obj_user, kws_gos)
     self.go_sources = go_sources
     self.go2obj = go2obj_user