Skip to content

Commit

Permalink
small fixes to several modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyhey committed Feb 20, 2021
1 parent eaa17bd commit 336e3d3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
10 changes: 6 additions & 4 deletions pgpipe/vcf_bed_to_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ def get_model_sequences_from_region(vcf=None,popmodel=None,

if called_from_run or out != None: #write/append sequences to a file
if out == None:
out = os.path.dirname(vcffile) + "//ppp_vcf_to_sequences.out"
assert not isinstance(vcf,vf.VcfReader) # vcf should be a file
out = os.path.dirname(vcf) + "//ppp_vcf_to_sequences.out"
if called_from_run == False and os.path.exists(out):
f = open(out,'a')
else:
Expand Down Expand Up @@ -403,10 +404,10 @@ def get_model_sequences(vcf=None,model_file = None,modelname=None,
if popmodel and (model_file or modelname):
raise Exception("must specify _either_ popmodel or both model_file and modelname")
if xor(model_file,modelname):
raise Eception("both model_file and modelname must be given, unless popmodel is being used")
raise Exception("both model_file and modelname must be given, unless popmodel is being used")
if not popmodel:
popmodels = read_model_file(model_file)
popmodel = popmodels[model]
popmodel = popmodels[modelname]
# make an instance of VcfReader
vcf_reader = vf.VcfReader(vcf,popmodel=popmodel)
with open(BED_filename,'r') as bf:
Expand Down Expand Up @@ -495,7 +496,8 @@ def run (**kwargs):
if __name__ == "__main__":
initLogger()
run(**parser())
exit()
sys.exit()
# clumsy way of passing arguments for debugging, for use with idle
debugargs = ['--vcf','..//jhtests//pan_example.vcf.gz','--fasta-reference',
"..//jhtests//pan_example_ref.fa",
'--model-file',"..//jhtests//panmodels.model",'--modelname',"4Pop",
Expand Down
5 changes: 3 additions & 2 deletions pgpipe/vcf_to_dadi.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ def run (**kwargs):
if __name__ == "__main__":
initLogger()
run(**dadisnp_parser())
exit()


sys.exit()
# clumsy way of passing arguments for debugging, for use with idle
debugargs = ['--vcf','..//jhtests//pan_example.vcf.gz','--model-file',
"..//jhtests//panmodels.model",
'--modelname',"4Pop",'--out','../jhtests/results/vcf_dadisnp_bedfile_test.out',
Expand Down
3 changes: 2 additions & 1 deletion pgpipe/vcf_to_fastsimcoal.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ def run (**kwargs):
if __name__ == "__main__":
initLogger()
run(**fscmsfs_parser)
exit()
sys.exit()
# clumsy way of passing arguments for debugging, for use with idle
debugargs=['--vcf',"..//jhtests//pan_example.vcf.gz",
'--model-file',"..//jhtests//panmodels.model",'--modelname','3Pop',
'--dim','1','2','m','--basename','../jhtests/results/vcf_fsc1']#,'--folded']
Expand Down
1 change: 1 addition & 0 deletions pgpipe/vcf_to_gphocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def run (**kwargs):
sys.exit()
# test using a vcf file
debugargs = """--vcf //home//jodyhey//temp//PPP//tests//input//pan_example.vcf.gz --reference //home//jodyhey//temp//PPP//tests//input//pan_example_ref.fa --model-file //home//jodyhey//temp//PPP//tests//input//panmodels.model --modelname 4Pop --bed-file //home//jodyhey//temp//PPP//tests//input//pan_example_regions.bed --out ..//jhtests//results//vcf_gphocs_test.out """
# clumsy way of passing arguments for debugging, for use with idle
# debugargs = ['--vcf','//home//jodyhey//temp//PPP//tests//input//pan_example.vcf.gz',
# '--reference',"//home//jodyhey//temp//PPP//tests//input//pan_example_ref.fa",
# '--model-file',"//home//jodyhey//temp//PPP//tests//input//panmodels.model",
Expand Down
6 changes: 3 additions & 3 deletions pgpipe/vcf_to_sfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,9 @@ def run (**kwargs):

if __name__ == "__main__":
initLogger()
run(**sfs_parcer())
exit()

run(**sfs_parser())
sys.exit()
# clumsy way of passing arguments for debugging, for use with idle
debugargs=['--vcf',"..//jhtests//pan_example2.vcf.gz",
'--model-file',"..//jhtests//panmodels.model",'--modelname','4Pop',
'--downsamplesizes','3','3','3','4',
Expand Down
8 changes: 5 additions & 3 deletions pgpipe/vcf_to_treemix.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@


import os
import sys
import logging
import argparse
import subprocess
Expand Down Expand Up @@ -309,17 +310,18 @@ def run (**kwargs):
if __name__ == "__main__":
initLogger()
run(**treemix_parser())
exit()
sys.exit()
# clumsy way of passing arguments for debugging, for use with idle
debugargs = ['--vcf','../jhtests/pan_example.vcf.gz','--model-file',
"../jhtests/panmodels.model",'--modelname',"4Pop",
'--out','../jhtests/results/vcf_treemixtest1','--bed-file',"../jhtests/pan_example_regions.bed",'--kblock','1000']
run(**debugargs)
exit()
sys.exit()
debugargs = ['--vcf','../jhtests/pan_example.vcf.gz','--model-file',
"../jhtests/panmodels.model",'--modelname',"4Pop",
'--out','../jhtests/results/vcf_treemixtest2']
run(debugargs)
exit()
sys.exit()



3 changes: 0 additions & 3 deletions tests/tests_jody.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,3 @@ def test_vcf_to_dadi3(self):

if __name__ == "__main__":
unittest.main(verbosity = 2)



0 comments on commit 336e3d3

Please sign in to comment.