def operate(cathcode,inputDirectory="/home/inab/databases/flat/pdb", workingDirectory="/home/inab/www/CATHdomain", host="okazaki.cnb.csic.es", user="******", passwd="R7xvgAKK", db="sflexfit", verbose=False):
    cATHfamilyLoader = CATHfamilyLoader(cathcode, host, user, passwd, db, workingDirectory)
    cATHfamilyLoader.getFamilyPDBS()
    cATHfamilyLoader.INB_downloadPDBfiles(inputDirectory, verbose=verbose)
    cATHfamilyLoader.INB_uncompressPDBFiles(inputDirectory, verbose=verbose)
    cATHfamilyLoader.extractDomains(verbose=verbose)
    compressedFileName = os.path.join(workingDirectory,cathcode)
    cATHfamilyLoader.compressResults(compressedFileName)
    logFileName = os.path.join(workingDirectory,cathcode+".log")
    #cATHfamilyLoader.deleteAll(logFileName, verbose)
    return os.path.join(workingDirectory,cathcode+".tgz")
def operate(cathcode, workingDirectory, host, user, passwd, db, verbose,tar,justTar):
    if verbose:
        print ("getting domains for %s superfamily"% (cathcode,))
    cATHfamilyLoader = CATHfamilyLoader(cathcode, host, user, passwd, db, workingDirectory)
    if verbose:
        print "getting information from DB"
    cATHfamilyLoader.getFamilyPDBS()
    if verbose:
        print "downloading pdb files"
    cATHfamilyLoader.downloadPDBfiles(verbose=verbose)
    if verbose:
        print "uncompressing pdb files"
    cATHfamilyLoader.uncompressPDBFiles(verbose=verbose)
    if verbose:
        print "extracting domains"
    cATHfamilyLoader.extractDomains(verbose=verbose)
    if verbose:
        print "generating domain list for mmult"
    cATHfamilyLoader.generateDomainList(verbose=verbose)
    #
    compressedFileName = path.join(workingDirectory,cathcode)
    #
    if tar:
        cATHfamilyLoader.compressResults(compressedFileName)
        logFileName = path.join(workingDirectory,cathcode+".log")
        if justTar:
             cATHfamilyLoader.deleteAll(logFileName, verbose=True)
        if verbose:
           print ("finished. You can find the resulting tgz at %s" % (path.join(workingDirectory,cathcode+".tgz"),))

    else:
        cATHfamilyLoader.deleteCompressedPDBS(verbose)
    
       
    if verbose and not tar:
        print ("finished. You can find the log file at %s" % (path.join(workingDirectory,cathcode+".log"),))