[go: nahoru, domu]

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

add --post option to split / split2 subcommands #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ocxtal
Copy link
Contributor
@ocxtal ocxtal commented Jul 14, 2020

Hi Wei,

I wanted seqkit split / split2 subcommands to have an option to feed output to a shell command, just as implemented in GNU coreutils' split as --filter option (https://man7.org/linux/man-pages/man1/split.1.html).

What I did are:

  • added WopenPipe function in xopen (I haven't created PR yet: https://github.com/ocxtal/xopen/tree/wopenpipe)
  • added openWriter in helper.go, which opens pipe with WopenPipe if postprocessing command is nonempty.
  • modified writeSeqs in helper.go to use openWriter
  • modified calls to writeSeqs in split{2}.go to pass postprocessing command string
  • replaced calls to Wopen in split{2}.go to openWriter
  • added --post (-P) option to split{2}.go

However the patch is incomplete in the following points:

  • lacks tests for this new option (I tested it just worked. I didn't care about performance.)
  • might have compatibility problems around forking child process in WopenPipe

Since I'm not familiar with golang or unix processes, I'd like ask you to give any kind of comment on the patch. I'd also happy if you could take over and complete this work.

Thanks in advance,

Hajime Suzuki

@shenwei356
Copy link
Owner

Sounds useful. But I'm not familiar with sub-processes handling in golang either.

Someone suggested a similar feature in this or another repo, I think it's worth trying, when I have enough time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants