Skip to content

Commit

Permalink
kwargs for initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
edikedik committed Mar 13, 2024
1 parent 9f9d17a commit e322291
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lXtractor/collection/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ def fetch_missing(self, items: abc.Iterable[SeqItem]) -> t.Any:

def init_inputs(self, items: SeqItemList) -> lxc.ChainList[lxc.ChainSequence]:
staged = items.prep_for_init(self.paths)
chains = self.interfaces.Initializer.from_iterable(staged)
chains = self.interfaces.Initializer.from_iterable(
staged, **self.config["Initializer_init_kw"]
)
return lxc.ChainList(filter(lambda x: x is not None, chains))


Expand Down Expand Up @@ -560,7 +562,9 @@ def fetch_missing(self, items: abc.Iterable[StrItem]) -> t.Any:

def init_inputs(self, items: StrItemList) -> lxc.ChainList[lxc.ChainStructure]:
staged = items.prep_for_init(self.paths)
chains = self.interfaces.Initializer.from_iterable(staged)
chains = self.interfaces.Initializer.from_iterable(
staged, **self.config["Initializer_init_kw"]
)
chains = filter(lambda x: x is not None, chains)
return lxc.ChainList(chain.from_iterable(chains))

Expand Down Expand Up @@ -595,7 +599,8 @@ def fetch_missing(self, items: abc.Iterable[MapItem]) -> tuple[t.Any, t.Any]:
def init_inputs(self, items: MapItemList) -> lxc.ChainList[lxc.Chain]:
return lxc.ChainList(
self.interfaces.Initializer.from_mapping(
dict(items.prep_for_init(self.paths))
dict(items.prep_for_init(self.paths)),
**self.config["Initializer_init_kw"],
)
)

Expand Down
1 change: 1 addition & 0 deletions lXtractor/resources/collection_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"SIFTS_kwargs": {},
"UniProt_kwargs": {},
"Initializer_kwargs": {},
"Initializer_init_kw": {},
"write_batches": false,
"write_batches_overwrite": true,
"keep_chains": false,
Expand Down

0 comments on commit e322291

Please sign in to comment.