Skip to content

Commit

Permalink
feat: add small test dataset based on K1F phage
Browse files Browse the repository at this point in the history
  • Loading branch information
boasvdp committed Jun 27, 2023
1 parent 88605d4 commit d4a3bdb
Show file tree
Hide file tree
Showing 5 changed files with 1,972 additions and 13 deletions.
32 changes: 19 additions & 13 deletions juno_variant_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,14 @@ def _add_args_to_parser(self) -> None:
" databases for all the tools used in this pipeline or where they"
" should be downloaded. Default is: /mnt/db/juno/variant_typing_db",
)
# self.add_argument(
# "--single-copy-bed",
# type=Path,
# required=False,
# metavar="DIR",
# help="Relative or absolute path to a bed file listing positions"
# " in single copy genes. These positions will be screened for mixed"
# "/minority variants to detect potential within-species contamination."
# " The default is selected per species.",
# )
self.add_argument(
"--presets-path",
type=Path,
required=False,
metavar="PATH",
help="Relative or absolute path to custom presets.yaml to use. If"
" none is provided, the default (config/presets.yaml) is used.",
)

def _parse_args(self) -> argparse.Namespace:
args = super()._parse_args()
Expand All @@ -129,6 +127,7 @@ def _parse_args(self) -> argparse.Namespace:
self.species: Optional[str]
self.genus, self.species = args.species
self.metadata_file: Path = args.metadata
self.presets_path: Optional[Path] = args.presets_path
# self.single_copy_bed: Optional[Path] = args.single_copy_bed

return args
Expand Down Expand Up @@ -163,7 +162,7 @@ def setup(self) -> None:
"input_dir": str(self.input_dir),
"output_dir": str(self.output_dir),
"exclusion_file": str(self.exclusion_file),
# "single_copy_bed": str(self.single_copy_bed),
"custom_presets_file": str(self.presets_path),
# "example": str(self.example), # other user parameters can be included in user_parameters.yaml here
}

Expand Down Expand Up @@ -195,11 +194,18 @@ def update_sample_dict_with_metadata(self) -> None:
)

def set_presets(self) -> None:
with open(Path(__file__).parent.joinpath("config/presets.yaml")) as f:

if self.presets_path is None:
self.presets_path = Path(__file__).parent.joinpath("config/presets.yaml")

with open(self.presets_path) as f:
presets_dict = yaml.safe_load(f)


for sample in self.sample_dict:
complete_species_name = "_".join([self.genus, self.species])
complete_species_name = "_".join([self.sample_dict[sample]["genus"],
self.sample_dict[sample]["species"]])

if complete_species_name in presets_dict.keys():
for key, value in presets_dict[complete_species_name].items():
self.sample_dict[sample][key] = value
Expand Down
Loading

0 comments on commit d4a3bdb

Please sign in to comment.