Skip to content

Commit

Permalink
Update GenerateFs for dadi VCF parser updates, and make --polarized u…
Browse files Browse the repository at this point in the history
…nrequired if user uses --subsample
  • Loading branch information
tjstruck committed Feb 13, 2024
1 parent 3f0e9c3 commit 00f4eec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dadi_cli/GenerateFs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def generate_fs(
extract_ploidy = True
subsample_dict = {}
for i in range(len(pop_ids)):
subsample_dict[pop_ids[i]] = int(subsample[i])
subsample_dict[pop_ids[i]] = subsample[i]
dd, ploidy = dadi.Misc.make_data_dict_vcf(
vcf_filename=vcf, popinfo_filename=pop_info, subsample=subsample_dict, calc_coverage=calc_coverage, extract_ploidy=extract_ploidy
)
projections = [individuals*ploidy for individuals in subsample]
print(projections, ploidy, subsample)
else:
dd = dadi.Misc.make_data_dict_vcf(vcf_filename=vcf, popinfo_filename=pop_info, calc_coverage=calc_coverage)
if calc_coverage:
Expand Down
7 changes: 6 additions & 1 deletion dadi_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,15 @@ def dadi_cli_parser():
help="Name of the file containing the population name of each sample.",
dest="pop_info",
)
# Check if subsamples are being requested to determin if --projections needed
proj_req = True
if "--subsample" in sys.argv:
proj_req = False
parser.add_argument(
"--projections",
type=_check_positive_int,
nargs="+",
required=True,
required=proj_req,
help="Sample sizes after projection; If you do not want to project down your data, please input the original sample sizes of your data.",
)
parser.add_argument(
Expand All @@ -1437,6 +1441,7 @@ def dadi_cli_parser():
)
parser.add_argument(
"--subsample",
type=_check_positive_int,
default=[],
nargs="+",
dest="subsample",
Expand Down

0 comments on commit 00f4eec

Please sign in to comment.