Commits

Giovanni Marco Dall'Olio committed c06af8f

TEST: added a few test cases, checking the --windows, --samples options in vcf2networks

Comments (0)

Files changed (1)

test/test_Report.py

   
     """
 
+def testDebugReportSubSample():
+    """
+    >>> command = "python src/vcf2networks.py --sample 200 --random_seed 2 --config test/test_data/params/debug.yaml --no-debug --vcf=test/test_data/vcf/ALG11.vcf.gz --individuals=test/test_data/individuals_annotations.txt"
+    >>> output = subprocess.check_output(command.split(), stderr=subprocess.PIPE)
+
+    #NOTE: the blankline at the end is generated by subprocess.check_output, not by the script
+    >>> print output #doctest: +NORMALIZE_WHITESPACE 
+    gene continent n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
+    gene glob 498 2184 glob 139 58 1.4834 window_0 498
+    gene global_sub 498 200 glob 38 14 1.2553 window_0 498
+    gene EUR 498 200 glob 22 12 1.4667 window_0 498
+    gene ASN 498 200 glob 25 18 1.2698 window_0 498
+    gene AMR 498 200 glob 33 12 1.1646 window_0 498
+    gene AFR 498 200 glob 46 11 1.102 window_0 498
+    <BLANKLINE>
+     """
+def testDebugReportWindowsNoOverlapping():
+    """
+    >>> command = "python src/vcf2networks.py --window 200 --random_seed 2 --config test/test_data/params/debug.yaml --no-debug --vcf=test/test_data/vcf/ALG11.vcf.gz --individuals=test/test_data/individuals_annotations.txt"
+    >>> output = subprocess.check_output(command.split(), stderr=subprocess.PIPE)
+
+    #NOTE: the blankline at the end is generated by subprocess.check_output, not by the script
+    >>> print output #doctest: +NORMALIZE_WHITESPACE 
+    gene continent n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
+    gene glob 200 2184 glob 43 46 1.6146 window_0 498
+    gene EUR 200 758 glob 11 23 1.6842 window_0 498
+    gene ASN 200 572 glob 7 19 1.8214 window_0 498
+    gene AMR 200 362 glob 16 12 1.3725 window_0 498
+    gene AFR 200 492 glob 30 19 1.2208 window_0 498
+    gene glob 200 2184 glob 29 48 1.7191 window_1 498
+    gene EUR 200 758 glob 7 25 1.8246 window_1 498
+    gene ASN 200 572 glob 11 13 1.5217 window_1 498
+    gene AMR 200 362 glob 13 14 1.5 window_1 498
+    gene AFR 200 492 glob 24 27 1.4321 window_1 498
+     """
+
+
+def testDebugReportWindowsNoOverlappingAndSample():
+    """
+    >>> command = "python src/vcf2networks.py --sample 200 --window 200 --random_seed 2 --config test/test_data/params/debug.yaml --no-debug --vcf=test/test_data/vcf/ALG11.vcf.gz --individuals=test/test_data/individuals_annotations.txt"
+    >>> output = subprocess.check_output(command.split(), stderr=subprocess.PIPE)
+
+    #NOTE: the blankline at the end is generated by subprocess.check_output, not by the script
+    >>> print output #doctest: +NORMALIZE_WHITESPACE 
+    gene continent n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
+    gene glob 200 2184 glob 43 46 1.6146 window_0 498
+    gene global_sub 200 200 glob 16 10 1.2381 window_0 498
+    gene EUR 200 200 glob 8 9 1.4286 window_0 498
+    gene ASN 200 200 glob 8 12 1.5294 window_0 498
+    gene AMR 200 200 glob 14 9 1.2821 window_0 498
+    gene AFR 200 200 glob 19 13 1.1915 window_0 498
+    gene glob 200 2184 glob 29 48 1.7191 window_1 498
+    gene global_sub 200 200 glob 13 13 1.4583 window_1 498
+    gene EUR 200 200 glob 6 15 1.6667 window_1 498
+    gene ASN 200 200 glob 9 7 1.3333 window_1 498
+    gene AMR 200 200 glob 11 9 1.3125 window_1 498
+    gene AFR 200 200 glob 26 20 1.1071 window_1 498
+     """
+
+
+
 def testDebugReportPhenotype1():
     """
     >>> command = "python src/vcf2networks.py --phenotype PHENOTYPE1  --config test/test_data/params/debug.yaml --no-debug --vcf=test/test_data/vcf/ALG11.vcf.gz --individuals=test/test_data/individuals_annotations.txt"
 
     #NOTE: the blankline at the end is generated by subprocess.check_output, not by the script
     >>> print output #doctest: +NORMALIZE_WHITESPACE 
-    gene continent n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
+    gene PHENOTYPE1 n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
     gene glob 498 2184 glob 139 58 1.4834 window_0 498
-    gene EUR 498 758 glob 37 19 1.5974 window_0 498
-    gene ASN 498 572 glob 35 32 1.5323 window_0 498
-    gene AMR 498 362 glob 38 15 1.3621 window_0 498
-    gene AFR 498 492 glob 74 17 1.1026 window_0 498
+    gene pink 498 1508 glob 114 46 1.4065 window_0 498
+    gene blue 498 676 glob 81 32 1.4103 window_0 498
     <BLANKLINE>
-  
+
     """
 
 def testDebugReportPhenotype1LowerCase():
     """
     >>> command = "python src/vcf2networks.py --phenotype phenotype1  --config test/test_data/params/debug.yaml --no-debug --vcf=test/test_data/vcf/ALG11.vcf.gz --individuals=test/test_data/individuals_annotations.txt"
-    >>> output = subprocess.check_output(command.split(), stderr=subprocess.PIPE)
+     >>> output = subprocess.check_output(command.split(), stderr=subprocess.PIPE)
 
     #NOTE: the blankline at the end is generated by subprocess.check_output, not by the script
     >>> print output #doctest: +NORMALIZE_WHITESPACE 
-    gene continent n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
+    gene phenotype1 n_snps n_datapoints pop n_components max_degree av_degree window whole_gene_nsnps
     gene glob 498 2184 glob 139 58 1.4834 window_0 498
-    gene EUR 498 758 glob 37 19 1.5974 window_0 498
-    gene ASN 498 572 glob 35 32 1.5323 window_0 498
-    gene AMR 498 362 glob 38 15 1.3621 window_0 498
-    gene AFR 498 492 glob 74 17 1.1026 window_0 498
-    <BLANKLINE>
-  
+    gene pink 498 1508 glob 114 46 1.4065 window_0 498
+    gene blue 498 676 glob 81 32 1.4103 window_0 498
+    <BLANKLINE> 
+ 
     """
 
 #def testDebugHDF5Report():