Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > perl module for context grammar?

Reply
Thread Tools

perl module for context grammar?

 
 
ela
Guest
Posts: n/a
 
      09-30-2011
While there is another perl module that deals with the following complex
structure,

(((((((R1441:65.00000000,X29:44.66666667):42.33333 333,(R1842:3.00000000,R1909:9.00000000):1.33333333 ):1.33333333,(R1390:13.00000000,R1505:8.00000000): 2.33333333):4.00000000,X122:4.66666667):25.3333333 3,((CCDC5180:23.00000000,HN878:22.00000000):10.000 00000,(CCDC5079:28.00000000,(BT1:28.00000000,BT2:3 6.00000000):1.00000000):20.00000000):0.00000000):1 .00000000,BS1:12.00000000):45.00000000,(R1207:9.00 000000,(R1746:40.00000000,((X132:0.00000000,X28:0. 00000000):6.50000000,(X156:67.83333333,X85:51.8333 3333):52.33333333):3.50000000):4.00000000):62.0000 0000,(kzn4207:6.00000000,(kznR506:3.00000000,kznV2 475:2.00000000):8.00000000):245.00000000);

the module does not have the function I need. Is there any standard perl
module that can allocate the nodes in a hierarchical tree structure (e.g.
R1441 and X29 are in the same sub-group, and then this sub-group is under
the same super-group with the subgroup formed by R1842-R1909);
after forming this hierarchical structure, distances between any nodes can
be easily derived (e.g. the distance of R1441 and X29 is 65+44.67, R1441 and
R1842 is (65+42.3) + (3+1.3), you can see that if the subgroups are further
apart, they have to trace more upper level to derive the pairwise distance).
Another derivation is about intermediate nodes. For example, the distance
between subgroup R1441-X29 and end node R1909 is 42.3+ (9+1.3)



 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      09-30-2011
In article <j64bek$rb4$>, ela
<> wrote:

> While there is another perl module that deals with the following complex
> structure,
>
>
> (((((((R1441:65.00000000,X29:44.66666667):42.33333 333,(R1842:3.00000000,R1909:
> 9.00000000):1.33333333):1.33333333,(R1390:13.00000 000,R1505:8.00000000):2.3333
> 3333):4.00000000,X122:4.66666667):25.33333333,((CC DC5180:23.00000000,HN878:22.
> 00000000):10.00000000,(CCDC5079:28.00000000,(BT1:2 8.00000000,BT2:36.00000000):
> 1.00000000):20.00000000):0.00000000):1.00000000,BS 1:12.00000000):45.00000000,(
> R1207:9.00000000,(R1746:40.00000000,((X132:0.00000 000,X28:0.00000000):6.500000
> 00,(X156:67.83333333,X85:51.83333333):52.33333333) :3.50000000):4.00000000):62.
> 00000000,(kzn4207:6.00000000,(kznR506:3.00000000,k znV2475:2.00000000):8.000000
> 00):245.00000000);
>
> the module does not have the function I need. Is there any standard perl
> module that can allocate the nodes in a hierarchical tree structure (e.g.
> R1441 and X29 are in the same sub-group, and then this sub-group is under
> the same super-group with the subgroup formed by R1842-R1909);
> after forming this hierarchical structure, distances between any nodes can
> be easily derived (e.g. the distance of R1441 and X29 is 65+44.67, R1441 and
> R1842 is (65+42.3) + (3+1.3), you can see that if the subgroups are further
> apart, they have to trace more upper level to derive the pairwise distance).
> Another derivation is about intermediate nodes. For example, the distance
> between subgroup R1441-X29 and end node R1909 is 42.3+ (9+1.3)


I would recommend the book "Pro Perl Parsing", by Christopher M. Frenz,
Apress, and the module Parse::RecDescent (but the latter has a steep
learning curve).

--
Jim Gibson
 
Reply With Quote
 
 
 
 
Keith Keller
Guest
Posts: n/a
 
      09-30-2011
On 2011-09-30, ela <> wrote:
> While there is another perl module that deals with the following complex
> structure,
>
> (((((((R1441:65.00000000,X29:44.66666667):42.33333 333,(R1842:3.00000000,R1909:9.00000000):1.33333333 ):1.33333333,(R1390:13.00000000,R1505:8.00000000): 2.33333333):4.00000000,X122:4.66666667):25.3333333 3,((CCDC5180:23.00000000,HN878:22.00000000):10.000 00000,(CCDC5079:28.00000000,(BT1:28.00000000,BT2:3 6.00000000):1.00000000):20.00000000):0.00000000):1 .00000000,BS1:12.00000000):45.00000000,(R1207:9.00 000000,(R1746:40.00000000,((X132:0.00000000,X28:0. 00000000):6.50000000,(X156:67.83333333,X85:51.8333 3333):52.33333333):3.50000000):4.00000000):62.0000 0000,(kzn4207:6.00000000,(kznR506:3.00000000,kznV2 475:2.00000000):8.00000000):245.00000000);
>
> the module does not have the function I need.


You don't mention what module you're using. If that's a Newick format,
have you looked at the Bioperl Bio::Tree modules?

--keith


--
kkeller-
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

 
Reply With Quote
 
ela
Guest
Posts: n/a
 
      09-30-2011

"Keith Keller" <kkeller-> wrote in message
news:...
> You don't mention what module you're using. If that's a Newick format,
> have you looked at the Bioperl Bio::Tree modules?


While this module contains functions like "get_lca" to check supergroup,
there is no further documentation how the distance from this supergroup with
other nodes can be obtained. Moreover, the data structure is encapsulated
and so while there is another function called "is_monophyletic", I cannot
actually trace back hierarchically from the leaf to get more "nearest
neighbor" nodes but have to exhaust all the nodes and derive the relation
(or hierarchy) myself. That's why I posted a question here to see if
standard Perl modules have dealt with this.


 
Reply With Quote
 
ela
Guest
Posts: n/a
 
      09-30-2011

"Jim Gibson" <> wrote in message
news:300920110932542310%...
> I would recommend the book "Pro Perl Parsing", by Christopher M. Frenz,
> Apress, and the module Parse::RecDescent (but the latter has a steep
> learning curve).


Oh, it's CHAPTER 5 Performing Recursive-Descent Parsing with
Parse::RecDescent . . . I guess the module actually uses this. Let me read
that first and thanks for telling me this kind of problem is called
"recursive decent parsing"!


 
Reply With Quote
 
sln@netherlands.com
Guest
Posts: n/a
 
      10-01-2011
On Fri, 30 Sep 2011 20:07:28 +0800, "ela" <> wrote:

>While there is another perl module that deals with the following complex
>structure,
>
>(((((((R1441:65.00000000,X29:44.66666667):42.3333 3333,(R1842:3 ...
>


Formatting the structure goes a long way.
(

(

(

(

(

(

(
R1441 : 65.00000000 ,
X29 : 44.66666667

) : 42.33333333 ,

(
R1842 : 3.00000000 ,
R1909 : 9.00000000

) : 1.33333333

) : 1.33333333 ,

(
R1390 : 13.00000000 ,
R1505 : 8.00000000

) : 2.33333333

) : 4.00000000 ,
X122 : 4.66666667

) : 25.33333333 ,

(

(
CCDC5180 : 23.00000000 ,
HN878 : 22.00000000

) : 10.00000000 ,

(
CCDC5079 : 28.00000000 ,

(
BT1 : 28.00000000 ,
BT2 : 36.00000000

) : 1.00000000

) : 20.00000000

) : 0.00000000

) : 1.00000000 ,
BS1 : 12.00000000

) : 45.00000000 ,

(
R1207 : 9.00000000 ,

(
R1746 : 40.00000000 ,

(

(
X132 : 0.00000000 ,
X28 : 0.00000000

) : 6.50000000 ,

(
X156 : 67.83333333 ,
X85 : 51.83333333

) : 52.33333333

) : 3.50000000

) : 4.00000000

) : 62.00000000 ,

(
kzn4207 : 6.00000000 ,

(
kznR506 : 3.00000000 ,
kznV2475 : 2.00000000

) : 8.00000000

) : 245.00000000

)
 
Reply With Quote
 
Ted Zlatanov
Guest
Posts: n/a
 
      10-01-2011
On Sat, 1 Oct 2011 05:28:53 +0800 "ela" <> wrote:

e> "Jim Gibson" <> wrote in message
e> news:300920110932542310%...
>> I would recommend the book "Pro Perl Parsing", by Christopher M. Frenz,
>> Apress, and the module Parse::RecDescent (but the latter has a steep
>> learning curve).


e> Oh, it's CHAPTER 5 Performing Recursive-Descent Parsing with
e> Parse::RecDescent . . . I guess the module actually uses this. Let me read
e> that first and thanks for telling me this kind of problem is called
e> "recursive decent parsing"!

No, the problem is how to parse, the solution (algorithm) is recursive
descent (not "decent" although it is decent for most problems

There are actually many types and subtypes of parsers with many, many
applications. The one you're describing is fairly simple, but if
Bioperl has a parser for it already, just look inside the module and see
if you can augment it with the functions you need. It sounds like this
distance is a pretty basic function, so you should be able to either
write it yourself or ask the module maintainers for help.

Ted
 
Reply With Quote
 
ela
Guest
Posts: n/a
 
      10-01-2011

"Ted Zlatanov" <> wrote in message
news:...
> No, the problem is how to parse, the solution (algorithm) is recursive
> descent (not "decent" although it is decent for most problems


Thanks for correcting the typo.

>
> There are actually many types and subtypes of parsers with many, many
> applications. The one you're describing is fairly simple, but if
> Bioperl has a parser for it already, just look inside the module and see
> if you can augment it with the functions you need. It sounds like this
> distance is a pretty basic function, so you should be able to either
> write it yourself or ask the module maintainers for help.


Oh, I haven't thought about asking the original module maintainers for
advice. Thanks a lot!


 
Reply With Quote
 
Ted Zlatanov
Guest
Posts: n/a
 
      10-02-2011
On Sat, 1 Oct 2011 22:19:52 +0800 "ela" <> wrote:

e> "Ted Zlatanov" <> wrote in message
e> news:...
>> No, the problem is how to parse, the solution (algorithm) is recursive
>> descent (not "decent" although it is decent for most problems


e> Thanks for correcting the typo.

Sure, the "descent" part is actually pretty interesting if you're ever
curious about parsing. I recommend "Parsing Techniques: A Practical
Guide" by Grune and Jacobs; at least the first few chapters are easy to
understand and introduce parsing well. It's free on the authors' web site.

Ted
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I evaluate a module with another module's context? dblock Ruby 1 07-22-2011 03:03 PM
return HttpStatusCode.ServiceUnavailable in the context.context.Response.StatusCode (Http response code 503) Flip Rayner ASP .Net 1 01-23-2007 06:35 AM
How to retrieve a session Bean in the Context in a class with the Context reference asd Java 1 11-09-2006 05:00 PM
Strange Context Error: Context 0x197ee0 is disconnected in VS 2005 =?Utf-8?B?U3VuU21pbGU=?= ASP .Net 0 01-10-2006 03:59 PM
Context.Items vs Context.Handler (passing values between pages) VS_NET_DEV ASP .Net 2 05-25-2004 01:16 PM



Advertisments