Allow wildcard names for model variables
See original GitHub issueI’m trying to pass variable names to a bids model with wildcards like so:
“Model”: { “X”: [ ‘stimulus_type.neutral_anticipation’, ‘stimulus_type.neutral_feedback’, ‘stimulus_type.loss_anticipation’, ‘stimulus_type.avoided_loss_feedback’, ‘stimulus_type.gain_anticipation’, ‘stimulus_type.gain_feedback’, ‘stimulus_type.missed_gain_feedback’, ‘stimulus_type.loss_feedback’, ‘trans_', 'rot_’, ‘cosine*’, ‘a_comp_cor_', 't_comp_cor_’, ‘aroma_motion_', 'censor_’ ], },
This is throwing a key error trans_*
Traceback (most recent call last):
File "/data/nielsond/python/envs/fitlins_dev/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 69, in run_node
result['result'] = node.run(updatehash=updatehash)
File "/data/nielsond/python/envs/fitlins_dev/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 473, in run
result = self._run_interface(execute=True)
File "/data/nielsond/python/envs/fitlins_dev/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 564, in _run_interface
return self._run_command(execute)
File "/data/nielsond/python/envs/fitlins_dev/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 649, in _run_command
result = self._interface.run(cwd=outdir)
File "/data/nielsond/python/envs/fitlins_dev/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 376, in run
runtime = self._run_interface(runtime)
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/fitlins/fitlins/interfaces/bids.py", line 235, in _run_interface
analysis.setup(drop_na=False, desc='preproc', **selectors)
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/analysis.py", line 89, in setup
b.setup(input_nodes, drop_na=drop_na, **selectors)
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/analysis.py", line 213, in setup
transform.Select(coll, X)
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/transformations/base.py", line 87, in __new__
return t.transform()
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/transformations/base.py", line 223, in transform
self._clone_variables()
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/transformations/base.py", line 123, in _clone_variables
for v in self.variables}
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/analysis/transformations/base.py", line 123, in <dictcomp>
for v in self.variables}
File "/gpfs/gsfs11/users/MBDU/midla/notebooks/code/pybids/bids/variables/kollekshuns.py", line 184, in __getitem__
return self.variables[var]
KeyError: 'trans_*'
I get the same thing if i use trans_.* I’m pretty sure this is happening because no matching is being done on X here: https://github.com/bids-standard/pybids/blob/15aa08fb2b146e3fcc62f359ea4a4d810d38591a/bids/analysis/analysis.py#L212-L213
Issue Analytics
- State:
- Created 4 years ago
- Comments:28 (3 by maintainers)
Top Results From Across the Web
Examples of wildcard characters - Microsoft Support
Wildcards are special characters that can stand in for unknown characters in a text value and are handy for locating multiple items with...
Read more >A Wildcard Character for Variable Lists - Lex Jansen
This paper shows how to use the technique to reduce programming time, errors and drudgery. Key Words: variable lists, wildcard character, productivity, colon ......
Read more >Wildcard in variable list - sas - Stack Overflow
Ive got this simple calculation to make (in SAS) from a table that Ive transposed (hence the variable names). I have to do...
Read more >Wildcards and Variables in Resource-based Policies
Reference for wildcards and variables in resource-based policies. Wildcard characters can be included in the resource path, the database name, the table name, ......
Read more >7 Character | Data Wrangling with R
You might also use this if you were constructing a set of variable names with a ... operating systems all allow wildcards in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What’s the objection to just having standard globbing behavior again? Is it just to guard against accidental overinclusive queries? I guess I don’t really see that as being our concern… if someone doesn’t realize that doing
a*
is going to end badly, they’ll learn soon enough from experience. I would rather have the simplicity of saying that*
and?
behave as they do in the unix shell.We should put it in the spec. Otherwise, there’s really no good way to specify a potentially variable number of regressors, such as
non_steady_state_*
, unless the model is produced by the tool that identifies outliers (in this case).Or we would need to have some fixed set of prefixes that are shorthand for a collection, such as
cosine
expands to the equivalent ofcosine_*
.