Re: [Jprogramming] Split on first found character

2014-11-28 Thread Linda Alvord
programming-boun...@forums.jsoftware.com] On Behalf Of Marc Bourassa Sent: Tuesday, November 25, 2014 7:51 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Split on first found character first_found=. 13 : 'CR-.~ y{.~ y i.LF' first_found (13{a.) -.~ ]

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Marc Bourassa
or join them into a single string > > > > > > LF joinstring ;/ 'abc' > > > a > > > b > > > c > > > > > > '' joinstring ;/ 'abc' > > > ; ;/ 'abc' NB. or this > > > abc > >

Re: [Jprogramming] Split on first found character

2014-11-25 Thread chris burke
' > > ; ;/ 'abc' NB. or this > > abc > > > > > > to extend Joe's solution > > > > (>@:{. ; ;@}.)@:cutLF each '>' cut > > > > > > > > > > - Original Message - > &g

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Marc Bourassa
t; into processing chunks. Having them boxed works for this, but if you > ever > > need to put the LFs back, or join them into a single string > > > > LF joinstring ;/ 'abc' > > a > > b > > c > > > > '' joinstring ;/ 'ab

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Devon McCormick
back, or join them into a single string > > LF joinstring ;/ 'abc' > a > b > c > > '' joinstring ;/ 'abc' > ; ;/ 'abc' NB. or this > abc > > > to extend Joe's solution > > (>@:{. ; ;@}.)@:cutLF each '>'

Re: [Jprogramming] Split on first found character

2014-11-25 Thread 'Pascal Jasmin' via Programming
nstring ;/ 'abc' a b c '' joinstring ;/ 'abc' ; ;/ 'abc' NB. or this abc to extend Joe's solution (>@:{. ; ;@}.)@:cutLF each '>' cut - Original Message - From: Joe Bogner To: programm...@jsoftware.com Cc:

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Tikkanz
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

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Henry Rich
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

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Mike Day
That's quite nice. Looking at the genetic coding examples on the website Jan-Pieter mentioned, and bearing in mind that "cut" is a provided verb, this might be the sort of thing he would like: NB. script version of defining some taxons: sample =: 0 : 0 NB. truncated lines from web example >Tax

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Joe Bogner
I might do it this way: (>@:{. ; ;@}.)@(LF&cut) x ┌───┬─┐ │case_id│GCTAGTCGACGTC│ └───┴─┘ On Tue, Nov 25, 2014 at 5:47 AM, Jan-Pieter Jacobs < janpieter.jac...@gmail.com> wrote: > I think I would solve it like this (with intermediate steps): > > x=: 'case_id

Re: [Jprogramming] Split on first found character

2014-11-25 Thread Jan-Pieter Jacobs
I think I would solve it like this (with intermediate steps): x=: 'case_id', LF, 'GCTAGTCG', LF, 'ACGTC', LF NB. Find the locations of LF's in the string (LF = ]) x NB. assign 0 to everything before the LF, assign 1 to everything after it ([: +./\ LF = ]) x NB. The wonderful "key" adverb lets

[Jprogramming] Split on first found character

2014-11-25 Thread Ryan
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@