# modifie mainarams pour adapter au numero de section , nsection et paths dictToReplace = { "**POP**": str(pop), "**nIndiv**": str(nbIndivParam), "**nLoci**": str(nbMarkerParam), "**FILEIN**": str(inputFile), "**FILEOUT**": outputFile + "_K" + str(pop) + "_run" + str(rep) + ".txt" } mainparamsr = replace_all(dictToReplace, mainparams) #mainparamsr = mainparams.replace("**POP**",str(pop)).replace("**FILEIN**",str(inputFile)).replace("**FILEOUT**",outputFile+"_K"+str(pop)+"_run"+str(rep)+".txt") # modifie mainparams pour adapter au K mainparamsOut.write(mainparamsr) # Ecrit le mainparams mainparamsOut.close() extraparamsOut.close() # écriture des scripts pour lancer les annalyses shOut = open(outputSHDir + "/" + str(count) + "_structure.sh", "w") shOut.write("module load bioinfo/structure/2.3.4\n") shOut.write("cd " + workingDir + "/repetition_" + str(rep) + "/population_" + str(pop) + "/\n") randomInt = random.randint(1, 60) shOut.write("sleep %s\n" % randomInt) shOut.write("structure") shOut.close() count += 1
# Récupère le fichier de conf passer en argument workingObjDir = args.dirPath replaceParam = args.replaceParam print("Workink Directory: %s" % workingObjDir.pathDirectory) dicoReplace = {} for value in replaceParam.split(","): old, new = value.split(":") dicoReplace[old] = new for fileIn in sorted(workingObjDir.listFiles, key=sort_human): basename = fileIn.split("/")[-1].split(".")[0] extention = "." + ".".join(fileIn.split("/")[-1].split(".")[1:]) newName = replace_all(dicoReplace, basename) if not args.debug: print("basename", basename) print("extention", extention) print("rename file:", basename + extention, "\tto\t", newName + extention, "\n\n") if args.debug: os.rename(fileIn, workingObjDir.pathDirectory + newName + extention) print("\nStop time: ", strftime("%d-%m-%Y_%H:%M:%S", localtime())) print("#################################################################") print("# End of execution #") print("#################################################################")
print("############ loop " + str(count) + " ############") if args.debug: print(">>> FILEIN: " + fileName) if args.debug: print(">>> BASENAMEOUT: " + outputResDir + "/" + basenameFile) dictToReplace.update({ "FILEIN": str(fileName), "BASENAMEOUT": str(outputResDir + "/" + basenameFile), }) with open(outputSHDir + str(count) + "_script.sh", "w") as shScriptOut: # not change value here shtxtReplace = replace_all(dictToReplace, shtxt) shScriptOut.write(shtxtReplace) if args.debug: print(">>> base Script with modifications: \n") if args.debug: print(shtxtReplace) count += 1 # Not change anythings for headerSGE headerSGE = """ #!/bin/bash #$ -N SEB_buildJobArray #$ -cwd #$ -V #$ -e """ + outputTrashDir + """ #$ -o """ + outputTrashDir + """