def main() : """ This function just performs dispatch on the command line that a user provided. Basically, look at the first argument, which specifies the function the user wants rPGA to perform, then dispatch to the appropriate module. """ parser = argparse.ArgumentParser(description='rPGA') parser.add_argument('command',nargs='*') parser.add_argument('-N',help="number of mismatches per read pair") parser.add_argument('-T',help="num threads for STAR alignment") parser.add_argument('-c',help='chromsome') parser.add_argument('--writeBam',help='flag to write allele specific bam files',action='store_true') # parser.add_argument('-p',help='multiprocessing flag',action='store_true') parser.add_argument('--gz',help='flag denoting gzipped reads',action='store_true') parser.add_argument('--conflict',help='flag to print conflicting reads',action='store_true') parser.add_argument('-M',help="max number of multiple alignments in STAR mapping") parser.add_argument('-e',help="file containing RNA editing positions, downloaded from RADAR") parser.add_argument('--rnaedit',help="flag to check for RNA editing events, must also provide an RNA editing file usng -e parameter",action="store_true") parser.add_argument('--printall',help="flag to print all non haplotype specific reads in bam file output",action='store_true') parser.add_argument('--consensus',help="flag to print consensus BAM file",action='store_true') parser.add_argument('-b1',help="haplotype 1 bam file") parser.add_argument('-b2',help="haplotype 2 bam file") parser.add_argument('-br',help="reference alignment bam file") parser.add_argument('-v',help="VCF genotype directory") parser.add_argument('-g',help="GTF annotation file") parser.add_argument('-o',help="output directory") parser.add_argument('-s',help="fastq read file(s), comma deliminated if paired end") parser.add_argument('-r',help="reference fasta file") parser.add_argument('--nmask',help="flag to N-mask reference genome and align to that",action="store_true") args = parser.parse_args() command = args.command if ((args.rnaedit and not args.e) or (args.e and not args.rnaedit)): sys.stderr.write("rPGA: if --rnaedit flag is used, you must also provide a file containing RNA editing locations using -e parameter \n") sys.exit() if (not args.o): sys.stderr.write("rPGA: -o outDir parameter is required\n") sys.exit() if len(command)==0: sys.stderr.write("rPGA: need a command - init, genomes, genotype, junctions, sequences, or run \n'" ) print helpStr # elif command[0]=="init": # init.main(command[1:]) # elif command[0] == "genomes" : # genomes.main(command[1:]) # elif command[0] == "genotype" : # genotype.main(command[1:]) # elif command[0] == "junctions" : # junctions.main(command[1:]) # elif command[0] == "sequences" : # seqs.main(command[1:]) elif command[0] == "run" : running.main(args) elif command[0] == "merge": merge.main(args) else : sys.stderr.write("rPGA: I don't recognise the option '" + command[0] +\ "'.\n")
def run(args): for mt in testModels4: import merge model = mt[0] test = mt[1] print(test) if len(mt) == 3: args.sequence_size = mt[2] args.test = test merge.main(args, model)
def main(): # Save option option = int(show_menu()) # Go through if option == 1: devmenu.main() elif option == 2: merge.main() elif option == 3: build.main() elif option == 4: setup.main() elif option == 5: quit()
def main(pChunkList): print "ChunkList:" for pChunk in pChunkList: print pChunk PrintHint("Begin Export Scene") raw_input("press enter to work...") lChunkInfo, lFlag = CreateFbx("terrain", pChunkList) PrintHint("Export Scene Finish") PrintHint("Begin Merge") raw_input("press enter to work...") merge.main(lChunkInfo, pChunkList[0], lFlag)
def main(options, args): # check directories exist for study in args: if not os.path.exists(study): print >> ERROR_FILE, 'Study cannot be found: ' + study sys.exit(2) study_id = os.path.basename(study) # go through each study, and rename files to the names accepted by merge script files_list = os.listdir(study) for file in files_list: if file in filenames_map: os.rename(study + '/' + file, study + '/' + filenames_map[file]) outputdir_files_to_rename[ study + '/' + filenames_map[file]] = study + '/' + file if file.startswith('data_cna_hg19.seg') or file.startswith( 'meta_cna_hg19_seg') or file.startswith( 'data_cna_hg18.seg') or file.startswith( 'meta_cna_hg18_seg'): os.rename(study + '/' + file, study + '/' + study_id + '_' + file) outputdir_files_to_rename[study + '/' + study_id + '_' + file] = study + '/' + file # call the main merge and subset script merge.main(options, args) # once the merge is complete, rename files back to their old names in input directories. for key in outputdir_files_to_rename: os.rename(key, outputdir_files_to_rename[key]) # update the file names in output directory to new naming patterns output_directory = options.outputdir output_studyid = options.studyid for file in os.listdir(output_directory): if file in filenames_map.values(): filename = get_key(file) os.rename(output_directory + '/' + file, output_directory + '/' + filename) if 'data_cna_hg19' in file or 'meta_cna_hg19_seg' in file or 'data_cna_hg18' in file or 'meta_cna_hg18_seg' in file: filename = file.replace(output_studyid + '_', '') os.rename(output_directory + '/' + file, output_directory + '/' + filename)
def main(): num = 1 m = int(raw_input("The number of demand:")) n = int(raw_input("The number of facility:")) hbar = int(raw_input("Quantity Limit H-bar:")) dbar = int(raw_input("Distance Matrix D-bar:")) fbar = int(raw_input("Fix Cost Limit F-bar:")) # run random to generate random nums generator.main(num, m, n, hbar, dbar, fbar) prelamda = np.array([100] * m) #init lamda while True: # split the random nums and generate j subdata files coor = split.main( prelamda) #three element: 1. demand_coor 2, supply_coor 3. hi # solve each submodel and save the ampl solution submod.main(n) # merge the sols returnitem = merge.main(m, n) #returnitem = [Xi,Yi,Z,subgrad]
os.system("rm -f label_prop_output.txt") if i == 1: os.system("junto config simple_config") else: os.system("touch dump") os.system("junto config simple_config > dump") print '+--- output for part', i, 'generated' #return to main STEP dir for next parts os.chdir("..") nope = (5, 10, 12, 18, 22, 24) # i is the iterator to run all parts print '+--- Initiate Graph Generation ---+\n' for i in range(1, 31): #part removed if i in nope: print '\npart', i, 'ignored\n' continue else: #use input for graph print '\nRunning part', i, '\n' graph.main(i) merge.main(i) print 'Part', i, 'graph generated\n' juntofy(i) time.sleep(0.5)
def main(): usage = "Usage: vcfPytools.py [tool] [options]\n\n" + \ "Available tools:\n" + \ " annotate:\n\tAnnotate the vcf file with membership in other vcf files.\n" + \ " extract:\n\tExtract vcf records from a region.\n" + \ " filter:\n\tFilter the vcf file.\n" + \ " indel:\n\tIndel manipulation tools.\n" + \ " intersect:\n\tGenerate the intersection of two vcf files.\n" + \ " merge:\n\tMerge a list of vcf files.\n" + \ " multi:\n\tFind the intersections and unique fractions of multiple vcf files.\n" + \ " sort:\n\tSort a vcf file.\n" + \ " stats:\n\tGenerate statistics from a vcf file.\n" + \ " union:\n\tGenerate the union of two vcf files.\n" + \ " unique:\n\tGenerate the unique fraction from two vcf files.\n" + \ " validate:\n\tValidate the input vcf file.\n\n" + \ "vcfPytools.py [tool] --help for information on a specific tool." # Determine the requested tool. if len(sys.argv) > 1: tool = sys.argv[1] else: print >> sys.stderr, usage exit(1) if tool == "annotate": import annotate success = annotate.main() elif tool == "extract": import extract success = extract.main() elif tool == "filter": import filter success = filter.main() elif tool == "intersect": import intersect success = intersect.main() elif tool == "indel": import indel success = indel.main() elif tool == "multi": import multi success = multi.main() elif tool == "merge": import merge success = merge.main() elif tool == "sort": import sort success = sort.main() elif tool == "stats": import stats success = stats.main() elif tool == "union": import union success = union.main() elif tool == "unique": import unique success = unique.main() elif tool == "test": import test success = test.main() elif tool == "validate": import validate success = validate.main() elif tool == "--help" or tool == "-h" or tool == "?": print >> sys.stderr, usage else: print >> sys.stderr, "Unknown tool: ", tool print >> sys.stderr, "\n", usage exit(1) # If program completed properly, terminate. if success == 0: exit(0)
'--sequence_size', type=int, help='size of the lstm sequence only works for LSTM and Merge', default=5) args = parser.parse_args() if args.FFNN == True: if args.run_test == True: import FFNNtest FFNNtest.run(args) else: import FFNN FFNN.main(args) elif args.LSTM == True: if args.run_test == True: import LSTMtest LSTMtest.run(args) else: import LSTM LSTM.main(args) elif args.MERGE == True: if args.run_test == True: import mergetest mergetest.run(args) else: import merge merge.main(args) else: print("Must select a type")
def merge_worker(): import merge merge.main()
def main(): usage = "Usage: vcfPytools.py [tool] [options]\n\n" + \ "Available tools:\n" + \ " annotate:\n\tAnnotate the vcf file with membership in other vcf files.\n" + \ " extract:\n\tExtract vcf records from a region.\n" + \ " filter:\n\tFilter the vcf file.\n" + \ " indel:\n\tIndel manipulation tools.\n" + \ " intersect:\n\tGenerate the intersection of two vcf files.\n" + \ " merge:\n\tMerge a list of vcf files.\n" + \ " multi:\n\tFind the intersections and unique fractions of multiple vcf files.\n" + \ " sort:\n\tSort a vcf file.\n" + \ " stats:\n\tGenerate statistics from a vcf file.\n" + \ " union:\n\tGenerate the union of two vcf files.\n" + \ " unique:\n\tGenerate the unique fraction from two vcf files.\n" + \ " validate:\n\tValidate the input vcf file.\n\n" + \ "vcfPytools.py [tool] --help for information on a specific tool." # Determine the requested tool. if len(sys.argv) > 1: tool = sys.argv[1] else: print >> sys.stderr, usage exit(1) if tool == "annotate": import annotate success = annotate.main() elif tool == "extract": import extract success = extract.main() elif tool == "filter": import filter success = filter.main() elif tool == "intersect": import intersect success = intersect.main() elif tool == "indel": import indel success = indel.main() elif tool == "multi": import multi success = multi.main() elif tool == "merge": import merge success = merge.main() elif tool == "sort": import sort success = sort.main() elif tool == "stats": import stats success = stats.main() elif tool == "union": import union success = union.main() elif tool == "unique": import unique success = unique.main() elif tool == "test": import test success = test.main() elif tool == "validate": import validate success = validate.main() elif tool == "--help" or tool == "-h" or tool == "?": print >> sys.stderr, usage else: print >> sys.stderr, "Unknown tool: ",tool print >> sys.stderr, "\n", usage exit(1) # If program completed properly, terminate. if success == 0: exit(0)