Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ENH: Add --func-only option to skip anatomical processing #808

Closed
wants to merge 17 commits into from

Conversation

madeleinesnyder
Copy link

@madeleinesnyder madeleinesnyder commented Nov 1, 2017

  • Connect this workflow or, probably, return it instead of wf.
  • Fill up the structure of the new workflow init_onlyfunc_preproc_wf
  • Write func-only alternatives to the Summary node and the Reports node, and connect them.
  • Verify your name, affiliation and insert your ORCID (if available) in the credits file.

@madeleinesnyder
Copy link
Author

Ah yes, got it. I see now there is a whole new workflow to take care of the func-only case instead of editing the original func workflow.

Also, I was thinking that it might be helpful for me to contribute a BIDSgenerator file that would be easily configured by people who want to use the pipeline but don't have the BIDS data format. I know our lab was hesitant to use the pipeline because of the overhead of renameing and restructuring data, so it might increase use if there is an add-on file that takes care of this. I could put in the places in run.py and other scripts where BIDSgenerator.py is called

@oesteban oesteban changed the title Func only [WIP] ENH: Add --func-only option to skip anatomical processing Nov 1, 2017
@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

Sure, but it is a lot easier to keep things focused :). Feel free to open as many PRs as features you'd like to contribute. It's much more manageable when contributions are handled separatelly

@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

As you can see above, I just pushed one commit to your branch. You can see it where it says "convert indentation to spaces" above.

To get those changes, make sure you git pull on your repo after you make sure you are in the correct branch with git checkout func-only.

@madeleinesnyder
Copy link
Author

Ok, so I don't mess this up:

To open a PR to push the BIDSgenerator.py file and other files updated with (commented out) lines to handle this script, I would do a new PR from the https://github.com/poldracklab/fmriprep page on the master branch?

@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

Yes - to open a new PR:

  1. Make sure you are in sync with the upstream repo:
git fetch upstream
git checkout master
git merge upstream/master
  1. Open up a new branch
git checkout -b new-feature-branch
  1. Edit the code (add changes now), commit changes and push:
<edit files>
git add <new files that were not in the repo already>
git commit -a
git push --set-upstream origin new-feature-branch
  1. Go to GitHub.com and request a new PR

  2. Repeat 3 until the code is acceptable to be merged in.

@madeleinesnyder
Copy link
Author

Alrighty I just requested a new one-- it should be just two files, one added (BIDSgenerator.py) and one modified (run.py)

@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

Cool!

Let's focus on getting this one merged first 👍

I have updated your PR comment up above with the tasks that need be done before merging.

You will also see below my comment a message saying "All checks have failed". This means that there are problems with the code and it didn't pass tests. Let's not worry about this now, but tests will need to get green before we can merge. We'll address this in a future.

Please let me know what is stopping you at this point (if any).

@madeleinesnyder
Copy link
Author

madeleinesnyder commented Nov 1, 2017 via email

@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

git push

The --set-upstream origin is only for the first time you push. After that origin is always set when you push.

@madeleinesnyder
Copy link
Author

madeleinesnyder commented Nov 1, 2017 via email

@oesteban
Copy link
Member

oesteban commented Nov 1, 2017

Indeed!

I can see your changes here: 940340b

BTW, with the git add --all you also included a file called fmriprep/workflows/.base.py.swo (vim's temporary files).

Please remove it:

git rm fmriprep/workflows/.base.py.swo
git commit -am 'remove fmriprep/workflows/.base.py.swo'
git push

Copy link
Member

@effigies effigies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple quick things I noticed. This is looking good!

.zenodo.json Outdated
"name": "Madeleine Snyder",
"affiliation": "Harvard Medical School, Harvard University, Cambridge, Massachusetts"
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to just above Russ Poldrack? Outside contributors are listed in order of contribution, starting at Feilong Ma.

Also, we haven't generally included city and state in the affiliation. For consistency, I'd suggest dropping it. And do you have an ORCID? It doesn't take much time to get one, and they help disambiguate researchers with similar names, as well as persist across changes in institution/name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the ordering issue, it's my bad. @madeleinesnyder please fix the ordering and add your ORCID if available/possible.

])

if anat_only:
return workflow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I specify --anat-only and --func-only, this won't be hit, so the functional workflows will still be generated. There should probably at some point (possibly in run.py) be a check to raise an exception if both flags are passed to fmriprep.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I would just put in a simple if anat_only and func_only raise exception before any of the workflows are put together. Any reasons to put it elsewhere?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "proper" way to do this is using mutually exclusive options

    # Create a mutually exclusive group for --anat-only and --func-only
    g_blocks = parser.add_mutually_exclusive_group()
    g_blocks.add_argument('--anat-only', action='store_true',
                          help='run anatomical workflows only')
    g_blocks.add_argument('--func-only', action='store_true',
                          help='run functional workflows only '
                               '(dismiss the anatomical images if present).')

workflow.connect([
(inputnode, func_preproc_wf, [('subjects_dir', 'inputnode.subjects_dir')]),
(bidssrc, bids_info, [
(('bold', fix_multi_bold_source_name), 'in_file')]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix_multi_bold_source_name is undefined

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed there was an analog to fic_multi_t1w_source_name, which pops up in the anat_only workflow.

(bidssrc, func_preproc_wf, [('bold', 'inputnode.bold')]),
(summary, func_preproc_wf, [('subject_id', 'inputnode.subject_id')]),
(bidssrc, ds_summary_report, [
(('bold', fix_multi_bold_source_name), 'source_file')]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix_multi_bold_source_name is undefined

(('bold', fix_multi_bold_source_name), 'source_file')]),
(summary, ds_summary_report, [('out_report', 'in_file')]),
(bidssrc, ds_about_report, [
(('bold', fix_multi_bold_source_name), 'source_file')]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix_multi_bold_source_name is undefined

@oesteban
Copy link
Member

I can put some hours on pushing this PR forward this week, WDYT @madeleinesnyder ?

There are some outstanding errors, if you look at Travis tests:

$ flake8 fmriprep wrapper
fmriprep/workflows/base.py:482:31: F821 undefined name 'fix_multi_bold_source_name'
fmriprep/workflows/base.py:489:31: F821 undefined name 'fix_multi_bold_source_name'
fmriprep/workflows/base.py:492:31: F821 undefined name 'fix_multi_bold_source_name'
fmriprep/workflows/bold/base.py:751:9: F841 local variable 'bold_pe' is assigned to but never used
fmriprep/workflows/bold/base.py:772:5: E303 too many blank lines (2)
fmriprep/workflows/bold/base.py:779:9: F841 local variable 'bold_stc_wf' is assigned to but never used
fmriprep/workflows/bold/base.py:788:9: F821 undefined name 'summary'
fmriprep/workflows/bold/base.py:825:29: F821 undefined name 'func_reports_wf'
fmriprep/workflows/bold/base.py:843:9: E303 too many blank lines (2)
fmriprep/workflows/bold/base.py:845:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:846:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:848:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:848:23: F821 undefined name 'bold_confounds_wf'
fmriprep/workflows/bold/base.py:848:97: W291 trailing whitespace
fmriprep/workflows/bold/base.py:849:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:849:29: F821 undefined name 'func_reports_wf'
fmriprep/workflows/bold/base.py:851:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:851:10: F821 undefined name 'bold_confounds_wf'
fmriprep/workflows/bold/base.py:856:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:856:10: F821 undefined name 'bold_confounds_wf'
fmriprep/workflows/bold/base.py:856:29: F821 undefined name 'func_reports_wf'
fmriprep/workflows/bold/base.py:860:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:860:10: F821 undefined name 'bold_confounds_wf'
fmriprep/workflows/bold/base.py:860:29: F821 undefined name 'summary'
fmriprep/workflows/bold/base.py:861:9: E122 continuation line missing indentation or outdented
fmriprep/workflows/bold/base.py:861:10: F821 undefined name 'summary'
fmriprep/workflows/bold/base.py:861:19: F821 undefined name 'func_reports_wf'

@madeleinesnyder
Copy link
Author

Yes, I can come work on main campus if that would help. Or work remotely from my lab. Either works. Let me know.

@oesteban
Copy link
Member

oesteban commented Dec 7, 2017

Hey @madeleinesnyder, we released fmriprep-1.0.0 yesterday. I am hoping that after next week I'll have more time and can help you finish this up. Let me know when you can touch base.

@madeleinesnyder
Copy link
Author

madeleinesnyder commented Dec 7, 2017 via email

@stale
Copy link

stale bot commented Oct 3, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 3, 2018
@stale stale bot closed this Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants