-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of running the null model as the first step of assoc.py, it is now run in a separate script null_model.py. The output of the null model script is then used as input to assoc.py.
- Loading branch information
1 parent
7a2a7ff
commit a0da1df
Showing
30 changed files
with
192 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#! /usr/bin/env python2.7 | ||
|
||
"""Association tests""" | ||
|
||
import TopmedPipeline | ||
import sys | ||
import os | ||
import subprocess | ||
from time import localtime, strftime | ||
from argparse import ArgumentParser | ||
from copy import deepcopy | ||
from shutil import copyfile | ||
from datetime import datetime, timedelta | ||
|
||
description = """ | ||
Association tests | ||
""" | ||
|
||
default_segment_length = "10000" | ||
|
||
parser = ArgumentParser(description=description) | ||
parser.add_argument("config_file", help="configuration file") | ||
parser.add_argument("--cluster_type", default="UW_Cluster", | ||
help="type of compute cluster environment [default %(default)s]") | ||
parser.add_argument("--cluster_file", default=None, | ||
help="json file containing cluster options") | ||
parser.add_argument("-n", "--ncores", default="12", | ||
help="number of cores to use; either a number (e.g, 1) or a range of numbers (e.g., 1-4) [default %(default)s]") | ||
parser.add_argument("-e", "--email", default=None, | ||
help="email address for job reporting") | ||
parser.add_argument("--print_only", action="store_true", default=False, | ||
help="print qsub commands without submitting") | ||
parser.add_argument("--verbose", action="store_true", default=False, | ||
help="enable verbose output to help debug") | ||
parser.add_argument("--version", action="version", | ||
version="TopmedPipeline "+TopmedPipeline.__version__, | ||
help="show the version number and exit") | ||
args = parser.parse_args() | ||
|
||
configfile = args.config_file | ||
cluster_file = args.cluster_file | ||
cluster_type = args.cluster_type | ||
ncores = args.ncores | ||
email = args.email | ||
print_only = args.print_only | ||
verbose = args.verbose | ||
|
||
version = "--version " + TopmedPipeline.__version__ | ||
|
||
cluster = TopmedPipeline.ClusterFactory.createCluster(cluster_type, cluster_file, verbose) | ||
|
||
pipeline = cluster.getPipelinePath() | ||
driver = os.path.join(pipeline, "runRscript.sh") | ||
|
||
configdict = TopmedPipeline.readConfig(configfile) | ||
configdict = TopmedPipeline.directorySetup(configdict, subdirs=["config", "data", "log", "plots", "report"]) | ||
|
||
# analysis init | ||
cluster.analysisInit(print_only=print_only) | ||
|
||
# null model | ||
job = "null_model" | ||
|
||
rscript = os.path.join(pipeline, "R", job + ".R") | ||
|
||
config = deepcopy(configdict) | ||
config["out_file"] = configdict["data_prefix"] + "_null_model.RData" | ||
config["out_phenotype_file"] = configdict["data_prefix"] + "_phenotypes.RData" | ||
configfile = configdict["config_prefix"] + "_" + job + ".config" | ||
TopmedPipeline.writeConfig(config, configfile) | ||
|
||
submitID = cluster.submitJob(job_name=job, cmd=driver, args=[rscript, configfile, version], request_cores=ncores, email=email, print_only=print_only) | ||
|
||
|
||
# post analysis | ||
job = "post_analysis" | ||
jobpy = job + ".py" | ||
pcmd=os.path.join(pipeline, jobpy) | ||
argList = [pcmd, "-a", cluster.getAnalysisName(), "-l", cluster.getAnalysisLog(), | ||
"-s", cluster.getAnalysisStartSec()] | ||
pdriver=os.path.join(pipeline, "run_python.sh") | ||
cluster.submitJob(job_name=job, cmd=pdriver, args=argList, | ||
holdid=submitID, print_only=print_only) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
out_prefix "test" | ||
gds_file "testdata/1KG_phase3_subset_chr .gds" | ||
phenotype_file "testdata/1KG_phase3_subset_annot.RData" | ||
pcrelate_file "testdata/pcrelate_Matrix.RData" | ||
pca_file "testdata/pcair.RData" | ||
sample_include_file "testdata/sample_include.RData" | ||
null_model_file "testdata/null_model.RData" | ||
null_model_params "testdata/null_model.params" | ||
variant_include_file "testdata/variant_include_chr .RData" | ||
outcome outcome | ||
covars "sex Population" | ||
n_pcs 4 | ||
mac_threshold 3 | ||
genome_build "hg19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
out_prefix "test" | ||
gds_file "testdata/1KG_phase3_subset_chr .gds" | ||
phenotype_file "testdata/1KG_phase3_subset_annot.RData" | ||
pcrelate_file "testdata/pcrelate_Matrix.RData" | ||
pca_file "testdata/pcair.RData" | ||
sample_include_file "testdata/sample_include.RData" | ||
null_model_file "testdata/null_model.RData" | ||
null_model_params "testdata/null_model.params" | ||
variant_include_file "testdata/variant_include_chr .RData" | ||
outcome outcome | ||
covars "sex" | ||
n_pcs 4 | ||
maf_threshold 0.01 | ||
test_type "wald" | ||
genome_build "hg19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.