## Test si min < Max #if nbRepiParam >= nbRepmParam: #print("ERROR: nbRepiParam > nbRepmParam") #exit() ## Test si min < Max #if nbpopiParam >= nbpopmParam: #print("ERROR: nbpopiParam > nbpopmParam") #exit() # Test si les sous répertoires existent déjà exist = 0 for rep in range(nbRepiParam, nbRepmParam + 1): # boucle sur le nombre de répétition if os.path.exists(workingDir + "/repetition_" + str(rep)): printCol.yellow("Warning , folder " + workingDir + "/repetition_" + str(rep) + " already exist !!!!") exist = 1 if exist == 1: printCol.yellow("Do you want to remove all analysis? (y/n)\n(" + outputSHDir + " and /trash will be remove if yes)") inp = None while inp == None or inp not in ["y", "n", "yes", "no"]: inp = input() if inp in ["y", "yes"]: os.popen('rm -r ' + workingDir + "/repetition_" + str(rep)) exist = 0 if os.path.exists(outputSHDir): os.popen('rm -r ' + outputSHDir) if os.path.exists(outputTrashDir): os.popen('rm -r ' + outputTrashDir) elif inp in ["n", "no"]:
str(rep) + "/population_" + str(pop) + "/" + filename) os.rename( workingObjDir.pathDirectory + "/repetition_" + str(rep) + "/population_" + str(pop) + "/" + filename + 'tmp', workingObjDir.pathDirectory + "/repetition_" + str(rep) + "/population_" + str(pop) + "/" + filename) print("Number of file reorder: %s\n" % count) # Si tous va bien les fichiers sont Ok # zip du répertoire nameZip = str(workingObjDir.pathDirectory).split("/")[-2] zipFile = workingObjDir.pathDirectory + nameZip + ".zip" if os.path.exists(zipFile): printCol.yellow( "\nWARNNING struc2runClumpak : path '%s' already contain file %s\nIt will be remove and rebuild\n" % (workingObjDir.pathDirectory, zipFile)) os.remove(zipFile) cmd = "cd " + workingObjDir.pathDirectory + ";zip -r " + zipFile + " repetition_*" print( "Zip directory repetition into %s with file name: %s.zip with command:\n\t%s\n" % (workingObjDir.pathDirectory, zipFile, cmd)) stream = check_output(cmd, shell=True).decode("utf-8") ## build label files print("Build label files into %s" % workingObjDir.pathDirectory) labelFile, labelAtopFile, orderlist = buildLabelFile( labelFileParam, workingObjDir.pathDirectory) # copy labelAtop into CLUMPAK/distruct cmd = "cp " + labelAtopFile + " " + clumpakObjDir.pathDirectory + "/distruct/labelsAtop"
print(" - Intput Info:") print("\t - Working in directory: %s" % pathFileOut.pathDirectory) print("\t - Fasta were in directory: %s" % pathFastaFile.pathDirectory) print("\t - Number of threads: %s" % nbThreads) print("\t - Number of nbBootstrap: %s" % nbBootstrap) print("\t - Other options are: %s" % raxmlOptionValue) print(" - Output Info:") print("\t - Output with result raxml were in directory: %s" % outputraxmlResDir) print("\t - Output sh were in directory: %s" % outputSHDir) print("\t - Output trash were in directory: %s\n\n" % outputTrashDir) # build directory out if os.path.exists(outputraxmlResDir): printCol.yellow(" Warning , folder %s already exist !!!!" % outputraxmlResDir ) exist=1 if exist == 1: printCol.yellow(" Do you want to remove all analysis? (y/n)\n ("+outputSHDir+" and "+outputTrashDir+" will be remove if yes)") inp = None while inp == None and inp != "y" and inp != "n" and inp != "yes" and inp != "no": inp = input() if inp == "y": #os.popen('rm -rf '+outputraxmlResDir+" && mkdir "+outputraxmlResDir) #os.popen('rm -rf '+outputSHDir+" && mkdir "+outputSHDir) #os.popen('rm -rf '+outputTrashDir+" && mkdir "+outputTrashDir) shutil.rmtree(outputraxmlResDir) shutil.rmtree(outputSHDir) shutil.rmtree(outputTrashDir) if not os.path.exists(outputraxmlResDir):
print("\t - Suffix is: %s" % args.suffixParam) print("\t - Ref strain is : %s" % ref) print("\t - Working directory is: %s" % workingDir) print("\t - Corresonding CDS ref/strain directory is: %s\n\n" % correspondingCDSDir) # liste de toute les souches de proteineOrtho listSouches = [] # dico de proteine orthologue dico_ortho = {} exist = 0 # creer le répertoire contenant les correspondance entre ref et souches if os.path.exists(correspondingCDSDir): printCol.yellow(" Warning , folder " + correspondingCDSDir + " already exist !!!!") exist = 1 else: os.makedirs(correspondingCDSDir) if exist == 1: printCol.yellow(" Do you want to remove all analysis? (y/n)\n") inp = None while inp == None and inp != "y" and inp != "n" and inp != "yes" and inp != "no": inp = input() if inp == "y": os.popen('rm -r ' + correspondingCDSDir + '; mkdir ' + correspondingCDSDir) exist = 0 elif inp == "n": printCol.red(">>>Program exit\n")