is there a way to prevent
compcor from writing a header in the
components_file? There is a
header argument but it does not seem to be what I need.
No, but you can always add a quick function node:
def skip_header(fname): import os import shutil out_name = os.path.abspath(os.path.basename(fname)) with open(fname) as in_file, open(out_name, 'w') as out_file: in_file.readline() # skip first line shutil.copyfileobj(in_file, out_file) return out_name skipper = Node(Function(skip_header), name='skipper')
(I haven’t tested the above.)
Alternatively, you could propose an improvement to the interface by submitting a pull request to nipype.
Writing TSV files without headers sounds like a risky move. How does your downstream analysis look like so you need to remove the header (programming language, neuroimaging toolboxes, etc.)?
If it is python, I would strongly recommend @effigies’ solution.