2
$\begingroup$

Consider:

seqkit grep -nrp ";s__nosocomialis;" ribogrove_11.217_sequences.fasta

Using this command lets me select all sequences related to the organism "A. nosocomialis" in the RiboGrove database.

How do I save these selected sequences to a new ".fasta" file?

$\endgroup$
0

2 Answers 2

4
$\begingroup$

Based on the docs, seqkit grep has a -o "output file" option, so if you get the correct output with:

seqkit grep -nrp ";s__nosocomialis;" ribogrove_11.217_sequences.fasta

Then this command will (in theory) give you your desired outcome:

seqkit grep -nrp ";s__nosocomialis;" ribogrove_11.217_sequences.fasta -o new.fasta
$\endgroup$
1
  • 1
    $\begingroup$ Thanks, it worked. I don't know how i didn't see the output command while surfing the documentation. $\endgroup$ Apr 22, 2023 at 6:19
1
$\begingroup$

For any program that prints output to the terminal (standard output), you can always redirect to a file using > or >>. Either of the two will create the output file if it doesn't exist, but > will overwrite any contents of an already existing file, while >> will append to it without overwriting. So you could just do:

seqkit grep -nrp ";s__nosocomialis;" ribogrove_11.217_sequences.fasta > out.fa
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.