Euphrasiologist / nu_plugin_bio

Bioinformatics plugin for nushell.
24 stars 2 forks source link

Tables generated from FASTA cannot be subsetted and saved as new FASTA #9

Closed ryan-preble closed 1 year ago

ryan-preble commented 1 year ago

Opening a FASTA file works fine, but if you try to take a subset of it and then save the output in a new file, it does not work. You get an error: can't convert record<id: string, sequence: string> to string

I imagine this also happens to other file types, though I have not tried. For feature-completeness and better integration into nushell, there probably needs to be a function that can convert FASTA-generated tables back into FASTA files.

Euphrasiologist commented 1 year ago

Thanks for the issue, I do see the problem here. As a current workaround, try something like:

open ./tests/fasta_to_map.fa | each {|e| echo $">($e.id)\n($e.sequence)" } o> ./test.fa

I do agree that perhaps it would be easier to have something like:

open ./tests/fasta_to_map.fa | <do filtery stuff> | to fasta o> ./test.fa

Maybe?