Пример #1
0
		if not result["pvalue"] == "NA":
			p = float(result["pvalue"])
			eqtls[snpId][geneSymbol]["tissues"][result["tissueId"]] = {"pvalue": p}
	
	print "Writing to eQTL file..."
	if os.path.isfile(input_dir + "/eqtls.txt"):
		upsert = raw_input("Appending output to existing eQTL file (%s). Continue? [y/N] " % input_dir + "/eqtls.txt")
		if not upsert.lower() == 'y':
			print "Did not write to existing SNP database."
			return
	with open(input_dir + "/eqtls.txt",'a') as eqtlfile:
		for snp in eqtls.keys():
			for gene in eqtls[snp].keys():
				if not gene == "snp_info":
					for tissue in eqtls[snp][gene]["tissues"].keys():
						eqtlfile.write("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % (snp,eqtls[snp]["snp_info"]["chr"],eqtls[snp]["snp_info"]["locus"],gene,eqtls[snp][gene]["gene_chr"],eqtls[snp][gene]["gene_start"],eqtls[snp][gene]["gene_end"],eqtls[snp][gene]["cell_lines"],eqtls[snp][gene]["cis?"],eqtls[snp][gene]["p_thresh"],tissue,eqtls[snp][gene]["tissues"][tissue]["pvalue"]))

if __name__ == "__main__":
	parser = argparse.ArgumentParser(description="Tool for re-sending failed GTEx requests, and optionally appending the results to an existing eQTLs file.")
	parser.add_argument("-i","--input_dir",required=True,help="The output directory from the CoDeS3D run containing failed_requests.")
	parser.add_argument("-c","--config",default="docs/conf.py",help="The configuration file to be used in this instance (default: conf.py)")
	parser.add_argument("-p","--num_processes",type=int,default=1,help="Desired number of processes for multiprocessing (default: 1).")
	args = parser.parse_args()
	config = configparser.ConfigParser()
	config.read(args.config)
	gene_database_fp = config.get("Defaults","GENE_DATABASE_FP")
	reqLists = parse_failed_requests(args.input_dir + "/failed_GTEx_requests.txt")
	snps = codes3d.parse_snps_files(args.input_dir + "/snps.txt")
	genes = codes3d.parse_genes_files(args.input_dir + "/genes.txt")
	get_GTEx_responses(reqLists,snps,genes,gene_database_fp,args.num_processes,args.input_dir)
Пример #2
0
        nargs='+',
        help=
        "Space-separated list of cell lines to include (others will be ignored). NOTE: Mutually exclusive with EXCLUDE_CELL_LINES."
    )
    parser.add_argument(
        "-x",
        "--exclude_cell_lines",
        nargs='+',
        help=
        "Space-separated list of cell lines to exclude (others will be included). NOTE: Mutually exclusive with INCLUDE_CELL_LINES."
    )
    parser.add_argument(
        "-o",
        "--output_dir",
        default="hiCquery_output",
        help=
        "The directory in which to output results (\"hiCquery_output\" by default)."
    )
    args = parser.parse_args()
    config = configparser.ConfigParser()
    config.read(args.config)
    hic_data_dir = config.get("Defaults", "HIC_DATA_DIR")
    if not os.path.isdir(args.output_dir):
        os.makedirs(args.output_dir)

    snps = codes3d.parse_snps_files(args.snps_files)
    interactions = codes3d.find_interactions(snps, hic_data_dir,
                                             args.include_cell_lines,
                                             args.exclude_cell_lines,
                                             args.output_dir)
Пример #3
0
     type=int,
     default=1,
     help="Desired number of processes for multiprocessing (default: 1).")
 parser.add_argument(
     "-f",
     "--fdr_threshold",
     type=float,
     default=0.05,
     help=
     "The FDR threshold to consider an eQTL statistically significant (default: 0.05)."
 )
 parser.add_argument(
     "-o",
     "--output_dir",
     default="hiCquery_output",
     help=
     "The directory in which to output results (\"hiCquery_output\" by default)."
 )
 args = parser.parse_args()
 config = configparser.ConfigParser()
 config.read(args.config)
 eqtl_data_dir = config.get("Defaults", "EQTL_DATA_DIR")
 gene_database_fp = config.get("Defaults", "GENE_DATABASE_FP")
 if not os.path.isdir(args.output_dir):
     os.makedirs(args.output_dir)
 snps = codes3d.parse_snps_files([args.snps_file])
 genes = codes3d.parse_genes_files([args.genes_file])
 eqtls, num_sig = codes3d.find_eqtls(snps, genes, eqtl_data_dir,
                                     gene_database_fp, args.fdr_threshold,
                                     args.local_databases_only,
                                     args.num_processes, args.output_dir)