Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cms/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def execute_ucsc_viz(args):
assert os.path.isfile(chromfile)
infile = open(chromfile, 'r')
if args.strip_header:
print("test")
infile.readline()
for line in infile:
entries = line.strip('\n').split()
Expand Down
10 changes: 6 additions & 4 deletions cms/dists/scores_func.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## helper functions for generating probability distributions for component scores as part of CMS 2.0.
## last updated: 09.10.16 vitti@broadinstitute.org
## last updated: 09.15.16 vitti@broadinstitute.org

from math import fabs, sqrt
from random import randint
Expand All @@ -14,7 +14,8 @@
def calc_ihs(inputTped, outputFile, runProgram = "scans.py", numThreads = 7):
'''from func_clean.py'''
cmdStr = "python " + runProgram + " selscan_ihs " + inputTped + " " + outputFile + " --threads " + str(numThreads)
print(cmdStr)
#print(cmdStr)
subprocess.check_call( cmdStr.split() )
return
def calc_delihh(readfilename, writefilename):
"""given a selscan iHS file, parses it and writes an analogous file with delIHH information"""
Expand All @@ -32,15 +33,16 @@ def calc_delihh(readfilename, writefilename):
def calc_xpehh(inputTped, inputTped2, outputFile, runProgram = "scans.py", numThreads = 7):
'''from func_clean.py'''
cmdStr = "python " + runProgram + " selscan_xpehh " + inputTped + " " + outputFile + " " + inputTped2 + " --threads " + str(numThreads)
print(cmdStr)
#print(cmdStr)
subprocess.check_call( cmdStr.split() )
return
def calc_fst_deldaf(inputTped, inputTped2, recomFile, outputFile, modelpath):
if modelpath[-1] != "/":
modelpath += "/"
commandstring = modelpath + "calc_fst_deldaf"
argstring = inputTped + " " + inputTped2 + " " + recomFile + " " + outputFile
fullcommand = commandstring + " " + argstring
print(fullcommand)
#print(fullcommand)
subprocess.check_call( fullcommand.split() )
return
def read_neut_normfile(neutNormfilename, scoretype ='ihs'):
Expand Down
9 changes: 3 additions & 6 deletions cms/likes_from_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
## top-level script for generating probability distributions for component scores as part of CMS 2.0.
## last updated: 09.13.16 vitti@broadinstitute.org
## last updated: 09.16.16 vitti@broadinstitute.org

from dists.likes_func import get_old_likes, read_likes_file, plot_likes, get_hist_bins
from dists.freqbins_func import get_bin_strings, get_bins, check_bin_filled, check_make_dir, write_bin_paramfile
Expand Down Expand Up @@ -39,7 +39,7 @@ def full_parser_likes_from_model():
for snakemake_parser in [get_sel_trajs_parser, run_sel_sims_parser]:
snakemake_parser.add_argument('--cluster', action='store', help='if included: dispatch Snakemake to cluster to parallelize generation of replicates using supplied argument (e.g. qsub, sbatch)')
snakemake_parser.add_argument('--jobs', action='store', help='use at most this many cores in parallel')
snakemake_parser.add_argument('n', action='store', type=int, help='num replicates to run') #figure out where to store
snakemake_parser.add_argument('n', action='store', type=int, help='num replicates to run')

##########################
### COSI - SHARED ARGS ##
Expand Down Expand Up @@ -116,7 +116,7 @@ def execute_run_neut_sims(args):
neutRunDir = args.outputDir
if args.outputDir[-1] != "/":
neutRunDir += "/"
neutRunDir += "run_neut_sims"
neutRunDir += "neut_sims"
runDir = check_make_dir(neutRunDir)
runDir += "/"
print("running " + str(args.n) + " neutral simulates from model: " + args.inputParamFile)
Expand All @@ -127,7 +127,6 @@ def execute_run_neut_sims(args):
if args.dropSings is not None:
neutSimCommand += " --drop-singletons " + str(args.dropSings)
neutSimCommand += " -n " + str(args.n) + " --tped " + runDir + "rep"

if args.printOnly:
print(neutSimCommand)
else:
Expand Down Expand Up @@ -350,8 +349,6 @@ def execute_visualize_likes(args):
# if called with no arguments, print help
if len(sys.argv)==1:
runparser.parse_args(['--help'])
elif len(sys.argv)==2:
runparser.parse_args([sys.argv[1], '--help'])

subcommand = sys.argv[1]
function_name = 'execute_' + subcommand + "(args)"
Expand Down
2 changes: 1 addition & 1 deletion cms/model/calc_fst_deldaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "skipped on: %d\n", nSkip);
//fprintf(stderr, "fst_sum: %f\n", fst_sum);
//fprintf(stderr, "nfst: %d\n", nfst);
fprintf(outf, "chrom ave Fst: %.8f\n", (fst_sum/nfst));
fprintf(stderr, "chrom ave Fst: %.8f\n", (fst_sum/nfst));
return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions cms/run_traj.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
## relaunches cosi command until a selection trajectory is created successully (i.e., resampling selection coefficients/sweep start times from specified distributions)
## last updated: 08.15.16 vitti@broadinstitute.org; phasing this out (redundant with Snakemake -- OR NOT?? needs drrma?)

## last updated: 08.15.16 vitti@broadinstitute.org
import sys
import subprocess

Expand Down
2 changes: 1 addition & 1 deletion cms/scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def main_selscan_ihs(args):
metaData["ihs"] = args.outFile+".ihs.out"
metaData["ihs_log"] = args.outFile+".ihs.log"
jsonFilePath = os.path.abspath(args.inputTped).replace(".tped.gz",".metadata.json")
util.json_helpers.JSONHelper.annotate_json_file(jsonFilePath, metaData)
#util.json_helpers.JSONHelper.annotate_json_file(jsonFilePath, metaData)

return 0
__commands__.append(('selscan_ihs', parser_selscan_ihs))
Expand Down