Skip to content

Commit 3582192

Browse files
committed
changed chromosome list to allow for simulation of any focal chromosome rather than all chromosomes up to the focal chromosome
1 parent 75d2b0a commit 3582192

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

n_t/Snakefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ model = model_class()
7171
genetic_map_class = getattr(species,config["genetic_map"])
7272
genetic_map = genetic_map_class()
7373

74-
# A list containing the names all simulated chromosomes you would
75-
# like to include in each analysis
76-
# TODO: Change this to list(species.genome.chromosomes)
74+
# The names of all chromosomes to simulate, separated by commas
75+
# Use "all" to simulate all chromsomes for the genome
7776
chrm_list = [chrom for chrom in species.genome.chromosomes]
7877
if(config["chrm_list"] != "all"):
79-
chrm_list = chrm_list[:config["chrm_list"]]
78+
chrm_list = [chr for chr in config["chrm_list"].split(",")]
8079

8180
# For plotting
8281
generation_time = config["generation_time"]
@@ -152,7 +151,7 @@ rule run_stairwayplot:
152151
stairwayplot_code,
153152
output: output_dir + "/Results/{seeds}/stairwayplot_estimated_Ne.txt"
154153
threads: 20
155-
run:
154+
run:
156155
inputs = expand(output_dir + "/Intermediate/{seeds}/{chrms}.trees",
157156
seeds=wildcards.seeds, chrms=chrm_list)
158157
runner = stairway.StairwayPlotRunner(
@@ -286,7 +285,7 @@ rule all_plot:
286285
f3 = ne_files_msmc,
287286
output:
288287
output_dir + "/Results/all_estimated_Ne.pdf"
289-
run:
288+
run:
290289
plots.plot_all_ne_estimates(input.f1, input.f2, input.f3, output[0],
291290
model=model, n_samp=num_sampled_genomes_per_replicate,
292291
generation_time=generation_time, species=config["species"],

n_t/readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ might look like this:
4646
"species" : "homo_sapiens",
4747
"model" : "GutenkunstThreePopOutOfAfrica",
4848
"genetic_map" : "HapmapII_GRCh37",
49-
"chrm_list" : "all",
49+
"chrm_list" : "chr22,chrX",
5050
"generation_time" : 25,
5151
}
5252
```
@@ -143,7 +143,8 @@ should inherit from `<class Model>`
143143
`genetic_map` : `<class childclass GeneticMap>` This will define the genetic map
144144
used for simulations.
145145

146-
`chrm_list` : `<class 'list[str]'>` The chromosomes you would like to simulate
147-
for input into each of the analysis run. All chromosomes simulated will be fed
146+
`chrm_list` : `<class 'str'>` A string of the chromosome names you would like to simulate,
147+
separated by commas. All chromosomes simulated will be fed
148148
as a single input into each analysis by the inference programs, for each replicate.
149+
Set to "all" to simulate all chromsomes for the genome.
149150

n_t/simulations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from stdpopsim import homo_sapiens
77

88

9-
def simulate(out_path, species, model, genetic_map, seed, chrmStr,
9+
def simulate(out_path, species, model, genetic_map, seed, chrmStr,
1010
sample_size=20, population=0):
1111
chrom = species.genome.chromosomes[chrmStr]
1212
# TODO : Sample outside of population 0?

0 commit comments

Comments
 (0)