c =. 'case_id', LF, 'GCTAGTCG', LF, 'ACGTC', LF (({. ; LF -.~ }.)~ LF&(i.&1@:=)) c +-------+-------------+ |case_id|GCTAGTCGACGTC| +-------+-------------+
Henry Rich On 11/25/2014 5:00 AM, Ryan 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