Ejemplo n.º 1
0
		def tier_real(args, joined_outfile, yaml_commands):
			#tiering is separate
			tiering_output_dirs = []
			
			# 1. candidate genes (user-specified target gene list)
			if(args.target_genes != None):
				args.target_genes = general_utils.root_or_cwd(args.target_genes)
				candidate_out_dir = os.path.join(args.output_dir, 'Candidate')
				if(not os.path.isdir(candidate_out_dir)):
					os.makedirs(candidate_out_dir)
				print 'Tiering candidate genes (user-specified)'
				tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=candidate_out_dir)
				tiering_output_dirs.append(candidate_out_dir)
			
			# 2. global
			global_tiering_out_dir = os.path.join(args.output_dir, 'Global')
			if(not os.path.isdir(global_tiering_out_dir)):
				os.makedirs(global_tiering_out_dir)
			args.target_genes = None # forces global tiering (no filtering based on a certain gene list)
			print 'Tiering all genes (Global)'
			tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=global_tiering_out_dir)
			tiering_output_dirs.append(global_tiering_out_dir)
			
			#3. other gene lists (specified in YAML)
			tiering_gene_lists = yaml_commands[yaml_keys.kModules][yaml_keys.kTiering][yaml_keys.kTTargetGeneLists]
			for tiering_gene_list in tiering_gene_lists:
				# ignore all "clinical" gene lists if we are suppressing incidental findings (e.g. for family members)
				if(args.suppress_incidentals and 'clinical' in tiering_gene_list.lower()):
					print 'Note: Skipping tiering for ' + str(tiering_gene_list) + ' to avoid incidental findings.'
					continue
				#else
				out_dir = os.path.join(args.output_dir, tiering_gene_list)
				if(not os.path.isdir(out_dir)):
					os.makedirs(out_dir)
				args.target_genes = yaml_utils.get_abs_path(tiering_gene_lists[tiering_gene_list])
				print 'Tiering ' + str(tiering_gene_list) + ' genes'
				tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=out_dir)
				tiering_output_dirs.append(out_dir)
			
			
			# Generate final output as excel workbook
			final_tiering_out_file_path = stmp_tiering_util.tiers2xls(tiering_output_dirs, args.output_dir, yaml_commands)
			print '**** Tiering output written to ' + str(final_tiering_out_file_path) + ' *****'
			return final_tiering_out_file_path
Ejemplo n.º 2
0
Archivo: stmp.py Proyecto: ysm0128/stmp
	def tier_real(args, joined_outfile, yaml_commands):
		#tiering is separate
		tiering_output_dirs = []
		
		# 1. candidate genes (user-specified target gene list)
		if(args.target_genes != None):
			args.target_genes = general_utils.root_or_cwd(args.target_genes)
			candidate_out_dir = os.path.join(args.output_dir, 'Candidate')
			if(not os.path.isdir(candidate_out_dir)):
				os.makedirs(candidate_out_dir)
			tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=candidate_out_dir)
			tiering_output_dirs.append(candidate_out_dir)
		
		# 2. global
		global_tiering_out_dir = os.path.join(args.output_dir, 'Global')
		if(not os.path.isdir(global_tiering_out_dir)):
			os.makedirs(global_tiering_out_dir)
		args.target_genes = None # forces global tiering (no filtering based on a certain gene list)
		tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=global_tiering_out_dir)
		tiering_output_dirs.append(global_tiering_out_dir)
		
		#3. other gene lists (specified in YAML)
		tiering_gene_lists = yaml_commands[yaml_keys.kModules][yaml_keys.kTiering][yaml_keys.kTTargetGeneLists]
		for tiering_gene_list in tiering_gene_lists:
			out_dir = os.path.join(args.output_dir, tiering_gene_list)
			if(not os.path.isdir(out_dir)):
				os.makedirs(out_dir)
			args.target_genes = yaml_utils.get_abs_path(tiering_gene_lists[tiering_gene_list])
			tier(args, joined_outfile, yaml_cmds=yaml_commands, output_dir=out_dir)
			tiering_output_dirs.append(out_dir)
		
		
		# Generate final output as excel workbook
		final_tiering_out_file_path = stmp_tiering_util.tiers2xls(tiering_output_dirs, args.output_dir)
		print '**** Tiering output written to ' + str(final_tiering_out_file_path) + ' *****'
		return final_tiering_out_file_path