Пример #1
0
 def load(cls, treefile, schema=None):
     if not os.path.isfile(treefile):
         print 'No tree file found.'
         return None
     try: return dp.Tree.get(path=treefile, schema=cls.schema(treefile, schema))
     except Exception, e:
         print 'Error while loading %s:\n%s' % (treefile, estr(e))
         return None
Пример #2
0
 def blast(cls, command, **kwargs):
     '''Generic wrapper for blast commandline programs'''
     results_file = kwargs.pop('save_results_to', None)
     parse_results = kwargs.pop('parse_results', False)
     if results_file: bout = results_file
     else:
         parse_results = True
         bout = mktmp_name('.xml')
     try:
         cline = cls._clines[command]
         cmd = cline(outfmt=5, out=bout, **kwargs)
         out, err = cmd()
         if err:
             print ('\nError message from %s:\n%s\n%s\n%s'
                    % (command, cmd, out, err))
         if parse_results:
             with open(bout) as inp:
                 results = list(NCBIXML.parse(inp))
             return results
     except Exception, e:
         print '\nError while performing local %s:\n%s' % (command, estr(e))
         return None
Пример #3
0
def aborted(abort_event):
    try: return abort_event.is_set()
    except IOError, e:
        print 'IOError while accessing abort Event:\n%s' % estr(e)#test 
        return True