www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Fasta parser

reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Hi,
I wrote a fasta parser for biology computing
http://pastebin.geany.org/yheQN/

I would like to get your experience to know if the writer could be
better. The given parser use MmFile and Phobos range.

fasta specification format =3D> http://en.wikipedia.org/wiki/FASTA_format
Nov 11 2012
next sibling parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le dimanche 11 novembre 2012 =C3=A0 18:34 +0100, bioinfornatics a =C3=A9cri=
t :
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/
=20
 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.
=20
 fasta specification format =3D> http://en.wikipedia.org/wiki/FASTA_format
=20

minor update http://pastebin.geany.org/OgUHg/ is now a forwardRange
Nov 11 2012
prev sibling next sibling parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On 2012-34-11 18:11, bioinfornatics <bioinfornatics fedoraproject.org>  
wrote:

 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format => http://en.wikipedia.org/wiki/FASTA_format

Not available (anymore). That's a bummer. Also, obligatory 'Red unz go fasta!' -- Simen
Nov 11 2012
prev sibling next sibling parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le dimanche 11 novembre 2012 =C3=A0 19:58 +0100, Simen Kjaeraas a =C3=A9cri=
t :
 On 2012-34-11 18:11, bioinfornatics <bioinfornatics fedoraproject.org> =

 wrote:
=20
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format =3D> http://en.wikipedia.org/wiki/FASTA_form=


=20
 Not available (anymore). That's a bummer.
=20
 Also, obligatory 'Red unz go fasta!'
=20

oops sorry http://dpaste.dzfl.pl/dae66c94
Nov 11 2012
prev sibling next sibling parent reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le dimanche 11 novembre 2012 =C3=A0 18:34 +0100, bioinfornatics a =C3=A9cri=
t :
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/
=20
 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.
=20
 fasta specification format =3D> http://en.wikipedia.org/wiki/FASTA_format
=20

Here i continue to enhance the parser i fail about reverse range: http://dpaste.dzfl.pl/1f0aef89 i need to initialize the range: - popFront if we go forward - popBack if we go back how can i detect this instead to use the boolean isForward?
Nov 11 2012
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 11/11/2012 03:55 PM, bioinfornatics wrote:
 Le dimanche 11 novembre 2012 à 18:34 +0100, bioinfornatics a écrit :
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format =>  http://en.wikipedia.org/wiki/FASTA_format

Here i continue to enhance the parser i fail about reverse range: http://dpaste.dzfl.pl/1f0aef89 i need to initialize the range: - popFront if we go forward - popBack if we go back how can i detect this instead to use the boolean isForward?

If a range provides back() and popBack() in addition to front() and popFront() then it looks like a BidirectionalRange. The users would expect to use a byFasta struct as a BidirectionalRange. However, both front() and back() use the same member, _fasta, meaning that the front and back of the range are the same. I am not familiar with the Fasta format but if it is not by nature bidirectional, I think you shouldn't provide back() and popBack(). Ali
Nov 11 2012
prev sibling next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
11/11/2012 9:34 PM, bioinfornatics пишет:
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format => http://en.wikipedia.org/wiki/FASTA_format

I'd like to spread the word of the proper toString signature that doesn't need appender. void toString(scope delegate(const(char)[]) sink) const{ //same code, but replace fasta.put(x) with sink(x) } -- Dmitry Olshansky
Nov 12 2012
parent reply "Tobias Pankrath" <tobias pankrath.net> writes:
On Monday, 12 November 2012 at 09:16:54 UTC, Dmitry Olshansky 
wrote:
 11/11/2012 9:34 PM, bioinfornatics пишет:
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer 
 could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format => 
 http://en.wikipedia.org/wiki/FASTA_format

I'd like to spread the word of the proper toString signature that doesn't need appender. void toString(scope delegate(const(char)[]) sink) const{ //same code, but replace fasta.put(x) with sink(x) }

Is there any documentation for this signature?
Nov 12 2012
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
11/12/2012 2:14 PM, Tobias Pankrath пишет:
 On Monday, 12 November 2012 at 09:16:54 UTC, Dmitry Olshansky wrote:
 11/11/2012 9:34 PM, bioinfornatics пишет:
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/

 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.

 fasta specification format => http://en.wikipedia.org/wiki/FASTA_format

I'd like to spread the word of the proper toString signature that doesn't need appender. void toString(scope delegate(const(char)[]) sink) const{ //same code, but replace fasta.put(x) with sink(x) }

Is there any documentation for this signature?

Now that could be why nobody uses it :) This hole in documentation must be filled because it is a solution to allocation happiness of toString. AFAIK it supposed to be the new way of string conversion and the old one eventually deprecated. -- Dmitry Olshansky
Nov 12 2012
prev sibling parent bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le dimanche 11 novembre 2012 =C3=A0 18:34 +0100, bioinfornatics a =C3=A9cri=
t :
 Hi,
 I wrote a fasta parser for biology computing
 http://pastebin.geany.org/yheQN/
=20
 I would like to get your experience to know if the writer could be
 better. The given parser use MmFile and Phobos range.
=20
 fasta specification format =3D> http://en.wikipedia.org/wiki/FASTA_format
=20

Tanks to all this one http://dpaste.dzfl.pl/1f0aef89 works has bidirectional range :-) I will take a look to Dmitry comment about toString.=20 at Ali about fasta, fasta format is as an array where is wrote into a plain text file. So they are no restriction in more it is not more harder to parse it from forward or reverse with mmfile i do not know how do same this regular file struct.
Nov 12 2012