Skip to content

Commit

Permalink
Updates to GenerateFs for LowPass
Browse files Browse the repository at this point in the history
  • Loading branch information
tjstruck committed Aug 6, 2024
1 parent 3fd79c7 commit 1ee6a99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions dadi_cli/GenerateFs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def generate_fs(
If the VCF file does not contain the AA INFO field and `polarized` is True.
"""
if len(pop_ids) != len(projections):
raise ValueError("The lengths of `pop_ids` and `projections` must match.")

if polarized:
try:
Expand Down Expand Up @@ -89,6 +87,11 @@ def generate_fs(
print(projections, ploidy, subsample)
else:
dd = dadi.Misc.make_data_dict_vcf(vcf_filename=vcf, popinfo_filename=pop_info, calc_coverage=calc_coverage)

# Moved this lower, since using subsamples make projections not required
if len(pop_ids) != len(projections):
raise ValueError("The lengths of `pop_ids` and `projections` must match.")

if calc_coverage:
import pickle
coverage_dd = {chrom_pos:{'coverage':dd[chrom_pos]['coverage']} for chrom_pos in dd}
Expand Down
6 changes: 5 additions & 1 deletion dadi_cli/parsers/generate_fs_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ def add_generate_fs_parsers(subparsers: argparse.ArgumentParser) -> None:
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=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.",
)

Expand Down

0 comments on commit 1ee6a99

Please sign in to comment.