In case it is of interest there is an implementation here: http://rosettacode.org/wiki/FASTA_format#J
You could simplify it a bit to generate results similar to others here: parseFasta=: ( LF&taketo ; (LF -.~ LF&takeafter));._1 As Mike suggests, you will probably want to chunk and buffer if you are processing big files. On Tue, Nov 25, 2014 at 11:00 PM, Ryan <rec...@bwh.harvard.edu> wrote: > I have a character array with LF's, and want to split it on the > first LF, and remove the remaining LF's. I'm wondering if there's a > simpler > way than what I'm doing now: > > x=: 'case_id', LF, 'GCTAGTCG', LF, 'ACGTC', LF > > filterLF=: #~ ~:&LF > headLF=: {.~ i.&LF > tailLF=: }.~ i.&LF > (headLF ; filterLF@tailLF) x > ┌────────┬─────────────┐ > │>case_id│GCTAGTCGACGTC│ > └────────┴─────────────┘ > > (I'm reading text files in fasta format: http://rosalind.info/glossary/ > fasta-format/) > > Thanks for any suggestions, > Ryan > > > > The information in this e-mail is intended only for the person to whom it > is > addressed. If you believe this e-mail was sent to you in error and the > e-mail > contains patient information, please contact the Partners Compliance > HelpLine at > http://www.partners.org/complianceline . If the e-mail was sent to you in > error > but does not contain patient information, please contact the sender and > properly > dispose of the e-mail. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm