fixed list combinatorics

2007-11-28 Thread Dan Klose
Hi list,

I am having a bad day and would really like some help (the coffee hasn't).

I have a list that looks like:
my @list = (1,2,3,4);

I would like to generate all patterns that follow:
1
 2
 3
  4
12
123
 23
 34
 234
1234


The list can be of any length and the next number in the list must be the
current number +1 ( i am not working with numbers - i think it is easier to
explain this way).

How do I do this?  I did look at the Combinatorics module however it does
not impose fixed ordering as far as I can see.

Thanks


Re: fixed list combinatorics

2007-11-28 Thread Dan Klose
Thanks for your help.

On Nov 28, 2007 3:51 PM, Andrew Curry <[EMAIL PROTECTED]> wrote:

> Or a better one for none numeric's would be : I think.
>
> use strict;
> my ( @list, @comb );
>
> @list = ( 'A', 'B', 'C', 'D' );
>
> combinations( [EMAIL PROTECTED], [EMAIL PROTECTED] );
>
> print join ( "\n", @comb );
>
> sub combinations {
>my ( $list, $comb ) = @_;
>my ( $key, $i, $x, $line, @comb, $n );
>$n = 1;
>foreach my $key ( @{$list} ) {
>$line = $key;
>push ( @{$comb}, $line );
>
>for ( my $i = $n ; $i <= $#list ; $i++ ) {
>$line .= $list->[$i];
>push ( @{$comb}, $line );
>}
>$n++;
>}
> }
>
> If this indeed what your asking.
>
> A
> AB
> ABC
> ABCD
> B
> BC
> BCD
> C
> CD
> D
>
> -Original Message-
> From: Andrew Curry [mailto:[EMAIL PROTECTED]
> Sent: 28 November 2007 15:43
> To: Dan Klose; beginners@perl.org
> Subject: RE: fixed list combinatorics
>
> Not sure this exactly what you want but
>
> use strict;
> my ( @list, @comb );
>
> @list = ( 1, 2, 3, 4 );
>
> combinations( [EMAIL PROTECTED], [EMAIL PROTECTED] );
>
> print join ( "\n", @comb );
>
> sub combinations {
>my ( $list, $comb ) = @_;
>my ( $key, $i, $x, $line, @comb );
>
>foreach my $key ( @{$list} ) {
>$line = $key;
>push ( @{$comb}, $line );
>
>for ( my $i = $key ; $i <= $#list ; $i++ ) {
>$line .= $list->[$i];
>push ( @{$comb}, $line );
>}
>}
> }
>
> Runs and returns
>
> 1
> 12
> 123
> 1234
> 2
> 23
> 234
> 3
> 34
> 4
>
> -Original Message-
> From: Dan Klose [mailto:[EMAIL PROTECTED]
> Sent: 28 November 2007 14:32
> To: beginners@perl.org
> Subject: fixed list combinatorics
>
> Hi list,
>
> I am having a bad day and would really like some help (the coffee hasn't).
>
> I have a list that looks like:
> my @list = (1,2,3,4);
>
> I would like to generate all patterns that follow:
> 1
>  2
>  3
>  4
> 12
> 123
>  23
>  34
>  234
> 1234
>
>
> The list can be of any length and the next number in the list must be the
> current number +1 ( i am not working with numbers - i think it is easier
> to
> explain this way).
>
> How do I do this?  I did look at the Combinatorics module however it does
> not impose fixed ordering as far as I can see.
>
> Thanks
>
>
> This e-mail is from the PA Group.  For more information, see
> www.thepagroup.com.
>
> This e-mail may contain confidential information.  Only the addressee is
> permitted to read, copy, distribute or otherwise use this email or any
> attachments.  If you have received it in error, please contact the sender
> immediately.  Any opinion expressed in this e-mail is personal to the
> sender
> and may not reflect the opinion of the PA Group.
>
> Any e-mail reply to this address may be subject to interception or
> monitoring for operational reasons or for lawful business practices.
>
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
> This e-mail is from the PA Group.  For more information, see
> www.thepagroup.com.
>
> This e-mail may contain confidential information.  Only the addressee is
> permitted to read, copy, distribute or otherwise use this email or any
> attachments.  If you have received it in error, please contact the sender
> immediately.  Any opinion expressed in this e-mail is personal to the
> sender
> and may not reflect the opinion of the PA Group.
>
> Any e-mail reply to this address may be subject to interception or
> monitoring for operational reasons or for lawful business practices.
>
>
>
>
>


Re: fixed list combinatorics

2007-11-28 Thread Dan Klose

yeah sorry, I should have posted.

Thanks all for the solutions.  Next time I will post if I get a  
solution to the problem.


On 28 Nov 2007, at 19:58, yitzle wrote:


In a personal email conversation, he realized what he was actually
looking for is the power set.
List::PowerSet
http://search.cpan.org/~nikc/List-PowerSet-0.01/lib/List/PowerSet.pm

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Use of uninitialized value in numeric ne error

2007-12-21 Thread Dan Klose

On 21 Dec 2007, at 10:43, lerameur wrote:


Hello and cheers to all,


hello



I wrote a small program and it does work, but I get this error message
every tim I run the script:
Use of uninitialized value in numeric ne (!=) at ./reverse_string.pl
line 11.
basically it is a menu and when the user type 99 as a choice,  the
program ends



if like is a string the you can't do != as it is a numerical comparison


line 11 is:
while ( $line != 99){


more of the script would be handy - as it looks (at a quick glance)  
as if $line is null.




thanks
ken


Dan.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




\n & ^M

2005-06-22 Thread Dan Klose
Hi everybody,

I have exported an EndNote 7 Library on my Mac to a Bibtex formatted
plain text file.  When I look at the file, rather than having lines
ending with '\n' I seem to have '^M'. I think this is a Mac end of line
problem but the things I have tried don't work and I was wondering if
anyone had any ideas/bits of code to get round this.

Thanks

Dan.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: how to append blocks in same file

2005-06-22 Thread Dan Klose
If I was doing this I would split the file on the gaps between blocks
and the use the unix paste function to assemble the blocks.

&>  paste A B C > D

? using a hash of arrays (HOA) to store each block and then go back over
the HOA each element at a time ... although this is probably overkill?

On Wed, 2005-06-22 at 09:10 -0500, Larsen, Errin M HMMA/IT wrote:
> Aditi Gupta wrote:
> > Hi Perlers,
> > 
> > I have a file as follows:
> > 
> > #block1
> > aaa
> > aaa
> > 
> > #block2
> > bbb
> > bbb
> > 
> > #block3
> > ccc
> > ccc
> > 
> > and i want to append(or i should say merge) these blocks and get a
> > file like this:
> > 
> > aaabbbccc
> > aaabbbccc
> > 
> > how can this be done using perl?
> > please help..
> > 
> > regards
> > Aditi
> 
> Hi,
> 
> That looks like a fun and challenging problem.  I bet Perl would be good
> at that.
> 
> Have you tried any Perl code yet?
> 
> This list works best when you present us some code you have tried that
> is not working.  Then, we can help you fix it.  There are many on the
> list who would be happy to write code for you for a reasonable fee,
> however.  Is that what you are looking for?
> 
> --Errin
> 
-- 
Daniel Klose
Mathematical Biology
NIMR
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: how to append blocks in same file

2005-06-22 Thread Dan Klose

> Using a hash of arrays will not necessarily preserve the order...

If you don't want to worry about sorting the order of the blocks i.e.
doing it yourself then use Tie::IXhash (something like that on CPAN) to
preserve the order, you then don't have to worry about unbalanced blocks
and reassembly by applying an if defined type block. Easy.

Dan

> 
> Using a hash of arrays will not necessarily preserve the order. Below
> is the start of an array of arrays solution. I'll leave handling
> unbalanced blocks and reassembling the pieces as an exercise for the
> reader.
> 
> my @blocks = ();
> my $maxlen = 0;
> while () {
> chomp;
> if (/^#/) {
> push @blocks, [];
> } elsif ($_) {
> push @{$blocks[$#blocks]}, $_;
> my $len = $#{$blocks[$#blocks]};
> $maxlen = $len if $len > $maxlen;
> }
> }
> 
> __DATA__
> #block1
> aaa
> ddd
> 
> #block2
> bbb
> eee
> 
> #block3
> ccc
> fff
> 
-- 
Daniel Klose
Mathematical Biology
NIMR
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




A better way.

2005-08-02 Thread Dan Klose
Hello Everyone.

I have the following code:


### CODE BLOCK ###

my %hash_of_arrays2;

for (keys %hash_of_arrays) {
  my @array_of_data = exists($hash_of_arrays{$_})
[EMAIL PROTECTED]
  :();

  my $mean = mean([EMAIL PROTECTED]); #GET MEAN
  my $std_dev = dev([EMAIL PROTECTED]); #GET STANDARD DEV

  push @{$hash_of_arrays2{$_}}, $mean;
  push @{$hash_of_arrays2{$_}}, $std_dev;
}

for (sort {$hash_of_arrays2{$a}[0] <=> $hash_of_arrays2{$b}[0]} 
 keys %hash_of_arrays2) {

  print "$_, $hash_of_arrays2{$_}[0], $hash_of_arrays2{$_}[1]\n";
}

### END OF CODE ###

If anyone has the time could you please show me ways of shortening this
code e.g. eliminating the second for block (integration into the
previous block) and any other tips / tricks.

There are no other people here that code perl and so I get no
advice/feedback on how to improve my scripts.

Thanks in advance.

Dan.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: A better way.

2005-08-02 Thread Dan Klose
Hi,

I have gone for the following code:

my %avs_dev = map{
  $_ => [mean($hoa{$_}), dev($hoa{$_})]
} keys %hoa;

for (sort {$avs_dev{$a}[0] <=> $avs_dev{$b}[0]} keys %avs_dev) {
  print "$_, $avs_dev{$_}[0], $avs_dev{$_}[1]\n";
}

I have never used MAP before... it looks handy!
Works a treat.

Thanks to Jeff 'japhy' Pinyan & Wiggins d'Anconia


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




open file for read and append

2005-08-23 Thread Dan Klose

Hello,

I have a script where I need to open a file, read from it sequentially,
and append items to the file as I go along, continuing to read these
items as I go. But seems I can't open the file for read and append at
the same time. Does anyone have any ideas?

Many thanks.

-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Looking for perl scripts to remove ^M

2005-09-25 Thread Dan Klose
On 9/23/05, Jay Savage <[EMAIL PROTECTED]> wrote:
>
> On 9/23/05, Ryan Frantz <[EMAIL PROTECTED]> wrote:
> >
> >
> > > -Original Message-
> > > From: Ankur Gupta [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, September 23, 2005 2:48 PM
> > > To: Dave Adams
> > > Cc: beginners perl
> > > Subject: Re: Looking for perl scripts to remove ^M
> > >
> > > On 9/23/2005 11:28 PM Dave Adams wrote:
> > >
> > > > Sometimes I get perl scripts that were developed on windows and then
> > > > brought over to UNIX and the scripts contain all the pesky
> > > > metacharacters of ^M and excessive blank lines.
> > > >
> > > > Does anyone have a simple script to clean these files up or
> > suggestions?
> > >
> > > If you are using vi/vim as your editor then this is the good way to
> > deal
> > > with it..
> > >
> > > :%s/.$//
> >
> > This could also remove _any_ single characters just before the EOL that
> > aren't ^M. I know it's rare, but I've come across half-DOS, half-UNIX
> > text files like this where some EOLs had the DOS EOL char and some
> > didn't (I have no idea why other than someone was previously trying to
> > remove them...).
> >
> > >
> > > will remove the last *pesky* character(^M) from all lines
> > >
> > > But as Chris said, did you try anything so far...
> > >
> > > --
> > > Ankur
> > >
>
> Yeah, I've come across some weird encoding things, too. I've also run
> across situations where not all the returns were interpreted as EOL so
> 1) /\r$/ didn't match and 2) there were multiple ^M per line, so I
> needed /g anyway. I've become pretty fond of 's/[\r\f\n]+/\n/'. Note,
> though, that you'll lose double spacing that way.
>
> Probably hte best way to handle it is to open the input stream on DOS
> files :crlf, as in 'open(FH, "<:crlf", "dosfile")', and let perlio
> worry about it for you.
>
> HTH,
>
> -- jay


Hello,

remove the last *pesky* character(^M)

I posted something like this ages ago, I imported an EndNote Library and it
was populated with ^M(s).

Xavier Noria suggested using:
perl -pi -we 's/\015//g' filename
Which worked.

Hope that is of some use.

Dan.


Re: the time a program runs

2005-09-26 Thread Dan Klose
On Mon, 2005-09-26 at 06:32 -0400, Tom Allison wrote:
> Octavian Rasnita wrote:
> > Hi,
> > 
> > I have tried to find out the time a perl program runs, and I have used:
> > 
> > #at the start of the program:
> > my $begin = (times)[0];
> > my $begin_t = time();
> > 
> > ... The program follows
> > 
> > # at the end of the program:
> > my $end = (times)[0] - $begin;
> > my $end_t = time() - $begin_t;
> > print "end: $end\nEnd_t: $end_t\n";
> > 
> > After running the program, it prints:
> > 
> > end: 4.953
> > End_t: 19
> > 
> > Why does this difference appear?
> > 
> > 
> > The program is a very short one, for testing the speed of Storable module.
> > 
> 
> Try this:
> 
> The global var $^T stores the time of execution start.
> So at the end you want:
> 
> print (time() - $^T) , " seconds to complete\n";
> 
> However, if you want more accuracy then you might consider Time::HiRes 
> or better yet Benchmark.  Benchmark is a very useful tool.
> 
Hi,

If you are on a *nix system you can do:
time ./my-script.pl
and you get:
real0m3.562s
user0m2.201s
sys 0m0.017s

What is the advantage of using something in the perl script (Time::HiRes
|| the $^T) ?

Thanks.

Dan.


--


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: how to make charts using GD

2005-09-28 Thread Dan Klose


On Wed, 2005-09-28 at 08:10 +0200, Thomas Bätzler wrote:
> Hello,
>  
> Aditi Gupta <[EMAIL PROTECTED]> asked:
> >  I have a perl code that generates a sequence of values which 
> > i want to plot on y-axis against 1,2,3... on x-axis. I've 
> > read that GD::Graph could be used for it. But I've never done 
> > modular programming. Also, I don't know how to install 
> > modules from CPAN.
> > Are there any other easier methods for drawing charts using perl?
> 
> Well, you could always use an external program like gnuplot
> to generate the graph for you. That would still require that
> you understand how to use the program, though.
> 
Hello,

GD::Graph is very simple to use, just check out the CPAN documents.

If you want to use gnuplot, try the following little c shell script.

set data = $argv[1]
gnuplot < And don't be afraid to use Perl modules. Many important modules
> are already part of your Perl distribution, so you would not
> have to install them manually, anyways. As for the rest, I'm sure
> people here will be able to give you some pointers if you
> provide some details like OS and distribution used, and so on.
> 
> HTH,
> Thomas
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: regd. executing one perl file inside another perl file

2005-10-04 Thread Dan Klose
On Tue, 2005-10-04 at 15:31 +0530, [EMAIL PROTECTED] wrote:
> Hi perlers
> 
> 

Hello.

> I have one query regarding how to execute one perl file with in the 
> another perl file.
> The problem is like this I have to do 2-3 tasks by running 2-3 perl script 
> for each task ... in some order
> say, for first order I have to run one perl file which give me one output 
> file in text format.
> And for the next task this test file generated is fed as input then it 
> generates one more text file. then for the task 3 the text file generated 
> by task 2 file is made to input and then it genearates some text 
> fileand so on..
> 
> So in the nut shell I want to do all this task by executing only one perl 
> file...
> which will call all the perl file in the order in which i 
> need..
> So could u plz tellme is there any function thriugh which I can do this 
> way.
> 

yes.

see the perl system command.

#!/usr/bin/perl

use warnings;
use diagnostics;
use strict;

`./perl_script1`;
`./perl_script2`;
system("./perl script3") || die "blah blah blah $!"; #NOT SURE IF THE
LOGIC HERE IS REVERSED I DON'T USE IT AT ALL YOU CAN FIND THAT OUT.
exec("./final.pl");



this assumes you hard code the output of script1 as input to script2 and
script2 to script3.

Oh also I haven't tested this and I don't use windows, but it might work
on linux and with minor mods on windows.


> Will the execute() funtion solve the purpose .which we 
> use in DBI etc.

I don't think so.

I think your . button maybe stuck!


HTH


Dan.
> 
> 
> thankX
> 
> n
> With warm regards
> 
> 
> 
> 
> Mayank Ahuja
> Team Member
> Tata Consultancy Services Limited
> Ph:- 044-5816
> Cell:- 9283199460
> Mailto: [EMAIL PROTECTED]
> Website: http://www.tcs.com
> 
> Notice: The information contained in this e-mail message and/or attachments 
> to it may contain confidential or privileged information.   If you are not 
> the intended recipient, any dissemination, use, review, distribution, 
> printing or copying of the information contained in this e-mail message 
> and/or attachments to it are strictly prohibited.   If you have received this 
> communication in error, please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message and any attachments.  Thank you



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: regd. executing one perl file inside another perl file

2005-10-04 Thread Dan Klose
On Tue, 2005-10-04 at 19:55 +0530, [EMAIL PROTECTED] wrote:
> Hi Dan
> Could u plz elaborate ur logic in detail I think it might work..
> Mayank Ahuja



Hi Mayank,

You really need to work this out for yourself.  You should try and
submit some code so that people can correct you rather than write your
script for you. 

Read perldoc -f system.

Example:

If I have a script, in my case on my linux machine, and I want to run
that script using another script then I use the `` however you can use:

#!/usr/bin/perl

system("./my-script ")

where  is the file you feed the script.
You also need to look at the logic for catching any errors, for
instance:
open(FILE, $file) || die "Error: $file: $!\n";
I am not sure if the logic reverses for system calls (I can't think why
I think that but I do!).

So if you want to make a wrapper for you programs then make sure you
either hard code the output of your first program as the input to your
next, else you need to make your program accept a file or whatever on
the command line using the @ARGV setup.

#!/usr/bin/perl

`./my_script1 input1`;
`./my_script2 output_of_script_1`;
`./my_script3 output_of_script_2`;

As I said earlier I am not sure if the backticks (``) work on a win
machine so you may have to use the system command above.

I am sure there are probably numerous ways of doing this some better
than I have suggested, if you have a better way please tell me!

Thanks

Dan.


> Team Member
> Tata Consultancy Services Limited
> Ph:- 044-5816
> Cell:- 9283199460
> Mailto: [EMAIL PROTECTED]
> Website: http://www.tcs.com
> Dan Klose <[EMAIL PROTECTED]>
> 10/04/2005 07:31 PM
> To
> [EMAIL PROTECTED]
> cc
> beginners@perl.org
> Subject
> Re: regd. executing one perl file inside another perl file
> On Tue, 2005-10-04 at 15:31 +0530, [EMAIL PROTECTED] wrote:
> > Hi perlers
> >
> >
> Hello.
> > I have one query regarding how to execute one perl file with in the
> > another perl file.
> > The problem is like this I have to do 2-3 tasks by running 2-3 perl script
> > for each task ... in some order
> > say, for first order I have to run one perl file which give me one output
> > file in text format.
> > And for the next task this test file generated is fed as input then it
> > generates one more text file. then for the task 3 the text file generated
> > by task 2 file is made to input and then it genearates some text
> > fileand so on..
> >
> > So in the nut shell I want to do all this task by executing only one perl
> > file...
> > which will call all the perl file in the order in which i
> > need..
> > So could u plz tellme is there any function thriugh which I can do this
> > way.
> >
> yes.
> see the perl system command.
> #!/usr/bin/perl
> use warnings;
> use diagnostics;
> use strict;
> `./perl_script1`;
> `./perl_script2`;
> system("./perl script3") || die "blah blah blah $!"; #NOT SURE IF THE
> LOGIC HERE IS REVERSED I DON'T USE IT AT ALL YOU CAN FIND THAT OUT.
> exec("./final.pl");
> this assumes you hard code the output of script1 as input to script2 and
> script2 to script3.
> Oh also I haven't tested this and I don't use windows, but it might work
> on linux and with minor mods on windows.
> > Will the execute() funtion solve the purpose .which we
> > use in DBI etc.
> I don't think so.
> I think your . button maybe stuck!
> HTH
> Dan.
> >
> >
> > thankX
> >
> > n
> > With warm regards
> >
> >
> >
> >
> > Mayank Ahuja
> > Team Member
> > Tata Consultancy Services Limited
> > Ph:- 044-5816
> > Cell:- 9283199460
> > Mailto: [EMAIL PROTECTED]
> > Website: http://www.tcs.com
> >
> > Notice: The information contained in this e-mail message and/or attachments 
> > to it may contain confidential or privileged information.  If you are not 
> > the intended recipient, any dissemination, use, review, distribution, 
> > printing or copying of the information contained in this e-mail message 
> > and/or attachments to it are strictly prohibited.  If you have received 
> > this communication in error, please notify us by reply e-mail or telephone 
> > and immediately and permanently delete the message and any attachments. 
> > Thank you
> ForwardSourceID:NTB782  
> Notice: The information contained in this e-mail message and/or attachments 
> to it may contain confidential or privileged information. If you are not the 
> intended recipient, any diss

Re: problem with GD

2005-10-07 Thread Dan Klose
On Fri, 2005-10-07 at 03:55 -0700, Aditi Gupta wrote:
> Hello everybody,
>  I've tried installing GD for Activestate Perl on a Windows XP system. I've
> downloaded the module from CPAN. But the module contains GD.xs file and
> hence I've to build it myself. I used C compiler but it is giving many
> errors and most of them are not being able to locate perl.h, extern.h,
> xsub.h etc. What should I do? Please help.

I remember doing this on my XP machine ages ago.  Have you tried using
the perl packet manager?  I had no problems using active state and PPM!

If you haven't tried PPM it should be in your start menu under
activestate perl.

Dan.

>  Thanks in advance,
> with regards
> Aditi


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




HOA idiocy.

2005-10-10 Thread Dan Klose
Hello list.

I have a hash of arrays but when I come to run the script I get the
following error:

Odd number of elements in hash assignment at ./all2seq.pl line 15.

I can't for the life of me work out why I am getting this error!
I have never hand written a HOA and so I have tried this:

my %properties = (
  "aliphatic" => qw[I L V],
  "aromatics" => qw[F Y W H],
  "phobic" => qw[I L V M C F Y W H K T G A],
  "charged" => qw[H K R E D],
  "polar" => qw[Y W H K R E D Q N S C T],
  "positive" => qw[R K H],
  "small" => qw[V P A G C S N D T],
  "tiny" => qw[G A C S],
);

I have tried with and without the "" on the keys.  This is probably
something very trivial but I just can't work out what it is.

If someone could make the pain go away that would be great.

Thanks and apologies.

Dan.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




automatically submitting web forms.

2005-10-11 Thread Dan Klose
Hello List,

I would like to be able to automagically submit a form to a server.  The
server requires that I give it a sequence of letters (a protein) in one
box, my email, and select several radio buttons to my chosen output.  In
this case the server is PSIPRED protein structure prediction server @
ucl.  I have no idea how to go about doing this and was wondering if
someone would be kind enough to point me in the right direction (a book
web site etc).  I guess POST or something like that?

Thanks.

Dan.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: automatically submitting web forms.

2005-10-11 Thread Dan Klose
On Tue, 2005-10-11 at 16:44 +0200, Xavier Noria wrote:
> On Oct 11, 2005, at 16:23, Dan Klose wrote:
> 
> > I would like to be able to automagically submit a form to a  
> > server.  The
> > server requires that I give it a sequence of letters (a protein) in  
> > one
> > box, my email, and select several radio buttons to my chosen  
> > output.  In
> > this case the server is PSIPRED protein structure prediction server @
> > ucl.  I have no idea how to go about doing this and was wondering if
> > someone would be kind enough to point me in the right direction (a  
> > book
> > web site etc).  I guess POST or something like that?
> 
> Have a look at WWW::Mechanize.
> 
Hi,

Thanks for your suggestions.  I am going to give it a try...
However there is another way I am also going for.  If you have lynx you
can use:

lynx =cmd_log=FOO to make a series of commands for a page.

you can then use:

lynx -cmd_script=FOO

to rerun that submission.

Thanks again.

Dan.

> -- fxn
> 
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: automatically submitting web forms.

2005-10-11 Thread Dan Klose
On Tue, 2005-10-11 at 17:47 +0200, Xavier Noria wrote:
> On Oct 11, 2005, at 17:27, Dan Klose wrote:
> 
> > Thanks for your suggestions.  I am going to give it a try...
> > However there is another way I am also going for.  If you have lynx  
> > you
> > can use:
> >
> > lynx =cmd_log=FOO to make a series of commands for a page.
> >
> > you can then use:
> >
> > lynx -cmd_script=FOO
> 
> Interesting, looks like a hack compared to using WWW::Mechanize, but  
> it's your choice.

It is a hack... but I just wanted it done quickly (five minutes ago). I
will use WWW::Mechanize as I will have to do this for several web tools
and this approach is too slack!

> Is there a way to pass parameters to the -cmd_script run to override  
> previous form values? Or do you need to edit it?
> 

As far as I am aware (not very) no, I just did an edit  All I did
was open lyxn on that page with the key logging, then wrote a script to
change my protein sequence each time.

> -- fxn
> 
> 
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: EAR file

2005-10-13 Thread Dan Klose
On Thu, 2005-10-13 at 07:59 -0400, Pant, Hridyesh wrote:
> Hi,

Hello.

> I have on ear file,I want to extract this ear file and need to changed
> some text data in files inside this ear file.could anybody help me..

Yes.

To give Mr Devers a break from typing:

"Show us some code..."

You should submit some code for the list to look at, make changes to and
offer advice.  People have their own coding to do and probably don't
want to do yours too unless you wish to make a small donation.

You need to be more specific about what you wish to change.


Dan.

> 
> Regards
> Hridyesh



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: do I need further modules?

2005-10-17 Thread Dan Klose
On Mon, 2005-10-17 at 18:12 +0200, Richard Müller wrote:
> Hello,
> I want to use Tk::jpeg::lite. I have a standard SuSE 9.2 (perl 5.8.5) 
> installation and I have added every package which even smells like Perl, also 
> Perl Tk. When compiling Tk::jpeg::lite  (perl Makefile.PL)  I get the 
> following output:
> (I have marked the interesting things)
> 

Hello.

Can't you use YAST, if you are on SUSE, to do all this for you?
Or is that what you have done?

Dan.

> ...
> Checking if your kit is complete...
> Looks good
> Warning: prerequisite Tk 0 not found. 
> !!^^!! (1)
> 
>  Finding dependancies for Lite.xs
>  Finding dependancies for imgJPEG.c
>  Writing Makefile for Tk::JPEG::Lite
> 
> OK, now Make: (it follows the output):
>  cp Lite.pm blib/lib/Tk/JPEG/Lite.pm
>  /usr/bin/perl /usr/lib/perl5/5.8.6/ExtUtils/xsubpp
>  -typemap /usr/lib/perl5/5.8.6/ExtUtils/typemap
>  -typemap
>  /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk/typemap Lite.xs
>  Lite.xsc && mv Lite.xsc Lite.c
>  cc -c  -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk
>  -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE
>  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe
>  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686
>  -fmessage-length=0 -Wall -g -Wall -pipe   -DVERSION=\"2.01403\"
>  -DXS_VERSION=\"800.024\" -fPIC
>  "-I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE"  -DHAVE_JPEGLIB_H
>  -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__
>  Lite.c cc -c  -I/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi/Tk
>  -I/usr/local/include -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE
>  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe
>  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -march=i586 -mcpu=i686
>  -fmessage-length=0 -Wall -g -Wall -pipe   -DVERSION=\"2.01403\"
>  -DXS_VERSION=\"800.024\" -fPIC
>  "-I/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE"  -DHAVE_JPEGLIB_H
>  -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__
> In file included 
> from /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:24,
>  from Lite.xs:13:
> /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/Lang.h:11:22: tkConfig.h: 
> Datei oder Verzeichnis nicht gefunden -->(file or directory not found)
> !!!! ()2)
> In file included from Lite.xs:13:
> /usr/lib/perl5/5.8.5/i586-linux-thread-multi/pTk/tkPort.h:44:35: 
> tkUnixPort.h: 
> Datei oder Verzeichnis nicht gefunden --> (file or directory not found) 
> !!^!!  (2)
> Lite.xs:16:24: pTk/imgInt.h: Datei oder Verzeichnis nicht gefunden
>!!^^!!(2)
> 
> Now my questions:
> 1. What is "prerequisite Tk 0"?
> 2. Where do I get the missing files from directory pTk?
> Thanks for every answer,
> Richard
> 
> 
> -- 
> Richard Müller - Am Spring 9 - D 58802 Balve-Eisborn
> www.oeko-sorpe.de - www.phytoplankton.info
> 
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Help unsubscribing from list

2005-10-17 Thread Dan Klose


NO IDEA - sorry!

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: about running unix command in perl script

2005-10-28 Thread Dan Klose


On Fri, 2005-10-28 at 03:37 -0700, ZHAO, BING wrote:
> Hi,
> Is there a way to run unix command in perl?
> To be specific, for the ftp command:
> 1.ftp ftp.rcsb.org
> 2.cd /pub/pdb/data/structures/divided/pdb/
> 3.cd nx
> 4.get pdb1nxc.ent.Z
> 5.bye
> I need to automate this process to ftp get the file 
> pdb1nxc.ent.Z.
> thank you.
> 
> bing

Hello,

To get PDBs from the PDB!

try this:

#!/usr/bin/perl

#THIS SCRIPT WAS WRITTEN BY JAIME PRILUSKY @ WEIZMANN INSTITUTE

use LWP::Simple;

  my @ids = @ARGV;
  die "\nUsage: $0 PDBid PDBid\n\n" if ($ARGV[0] =~ /^ *$/);

foreach $id (@ids) {
  my $pdbfile = $id . "\.pdb";
  my $status = mirror("http://bip.weizmann.ac.il/oca-bin/save-pdb?$id";,
$pdbfile);
  if (-z $pdbfile) {
print "Unable to retrieve $pdbfile\n";
unlink($pdbfile);
  } else {
print "Retrieved $pdbfile\n";
  }
}

Thanks to Jaime Prilusky. I find this script rather handy.

> 
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to change the Owner of a file

2005-10-31 Thread Dan Klose
On Mon, 2005-10-31 at 13:45 +0530, Rakesh Mishra wrote:
> Hi folks

Hello,

> Can any body tell me how to change the owner of a file ??
> 
> I have written this script ...
> 
> unless (chown $uid , $gid , $filename)
> {
> die "chown failed :$!";
> }
> 
> this code will give me the error you can't change " permission denied "
> can any body tell me , how to over come this error
> 
I think perl runs with the same authority level as the user account you
are using...  If you have permissions to change file ownership then the
script should work.

Have you tried changing the permissions by hand? (Just to see if you
can!)

So if the above assumption is correct and you can't change the
permissions I would check if you can run the script as root or get sudo
accounts.

Hope that is of some use.


DAn,


> bye
> rakesh
-- 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Checking the Machine's Operating System

2005-11-21 Thread Dan Klose
On Mon, 2005-11-21 at 14:16 +0530, Mazhar wrote:
> Hi Folks,
Hello

> I have a requirement from the clinet where in i have to take control of the
> machines (either by telnet,SSH). My first point to be addressed is how can i
> take a remote machine TELNET through perl script and also once i take the
> same i have to check the type of operating system and then find the size of
> the disks partitioned. Waiting for your help at the earliest

I would look at Network Programming with Perl by Lincoln D. Stein.  I
might also have a look at CPAN (search.cpan.org) and search for telnet
and or socket.

Dan.

> 
> Thanks in Advance
> Mazhar
-- 
Daniel Klose
PhD Student - Taylor Group
Mathematical Biology
National Institute for Medical Research
The Ridgeway
Mill Hill
London
NW7 1AA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Open source IDE for Perl

2005-11-30 Thread Dan Klose


> Dear all,
> which is yours "best" open source IDE for Perl. I use SciTE under Linux, 
> but I'm a little confused on Windows. Which do you prefer?
> >>Best, Andrej

I use emacs on Mac, Linux and Windows.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: DBI:ORACLE

2005-12-07 Thread Dan Klose
On Wed, 2005-12-07 at 12:50 +0200, Lorenzo Caggioni wrote:
> HI!!!
Hi
> i'm tring to use DBI module
> 
> Here is the code
> 
> #!/geneva/geneva/dev1/perl5/bin/perl
> #
> 
> use strict;
> use DBI;
> use warnings;
> 
> my $dbh = DBI->connect( 'dbi:Oracle:MYSEED,
> 'donald',
> 'duck',
> {
>   RaiseError => 1,
>   AutoCommit => 0
> }
>   ) or print "Database connection not made: $DBI::errstr
> \n";
> 
> print " \n THE END \n \n";
> 
> If the username and password is correct it works fine, but if they are
> incorrect the program doesn't print the error message and it die...
> 
Can't you just change the 'or print' to the 'or die'?


> What's wrong?
> 
> Thanks
> 
> Lorenzo


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]