-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
340,561 additions
and
1,661,803 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,5 @@ cache: pip | |
script: | ||
- sh run_jared_tests.sh | ||
- sh run_andrew_tests.sh | ||
- sh run_jh_tests.sh | ||
|
Empty file.
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,6 @@ | ||
================================================ | ||
vcf_to_sfs.py: Site Frequency Spectrum generator | ||
================================================ | ||
.. automodule:: vcf_to_sfs | ||
|
||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,4 @@ | ||
=============================================== | ||
vcf_to_dadi.py: VCF to dadi Conversion Function | ||
=============================================== | ||
.. automodule:: vcf_to_dadi |
5 changes: 5 additions & 0 deletions
5
docs/source/PPP_pages/Input_File_Generators/vcf_to_fastsimcoal.rst
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,5 @@ | ||
============================================================= | ||
vcf_to_fastsimcoal.py: VCF to fastsimcoal Conversion Function | ||
============================================================= | ||
.. automodule:: vcf_to_fastsimcoal | ||
|
4 changes: 4 additions & 0 deletions
4
docs/source/PPP_pages/Input_File_Generators/vcf_to_gphocs.rst
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,4 @@ | ||
=================================================== | ||
vcf_to_gphocs.py: VCF to GPhocs Conversion Function | ||
=================================================== | ||
.. automodule:: vcf_to_gphocs |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
docs/source/PPP_pages/Input_File_Generators/vcf_to_treemix.rst
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,4 @@ | ||
===================================================== | ||
vcf_to_treemix.py: VCF to treemix Conversion Function | ||
===================================================== | ||
.. automodule:: vcf_to_treemix |
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,5 @@ | ||
======================================================== | ||
vcf_bed_to_seq.py: Generate sequences from VCF/BED Files | ||
======================================================== | ||
.. automodule:: vcf_bed_to_seq | ||
|
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
Empty file.
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
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
22 20000000 4 60 61 |
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,222 @@ | ||
import unittest | ||
import filecmp | ||
import sys | ||
import os | ||
import logging | ||
import shutil | ||
import zipfile | ||
|
||
## Import scripts to test | ||
|
||
import pgpipe.vcf_bed_to_seq as vcf_bed_to_seq | ||
import pgpipe.vcf_to_sfs as vcf_to_sfs | ||
import pgpipe.vcf_to_dadi as vcf_to_dadi | ||
import pgpipe.vcf_to_treemix as vcf_to_treemix | ||
import pgpipe.vcf_to_gphocs as vcf_to_gphocs | ||
import pgpipe.vcf_to_fastsimcoal as vcf_to_fastsimcoal | ||
|
||
|
||
## Used to compare two files, returns bool | ||
def file_comp(test_output, expected_output): | ||
return filecmp.cmp(test_output, expected_output) | ||
|
||
|
||
|
||
class jh_function_tests (unittest.TestCase): | ||
|
||
def test_vcf_bed_to_seq1 (self): | ||
vcf_bed_to_seq.run(['--vcf','pan_example.vcf.gz', | ||
'--fasta-reference',"pan_example_ref.fa", | ||
'--model-file',"panmodels.model", | ||
'--modelname',"4Pop", | ||
'--region',"21:4431001-4499000", | ||
'--out','ppp_test_temp.out']) | ||
|
||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_bed_to_seq_test.out')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
|
||
def test_vcf_to_sfs1 (self): | ||
|
||
vcf_to_sfs.run(['--vcf',"pan_example2.vcf.gz", | ||
'--model-file',"panmodels.model", | ||
'--modelname','4Pop', | ||
'--downsamplesizes','3','3','3','4', | ||
'--folded','--outgroup-fasta',"chr22_pan_example2_ref.fa", | ||
'--out',"ppp_test_temp.out"]) | ||
|
||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_to_sfs_test1.txt')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
def test_vcf_to_sfs2 (self): | ||
vcf_to_sfs.run(['--vcf',"pan_example.vcf.gz", | ||
'--model-file',"panmodels.model",'--modelname','5Pop', | ||
'--downsamplesizes','3','3','3','4','2', | ||
'--folded','--outgroup-fasta',"pan_example_ref.fa", | ||
'--out',"ppp_test_temp.out"]) | ||
|
||
|
||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_to_sfs_test2.txt')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
|
||
def test_vcf_to_gphocs1 (self): | ||
vcf_to_gphocs.run(['--vcf','pan_example.vcf.gz','--reference', | ||
"pan_example_ref.fa", | ||
'--model-file',"panmodels.model",'--modelname',"4Pop", | ||
'--bed-file',"pan_example_regions.bed", | ||
'--out','ppp_test_temp.out']) | ||
|
||
|
||
|
||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_gphocs_test.out')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
def test_vcf_to_gphocs2 (self): | ||
vcf_to_gphocs.run(['--vcf','pan_example2.vcf.gz','--reference', | ||
"chr22_pan_example2_ref.fa", | ||
'--model-file',"panmodels.model",'--modelname',"4Pop", | ||
'--bed-file',"pan_test_regions.bed", | ||
'--out','ppp_test_temp.out','--diploid','False']) | ||
|
||
|
||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_gphocs_test2.out')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
def test_vcf_to_treemix1(self): | ||
|
||
vcf_to_treemix.run(['--vcf','pan_example.vcf.gz', | ||
'--model-file',"panmodels.model", | ||
'--modelname',"4Pop", | ||
'--out','ppp_test_temp.out', | ||
'--bed-file',"pan_example_regions.bed", | ||
'--kblock','1000']) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out.gz', | ||
'results/vcf_treemixtest1.gz')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out.gz') | ||
|
||
def test_vcf_to_treemix2(self): | ||
vcf_to_treemix.run(['--vcf','pan_example.vcf.gz', | ||
'--model-file',"panmodels.model", | ||
'--modelname',"4Pop", | ||
'--out','ppp_test_temp.out']) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out.gz', | ||
'results/vcf_treemixtest2.gz')) | ||
|
||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out.gz') | ||
|
||
|
||
def test_vcf_to_fastsimcoal1(self): | ||
|
||
vcf_to_fastsimcoal.run(['--vcf',"pan_example.vcf.gz", | ||
'--model-file',"panmodels.model", | ||
'--modelname','3Pop', | ||
'--dim','1','2','m', | ||
'--basename','ppp_test_temp.out']) | ||
# must extract archives to check that files match | ||
pz = zipfile.ZipFile('ppp_test_temp.out.zip',mode='r') | ||
vz = zipfile.ZipFile('results/vcf_fsc1.zip',mode='r') | ||
pznl = pz.namelist() | ||
vznl = vz.namelist() | ||
assert len(pznl) == len(vznl) | ||
for fi in range(len(pznl)): | ||
pz.extract(pznl[fi]) | ||
vz.extract(vznl[fi]) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp(pznl[fi],vznl[fi])) | ||
# remove extracted files | ||
self.addCleanup(os.remove, pznl[fi]) | ||
self.addCleanup(os.remove, vznl[fi]) | ||
|
||
|
||
def test_vcf_to_fastsimcoal2(self): | ||
|
||
vcf_to_fastsimcoal.run(['--vcf',"pan_example2.vcf.gz", | ||
'--model-file',"panmodels.model", | ||
'--modelname','5Pop', | ||
'--downsamplesizes','3','3','3','4','2', | ||
'--basename','ppp_test_temp.out', | ||
'--folded','--dim','1','2','m', | ||
'--outgroup-fasta',"chr22_pan_example2_ref.fa"]) | ||
# must extract archives to check that files match | ||
pz = zipfile.ZipFile('ppp_test_temp.out.zip',mode='r') | ||
vz = zipfile.ZipFile('results/vcf_fsc2.zip',mode='r') | ||
pznl = pz.namelist() | ||
vznl = vz.namelist() | ||
assert len(pznl) == len(vznl) | ||
for fi in range(len(pznl)): | ||
pz.extract(pznl[fi]) | ||
vz.extract(vznl[fi]) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp(pznl[fi],vznl[fi])) | ||
# remove extracted files | ||
self.addCleanup(os.remove, pznl[fi]) | ||
self.addCleanup(os.remove, vznl[fi]) | ||
|
||
|
||
def test_vcf_to_dadi1(self): | ||
|
||
vcf_to_dadi.run(['--vcf','pan_example.vcf.gz', | ||
'--model-file',"panmodels.model", | ||
'--modelname',"4Pop",'--out','ppp_test_temp.out', | ||
'--comment','testing bedfile', | ||
'--bed-file',"pan_example_regions.bed"]) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_dadisnp_bedfile_test.out')) | ||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
|
||
def test_vcf_to_dadi2(self): | ||
vcf_to_dadi.run(['--vcf',"pan_example2.vcf.gz", | ||
'--model-file',"panmodels.model", | ||
'--modelname',"4Pop",'--out','ppp_test_temp.out', | ||
'--comment','testing comment']) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_dadisnp_test.out')) | ||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
def test_vcf_to_dadi3(self): | ||
vcf_to_dadi.run(['--vcf',"pan_example2.vcf.gz",'--model-file', | ||
"panmodels.model", | ||
'--modelname',"4Pop",'--out','ppp_test_temp.out', | ||
'--comment','testing outgroup-fasta','--outgroup-fasta', | ||
"chr22_pan_example2_ref.fa"]) | ||
# Confirm that the output is what is expected | ||
self.assertTrue(file_comp('ppp_test_temp.out', | ||
'results/vcf_dadisnp_fasta_test.out')) | ||
# Remove the ouput | ||
self.addCleanup(os.remove, 'ppp_test_temp.out') | ||
|
||
if __name__ == "__main__": | ||
unittest.main(verbosity = 2) | ||
|
||
|
||
|
File renamed without changes.
Binary file not shown.
Binary file not shown.
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,2 @@ | ||
21 14365450 4 50 51 | ||
22 19389255 14652767 50 51 |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
File renamed without changes.
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,2 @@ | ||
21 14365450 4 50 51 | ||
22 19389255 14652767 50 51 |
File renamed without changes.
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,3 @@ | ||
22 14430599 14431600 | ||
22 15658547 15659548 | ||
|
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.