combining data from more than one file...

2004-05-17 Thread Michael S. Robeson II
Hi all,
I am having trouble with combining data from several files, and I can't  
even figure out how to get started. So, I am NOT asking for any code  
(though pseudo-code is ok) as I would like to try figuring this problem  
out myself. So, if anyone can give me any references or hints that  
would be great.

So, here is what I am trying to do:
I have say 2 files (I'd like to do this to as many files as the user  
needs):

***FILE 1***
>cat
atacta--gat--acgt-
ac-ac-ggttta-ca--
>dog
atgcgtatgc-atcgat-ac--ac-a-ac-a-cac
>mouse
acagctagc-atgca--
acgtatgctacg--atg-
***end file 1***
***FILE 2***
>mouse
aatctgatcgc-atgca--
acgtaaggctagg-
>cat
atacta--gat--acgt-
ac-acacagcta--ca--
>dog
atgcgtatgc-atcgat
-ac--ac-a-ac-a-cac
***end file 2***
Basically, I would like to concatenate the sequence of each  
corresponding animal so that the various input files would  be out put  
to a file like so:

***output***
>cat
atacta--gat--acgt-ac-ac-ggttta-ca--atacta--gat--acgt-ac-acacagcta--ca--
>dog
atgcgtatgc-atcgat-ac--ac-a-ac-a-cacatgcgtatgc-atcgat-ac--ac-a-ac-a-cac
>mouse
acagctagc-atgca--acgtatgctacg--atg-aatctgatcgc-atgca-- 
acgtaaggctagg-
***output end***

Notice that in the two files the data are not in the same order. So, I  
am trying to figure out how to have the script figure out what the  
first organism is in FILE 1( say "cat" in this case) and find the  
corresponding "cat" in the other input files. Then take the sequence  
data (all the cat data) from FILE 2 and concatenate it to the cat  
sequence data in FILE 1 to an output file. Then it should go on to the  
next organism in FILE 1 and search for that next organism in the other  
files (in this case FILE 2). I do not care about the order of the data,  
only that the "like" data is concatenated together.

Again, I do NOT want this solved for me (unless I am totally lost).  
Otherwise, I'll never learn. I would just like either hints /  
suggestions / pseudo code / even links to books or sites that discuss  
this particular topic. Meanwhile, I am eagerly awaiting my "PERL  
Cookbook" and I'll keep searching the web.

-Thanks!
-Mike

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



Query

2004-05-17 Thread Sudhindra Bhat
Hi

 

I wanted some help on a piece of code that I was writing. Well the
requirement is like this. I have a file whose looks like this

 

(1) Test: 123456 ABCDEF

123456

(2) Results: ABCDEF

 

Now I want my script to output all the contents between the two tags Test
and Results. i.e. 123456 ABCDEF 123456. Can someone help me with this? 

 

Regards,

Sudhindra



Re: Query

2004-05-17 Thread John W . Krahn
On Monday 17 May 2004 03:15, Sudhindra Bhat wrote:
>
> Hi

Hello,

> I wanted some help on a piece of code that I was writing. Well the
> requirement is like this. I have a file whose looks like this
>
> (1) Test: 123456 ABCDEF
>
> 123456
>
> (2) Results: ABCDEF
>
> Now I want my script to output all the contents between the two tags
> Test and Results. i.e. 123456 ABCDEF 123456. Can someone help me with
> this?


while (  ) {
if ( /Test:/ .. /Results:/ and !/Test:/ and !/Results:/ ) {
print
}
}



John
-- 
use Perl;
program
fulfillment

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




combining data from more than one file...

2004-05-17 Thread Michael S. Robeson II
Hi all,
I am having trouble with combining data from several files, and I can't  
even figure out how to get started. So, I am NOT asking for any code  
(though pseudo-code is ok) as I would like to try figuring this problem  
out myself. So, if anyone can give me any references or hints that  
would be great.

So, here is what I am trying to do:
I have say 2 files (I'd like to do this to as many files as the user  
needs):

***FILE 1***
>cat
atacta--gat--acgt-
ac-ac-ggttta-ca--
>dog
atgcgtatgc-atcgat-ac--ac-a-ac-a-cac
>mouse
acagctagc-atgca--
acgtatgctacg--atg-
***end file 1***
***FILE 2***
>mouse
aatctgatcgc-atgca--
acgtaaggctagg-
>cat
atacta--gat--acgt-
ac-acacagcta--ca--
>dog
atgcgtatgc-atcgat
-ac--ac-a-ac-a-cac
***end file 2***
Basically, I would like to concatenate the sequence of each  
corresponding animal so that the various input files would  be out put  
to a file like so:

***output***
>cat
atacta--gat--acgt-ac-ac-ggttta-ca--atacta--gat--acgt-ac-acacagcta--ca--
>dog
atgcgtatgc-atcgat-ac--ac-a-ac-a-cacatgcgtatgc-atcgat-ac--ac-a-ac-a-cac
>mouse
acagctagc-atgca--acgtatgctacg--atg-aatctgatcgc-atgca-- 
acgtaaggctagg-
***output end***

Notice that in the two files the data are not in the same order. So, I  
am trying to figure out how to have the script figure out what the  
first organism is in FILE 1( say "cat" in this case) and find the  
corresponding "cat" in the other input files. Then take the sequence  
data (all the cat data) from FILE 2 and concatenate it to the cat  
sequence data in FILE 1 to an output file. Then it should go on to the  
next organism in FILE 1 and search for that next organism in the other  
files (in this case FILE 2). I do not care about the order of the data,  
only that the "like" data is concatenated together.

Again, I do NOT want this solved for me (unless I am totally lost).  
Otherwise, I'll never learn. I would just like either hints /  
suggestions / pseudo code / even links to books or sites that discuss  
this particular topic. Meanwhile, I am eagerly awaiting my "PERL  
Cookbook" and I'll keep searching the web.

-Thanks!
-Mike

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



Re: combining data from more than one file...

2004-05-17 Thread Ricardo SIGNES
* "Michael S. Robeson II" <[EMAIL PROTECTED]> [2004-05-17T07:47:57]
> I am having trouble with combining data from several files, and I can't  
> even figure out how to get started. So, I am NOT asking for any code  
> (though pseudo-code is ok) as I would like to try figuring this problem  
> out myself. So, if anyone can give me any references or hints that  
> would be great.

One way to solve this problem is to create a hash, in which the keys are
the animal names and the values are the sequences, possibly in an
arrayref, possibly just cat'd together.

So, something like:

  for each file
open the file
for every new animal found
  add all the non-blank lines to $sequences{animal}

Is that clear-ish?

-- 
rjbs


pgpytVlXabRaG.pgp
Description: PGP signature


RE: Query

2004-05-17 Thread Sudhindra Bhat
Hi

Thanks. But there is a small issue. Considering the same example, the piece
of code sent by you prints 123456 which is not on the same line as "Test:"
But it doesn't print the characters 123456 ABCDEF which is on the same line
as "Text:" 

Regards,
Sudhindra

-Original Message-
From: John W.Krahn [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 4:56 PM
To: Perl Beginners
Subject: Re: Query

On Monday 17 May 2004 03:15, Sudhindra Bhat wrote:
>
> Hi

Hello,

> I wanted some help on a piece of code that I was writing. Well the
> requirement is like this. I have a file whose looks like this
>
> (1) Test: 123456 ABCDEF
>
> 123456
>
> (2) Results: ABCDEF
>
> Now I want my script to output all the contents between the two tags
> Test and Results. i.e. 123456 ABCDEF 123456. Can someone help me with
> this?


while (  ) {
if ( /Test:/ .. /Results:/ and !/Test:/ and !/Results:/ ) {
print
}
}



John
-- 
use Perl;
program
fulfillment

-- 
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: combining data from more than one file...

2004-05-17 Thread Traeder, Philipp
> Hi all,

Hi Michael,
> 
> I am having trouble with combining data from several files, 
> and I can't  
> even figure out how to get started. So, I am NOT asking for any code  
> (though pseudo-code is ok) as I would like to try figuring 
> this problem  
> out myself. So, if anyone can give me any references or hints that  
> would be great.

That´s a good approach :-)

[..]
> 
> Basically, I would like to concatenate the sequence of each  
> corresponding animal so that the various input files would  
> be out put  
> to a file like so:
> 
[..]

> 
> Notice that in the two files the data are not in the same 
> order. So, I  
> am trying to figure out how to have the script figure out what the  
> first organism is in FILE 1( say "cat" in this case) and find the  
> corresponding "cat" in the other input files. Then take the sequence  
> data (all the cat data) from FILE 2 and concatenate it to the cat  
> sequence data in FILE 1 to an output file. Then it should go 
> on to the  
> next organism in FILE 1 and search for that next organism in 
> the other  
> files (in this case FILE 2). I do not care about the order of 
> the data,  
> only that the "like" data is concatenated together.

If memory is not a problem (i.e. the amount of data you're processing is
rather small), I would read all files into a hash and concatenate them
there. Something like:
- open the first file
- search for the beginning of an "organism" (say: ">cat"), read everything
after this point
- search in your hash if you already stored data of this organism
  - if yes, append your new sequence to the already existing data
  - if no, create a new key in the hash
- repeat this until you run out of "organisms"
- repeat the whole procedure until you run out of files

I'd happily elaborate, but I don't want to spoil your approach of wanting to
solve this by yourself.
If you have any questions or need additional information, just post again.
:-)

> 
> Again, I do NOT want this solved for me (unless I am totally lost).  
> Otherwise, I'll never learn. I would just like either hints /  
> suggestions / pseudo code / even links to books or sites that 
> discuss  
> this particular topic. Meanwhile, I am eagerly awaiting my "PERL  
> Cookbook" and I'll keep searching the web.

Another good starting point might be the "camel book" 
(O`Reilly: Programming Perl)...

HTH,

Philipp

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




Re: Need guidance for a passworded site access script

2004-05-17 Thread Ramprasad A Padmanabhan
when you give the url give it as 

username:[EMAIL PROTECTED]

Ram

On Sat, 2004-05-15 at 22:58, Arron Baroom wrote:
> When a directory is protected with an .htaccess file,
> the browser launches a username/password request
> dialog box to be filled in before content in the
> directory is accessible.
> 
> I want to use a log-in form of my own, bypassing the
> dialog box.
> 
> The reason is that I want to maintain a member record
> of username, password, number of log-ins, demographic
> information, and email address (to have the ability to
> email the password to the member when requested). When
> a member logs in with the form, the script does
> whatever it needs to do to allow the browser to enter
> the .htaccess passworded directory.
> 
> I'm clueless about how to do the log-in.
> 
> Any tips about where to do research, which modules to
> use, and other things I may need to know to write this
> script would be much appreciated.
> 
> If anyone knows of an example script I can learn from
> that does something similar to what I'm trying to do,
> please let me know where I can obtain a copy.
> 
> Thank you all in advance,
> 
> Anodesan
> 
> 
>   
>   
> __
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.
> http://promo.yahoo.com/sbc/



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




Re: combining data from more than one file...

2004-05-17 Thread Johan Viklund
On Sun, 16 May 2004 19:50:57 -0400, Michael S. Robeson II  
<[EMAIL PROTECTED]> wrote:

Hi all,
Hello and Welcome to the world of bioinformatics with perl!
...
I think you should take a look at bioperl since this is genome data, for  
this exercise it's not what you want, but if you want to do more biology  
whith perl (blast, interfacing with databases, easy format conversion, and  
so on, and so forth...). Bioperl can be found at http://www.bioperl.org/

***FILE 1***
 >cat
atacta--gat--acgt-
ac-ac-ggttta-ca--
...
Again, I do NOT want this solved for me (unless I am totally lost).  
Otherwise, I'll never learn. I would just like either hints /  
suggestions / pseudo code / even links to books or sites that discuss  
this particular topic. Meanwhile, I am eagerly awaiting my "PERL  
Cookbook" and I'll keep searching the web.
So this was more like a link ;)

-Thanks!
-Mike
/Johan Viklund
Ps.

Next exercise (or really the one before) would be to calculate the GC-skew.

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



RE: Find closest value

2004-05-17 Thread Bob Showalter
Mike Blezien wrote:
> Hello,
> 
> is it possible, with perl, to find the closest numerical value to a
> set value. IE. a set value of 15 and I have five values,
> 208,258,56,123 
> 
> is there a function too go through the five values array to find the
> closest to 15 ??

Here's an approach that doesn't use sorting:

  #!/usr/bin/perl

  print "closest=", closest(15, 208, 258, 56, 123), "\n";

  sub closest {
  my $find = shift;
  my $closest = shift;
  abs($_ - $find) < abs($closest - $find) and $closest = $_ for @_;
  $closest;
  }

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




perl.beginners Weekly list FAQ posting

2004-05-17 Thread casey
NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?
Send mail to <[EMAIL PROTECTED]>

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

<[EMAIL PROTECTED]>.

  1.2 -  How do I unsubscribe?
Now, why would you want to do that? Send mail to
<[EMAIL PROTECTED]>, and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

<[EMAIL PROTECTED]>

  1.3 - There is too much traffic on this list. Is there a digest?
Yes. To subscribe to the digest version of this list send an email to:

<[EMAIL PROTECTED]>

To unsubscribe from the digest, send an email to:

<[EMAIL PROTECTED]>

This is a high traffic list (100+ messages per day), so please subscribe
in the way which is best for you.

  1.4 - Is there an archive on the web?
Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?
This document will be emailed to the list once a week, and will be
available online in the archives, and at http://learn.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?
Send an email to <[EMAIL PROTECTED]> with your suggestion.

  1.7 - Is there a supporting website for this list?
Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who do I complain to?
You can send complaints to <[EMAIL PROTECTED]>

  1.9 - Who currently maintains the FAQ?
Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?
Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl beginners.

  1.11 - When was this FAQ last updated?
Feb 04, 2004

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?
A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?
* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
* Monkeys solicitating homework on non-Perl related SPAM.

  2.3 - Are there any rules?
Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun

  2.4 - What topics are allowed on this list?
Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?
Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?
We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

Please do not quote the documentation unless you have something to add
to it. It is better to direct someone to the documentation so they
hopefully will read documentation above and beyond that which answers
their question. It also helps teach them how to use the documentation.

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?
Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

"perldoc perldoc"

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

  2.8 Is this a high traffic list?
YES! You have been warned! If you don't want to get ~100 emails per day
from this list, consider subscribing to the digest.

  2.9 Other tips before posti

Getting the href

2004-05-17 Thread Jason Dusek
Hi Everyone,
What is good way to pull the href from a link in html? If I have links like:
meow woof moo bark bahh meow 
bahh moo bark

How do I pull just the 'here_kitty' part?
--
-- Jason Dusek  ("`-''-/").___..--''"`-._
-- | `6_ 6  )   `-.  ( ).`-.__.`)
-- | (_Y_.)'  ._   )  `._ `. ``-..-'
-- |   _..`--'_..-_/  /--'_.' ,'
-- |  (il),-''  (li),'  ((!.-'
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Getting the href

2004-05-17 Thread Wiggins d Anconia
> Hi Everyone,
> 
> What is good way to pull the href from a link in html? If I have links
like:
> 
> meow woof moo bark bahh meow 
> bahh moo bark
> 
> How do I pull just the 'here_kitty' part?

Use an HTML parsing module.  HTML::TokeParser::Simple has proven
effective for me. 

There are regex possibilities, but mostly they create more headaches
than they solve.

http://danconia.org


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




RE: Find closest value

2004-05-17 Thread Bakken, Luke
Bob Showalter wrote:
> Mike Blezien wrote:
>> Hello,
>> 
>> is it possible, with perl, to find the closest numerical value to a
>> set value. IE. a set value of 15 and I have five values,
>> 208,258,56,123 
>> 
>> is there a function too go through the five values array to find the
>> closest to 15 ??
> 
> Here's an approach that doesn't use sorting:
> 
>   #!/usr/bin/perl
> 
>   print "closest=", closest(15, 208, 258, 56, 123), "\n";
> 
>   sub closest {
>   my $find = shift;
>   my $closest = shift;
>   abs($_ - $find) < abs($closest - $find) and $closest = $_ for
>   @_; $closest;
>   }

And in a more readable fashion:

sub closest
{
my $find = shift;
my $closest = shift;
for my $num (@_)
{
if (abs($num - $find) < abs($closest - $find))
{
$closest = $num;
}
}
return $closest;
}

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




Re: Getting the href

2004-05-17 Thread JupiterHost.Net

Jason Dusek wrote:
Hi Everyone,
Hello,
What is good way to pull the href from a link in html? If I have links 
like:

meow woof moo bark bahh meow 
bahh moo bark
There's are modules that help you do it, but this may work for what you 
need:

my @href = $html =~ m/href\=\"((https?\:\/\/)?[\/\w\.\-]+)\"/ig;
HTH
Lee.M - JupiterHost.Net
How do I pull just the 'here_kitty' part?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Getting the href

2004-05-17 Thread Wiggins d Anconia
> 
> 
> Jason Dusek wrote:
> > Hi Everyone,
> 
> Hello,
> 
> > What is good way to pull the href from a link in html? If I have links 
> > like:
> > 
> > meow woof moo bark bahh meow 
> > bahh moo bark
> 
> There's are modules that help you do it, but this may work for what you 
> need:
> 
> my @href = $html =~ m/href\=\"((https?\:\/\/)?[\/\w\.\-]+)\"/ig;
> 

What if the link is ftp, mailto, etc. Contains username/password
information?  a Port? How about a query string?  Javascript? White space
around the "=". To many questions unanswered, unanswered questions
cause headaches, stick with the modules :-)...

http://danconia.org


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




Re: Getting the href

2004-05-17 Thread JupiterHost.Net

Wiggins d Anconia wrote:
Jason Dusek wrote:
Hi Everyone,
Hello,

What is good way to pull the href from a link in html? If I have links 
like:

meow woof moo bark bahh meow 
bahh moo bark
There's are modules that help you do it, but this may work for what you 
need:

my @href = $html =~ m/href\=\"((https?\:\/\/)?[\/\w\.\-]+)\"/ig;

What if the link is ftp, mailto, etc. Contains username/password
information?  a Port? How about a query string?  Javascript? White space
around the "=". To many questions unanswered, unanswered questions
cause headaches, stick with the modules :-)...
I did say "may" :). For here_kitty it works but yes, modules are the way 
to go also because you may do this in lots of scripts and then if they 
add a  new protocol, say , perl://, then all you have to do is update 
your module and all your scripts magically work with the new protocol 
without a thousand edits.

http://danconia.org


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



Re: Getting the href

2004-05-17 Thread Rob Dixon
Jason Dusek wrote:
>
> What is good way to pull the href from a link in html? If I have links like:
>
> meow woof moo bark bahh meow
> bahh moo bark
>
> How do I pull just the 'here_kitty' part?

Hi Jason.

For something simple like this HTML::SimpleLinkExtor is ideal.

The program below should help.

Rob


use strict;
use warnings;

use HTML::SimpleLinkExtor;

my $html = q{
meow woof moo bark bahh meow
bahh moo bark
};

my $extor = HTML::SimpleLinkExtor->new;

$extor->parse($html);

print "$_\n"foreach $extor->links;

**OUTPUT

here_kitty



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




Broke My @INC

2004-05-17 Thread Jason Dusek
Hi List,
My @INC is messed up - Perl can't find any modules. If I know the path 
to a module, is there some kind of quick work around?

For those who are curious, I seem to have broken my @INC by installing 
the ports (I'm on FreeBSD) for Perl 5.6.1 and Perl 5.8.2.
--
-- Jason Dusek  ("`-''-/").___..--''"`-._
-- | `6_ 6  )   `-.  ( ).`-.__.`)
-- | (_Y_.)'  ._   )  `._ `. ``-..-'
-- |   _..`--'_..-_/  /--'_.' ,'
-- |  (il),-''  (li),'  ((!.-'
--

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



Re: combining data from more than one file...

2004-05-17 Thread Michael S. Robeson II
Well this is the best I could do thinking through what you said. This 
is actually my first time working with hashes. Also, I am still a PERL 
newbie. So, I guess a little helpful code would go a long way. I just 
can't figure out how to link the regular expressions to the hash when 
searching through the multiple files. to do as you say:

***Philipp wrote:***
- open the first file
- search for the beginning of an "organism" (say: ">cat"), read 
everything
after this point
- search in your hash if you already stored data of this organism
  - if yes, append your new sequence to the already existing data
  - if no, create a new key in the hash
- repeat this until you run out of "organisms"
- repeat the whole procedure until you run out of files

***end***
#!/usr/bin/perl
# This script will take separate FASTA files and combine the "like"
# data into one FASTA file.
#
use warnings;
use strict;
my %organisms (
"$orgID" => "$orgSeq",
 );
print "Enter in a list of files to be processed:\n";
# For example:
# CytB.fasta
# NADH1.fasta
# 
chomp (my @infiles = );
foreach $infile (@infiles) {
open  (FASTA, $infile)
or die "Can't open INFILE: $!";
$/='>'; #Set input operator
while (FASTA) {
chomp;
# Some regular expression match here?
# something that will set, say... ">cat"
# as the key "$orgID", something similar
# to below?
# and then set the sequence as the value
# "$orgSeq" like below?
# Do not know if or where to put the following,
# but something like:
if (exists $organisms{$orgID}) {
# somehow concatenate "like" data
# from the different files
}
# print the final Hash to an outfile?
}
 yeah, I'm lost.  :-)
-Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Broke My @INC

2004-05-17 Thread Randy W. Sims
Jason Dusek wrote:
Hi List,
My @INC is messed up - Perl can't find any modules. If I know the path 
to a module, is there some kind of quick work around?

For those who are curious, I seem to have broken my @INC by installing 
the ports (I'm on FreeBSD) for Perl 5.6.1 and Perl 5.8.2.
You installed both versions? How are you running perl? What is 
/usr/bin/perl linked to? What is 'perl -V'? 'perl5.6.1 -V'? 'perl5.8.2 
-V'? Is the environment vars 'PERLLIB' and/or 'PERL5LIB' set?

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



Regular Expresssion - Matching over multiple lines

2004-05-17 Thread Roman Hanousek
Hi All 

I have bunch of files that contain code like this:

What I am trying to do is match  then check that this
piece of code contains a alt= tag.





And if it doen't print the lines where it's missing to screen or file.


Cheers any help appreciated.










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




Re: Regular Expresssion - Matching over multiple lines

2004-05-17 Thread Andrew Gaffney
Roman Hanousek wrote:
Hi All 

I have bunch of files that contain code like this:
What I am trying to do is match  then check that this
piece of code contains a alt= tag.

And if it doen't print the lines where it's missing to screen or file.
while($input =~ ||sgc) {
  print "Missing ALT\n" if(! defined $1);
}
That doesn't give you line numbers, but it does give you an idea of where to start.
--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Newbie: Perl reg. expression

2004-05-17 Thread Durai
Hello All,

 open FILE, "test.txt" or die "Can't open file!: $!";
  while(  )
  {
 print if /(\d+\.\d+\.\d+\.\d)/;
  }
  close FILE;

It gives the following output:

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#Listen 12.34.56.78:80
# e.g., www.apache.org (on) or 204.62.129.132 (off).

I want only a word which contains IP address only not with port and others..
For example, Need like:  204.62.129.132  not  (0.0.0.0),12.34.56.78:80,.. .

Regs,
durai.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004


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




Image editing/Creating modules

2004-05-17 Thread perl
can someone give a name of any image (JPG or GIF) editing / creating module, which 
allow to create images to display on web pages on the fly by CGI scripts.


Rakhitha M. Karunarathne
Trainee Software Developer,
IFS - R & D International,
501,Galle Road ,Cololmbo-6, SRI LANKA.
Tel +94 (011)-2-364-440 Ext 841
E-mail [EMAIL PROTECTED]
www.ifsworld.com

CONFIDENTIALITY AND DISCLAIMER NOTICE 
Please note that this message may contain confidential information. If you have 
received this message by mistake, please inform the sender of the mistake by e-mailing 
[EMAIL PROTECTED], then delete the message from your system without making, 
distributing or retaining any copies of it.
Any views or opinions presented are solely those of the sender and do not necessarily 
represent those of IFS unless otherwise specifically stated.
Although we believe that the message and any attachments are free from viruses and 
other errors that might affect the computer or IT system where it is received and 
read, the recipient opens the message at his or her own risk. We assume no 
responsibility for any loss or damage arising from the receip.


Re: Newbie: Perl reg. expression

2004-05-17 Thread LRMK
this should work

open FILE, "test.txt" or die "Can't open file!: $!";
   while(  )
   {
  my @parts = split(/\s+/);
  foreach (@parts){
  print if /(\d+\.\d+\.\d+\.\d)/;
  }
   }
   close FILE;


Rakhitha Karunarathne
Web Master
www.Ad-Man.tk - Free Unlimited Banner Rotators




- Original Message - 
From: "Durai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 11:54 AM
Subject: Newbie: Perl reg. expression


> Hello All,
>
>  open FILE, "test.txt" or die "Can't open file!: $!";
>   while(  )
>   {
>  print if /(\d+\.\d+\.\d+\.\d)/;
>   }
>   close FILE;
>
> It gives the following output:
>
> # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> #Listen 12.34.56.78:80
> # e.g., www.apache.org (on) or 204.62.129.132 (off).
>
> I want only a word which contains IP address only not with port and
others..
> For example, Need like:  204.62.129.132  not  (0.0.0.0),12.34.56.78:80,..
.
>
> Regs,
> durai.
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
>
>
> -- 
> 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]
 




coding sampling techniques in perl

2004-05-17 Thread N, Guruguhan \(GEAE, Foreign National, EACOE\)
Hi All,
   I am trying to code Latin Hypercube Sampling and Sobol Sampling Sequences 
in Perl as a part of a tool we are developing here. I would like to know is there any 
references (standard codes developed) in Perl for the same? Any help in this regard is 
welcome. 

Thanks
Regards
Guruguhan


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




Re: Newbie: Perl reg. expression - Correction

2004-05-17 Thread LRMK
My previous mail has a small problem
this one should fix it


  open FILE, "test.txt" or die "Can't open file!: $!";
   while(  )
   {

my @parts = parts(/\s+/);
foreach (@parts){
if (/^(\d+\.\d+\.\d+\.\d+)$/){
print "$1\n";
}
}
   }
   close FILE;

Rakhitha Karunarathne
Web Master
www.Ad-Man.tk - Free Unlimited Banner Rotators




- Original Message - 
From: "Durai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 11:54 AM
Subject: Newbie: Perl reg. expression


> Hello All,
>
>  open FILE, "test.txt" or die "Can't open file!: $!";
>   while(  )
>   {
>  print if /(\d+\.\d+\.\d+\.\d)/;
>   }
>   close FILE;
>
> It gives the following output:
>
> # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> #Listen 12.34.56.78:80
> # e.g., www.apache.org (on) or 204.62.129.132 (off).
>
> I want only a word which contains IP address only not with port and
others..
> For example, Need like:  204.62.129.132  not  (0.0.0.0),12.34.56.78:80,..
.
>
> Regs,
> durai.
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
>
>
> -- 
> 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]
 




Query

2004-05-17 Thread Sudhindra Bhat
Hi

Thanks. But there is a small issue. Considering the same example, the piece
of code sent by you prints 123456 which is not on the same line as "Test:"
But it doesn't print the characters 123456 ABCDEF which is on the same line
as "Test:" 

Regards,
Sudhindra

-Original Message-
From: John W.Krahn [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 17, 2004 4:56 PM
To: Perl Beginners
Subject: Re: Query

On Monday 17 May 2004 03:15, Sudhindra Bhat wrote:
>
> Hi

Hello,

> I wanted some help on a piece of code that I was writing. Well the
> requirement is like this. I have a file whose looks like this
>
> (1) Test: 123456 ABCDEF
>
> 123456
>
> (2) Results: ABCDEF
>
> Now I want my script to output all the contents between the two tags
> Test and Results. i.e. 123456 ABCDEF 123456. Can someone help me with
> this?


while (  ) {
if ( /Test:/ .. /Results:/ and !/Test:/ and !/Results:/ ) {
print
}
}



John
-- 
use Perl;
program
fulfillment

-- 
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: Newbie: Perl reg. expression

2004-05-17 Thread Durai
It gives the output:

- Original Message - 
From: "LRMK" <[EMAIL PROTECTED]>
To: "Durai" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 11:37 AM
Subject: Re: Newbie: Perl reg. expression


> this should work
>
> open FILE, "test.txt" or die "Can't open file!: $!";
>while(  )
>{
>   my @parts = split(/\s+/);
>   foreach (@parts){
>   print if /(\d+\.\d+\.\d+\.\d)/;
>   }
>}
>close FILE;
>
> 
> Rakhitha Karunarathne
> Web Master
> www.Ad-Man.tk - Free Unlimited Banner Rotators
> 
>
>
>
> - Original Message - 
> From: "Durai" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 18, 2004 11:54 AM
> Subject: Newbie: Perl reg. expression
>
>
> > Hello All,
> >
> >  open FILE, "test.txt" or die "Can't open file!: $!";
> >   while(  )
> >   {
> >  print if /(\d+\.\d+\.\d+\.\d)/;
> >   }
> >   close FILE;
> >
> > It gives the following output:
> >
> > # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> > #Listen 12.34.56.78:80
> > # e.g., www.apache.org (on) or 204.62.129.132 (off).
> >
> > I want only a word which contains IP address only not with port and
> others..
> > For example, Need like:  204.62.129.132  not
(0.0.0.0),12.34.56.78:80,..
> .
> >
> > Regs,
> > durai.
> >
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
> >
> >
> > -- 
> > 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]
>  
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004


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




Re: Newbie: Perl reg. expression

2004-05-17 Thread Durai
Hi,

It gives the output:

(0.0.0.0)
12.34.56.78:80
204.62.129.132

I need Only IP address. I need like:

204.62.129.132
127.0.0.1

Not like 12.34.56.78:80,(0.0.0.0),..etc.

Thanks,
Durai.

- Original Message - 
From: "LRMK" <[EMAIL PROTECTED]>
To: "Durai" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 11:37 AM
Subject: Re: Newbie: Perl reg. expression


> this should work
>
> open FILE, "test.txt" or die "Can't open file!: $!";
>while(  )
>{
>   my @parts = split(/\s+/);
>   foreach (@parts){
>   print if /(\d+\.\d+\.\d+\.\d)/;
>   }
>}
>close FILE;
>
> 
> Rakhitha Karunarathne
> Web Master
> www.Ad-Man.tk - Free Unlimited Banner Rotators
> 
>
>
>
> - Original Message - 
> From: "Durai" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 18, 2004 11:54 AM
> Subject: Newbie: Perl reg. expression
>
>
> > Hello All,
> >
> >  open FILE, "test.txt" or die "Can't open file!: $!";
> >   while(  )
> >   {
> >  print if /(\d+\.\d+\.\d+\.\d)/;
> >   }
> >   close FILE;
> >
> > It gives the following output:
> >
> > # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> > #Listen 12.34.56.78:80
> > # e.g., www.apache.org (on) or 204.62.129.132 (off).
> >
> > I want only a word which contains IP address only not with port and
> others..
> > For example, Need like:  204.62.129.132  not
(0.0.0.0),12.34.56.78:80,..
> .
> >
> > Regs,
> > durai.
> >
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
> >
> >
> > -- 
> > 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]
>  
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004


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




Re: Newbie: Perl reg. expression - Correction

2004-05-17 Thread Durai
Hi,

It works fine after I change the following line:

my @parts = parts(/\s+/);

to

my @parts = split(/\s+/);

Thanks for your help.

Thanks,
Durai.

- Original Message - 
From: "LRMK" <[EMAIL PROTECTED]>
To: "Durai" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 12:00 PM
Subject: Re: Newbie: Perl reg. expression - Correction


> My previous mail has a small problem
> this one should fix it
>
>
>   open FILE, "test.txt" or die "Can't open file!: $!";
>while(  )
>{
>
> my @parts = parts(/\s+/);
> foreach (@parts){
> if (/^(\d+\.\d+\.\d+\.\d+)$/){
> print "$1\n";
> }
> }
>}
>close FILE;
> 
> Rakhitha Karunarathne
> Web Master
> www.Ad-Man.tk - Free Unlimited Banner Rotators
> 
>
>
>
> - Original Message - 
> From: "Durai" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 18, 2004 11:54 AM
> Subject: Newbie: Perl reg. expression
>
>
> > Hello All,
> >
> >  open FILE, "test.txt" or die "Can't open file!: $!";
> >   while(  )
> >   {
> >  print if /(\d+\.\d+\.\d+\.\d)/;
> >   }
> >   close FILE;
> >
> > It gives the following output:
> >
> > # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
> > #Listen 12.34.56.78:80
> > # e.g., www.apache.org (on) or 204.62.129.132 (off).
> >
> > I want only a word which contains IP address only not with port and
> others..
> > For example, Need like:  204.62.129.132  not
(0.0.0.0),12.34.56.78:80,..
> .
> >
> > Regs,
> > durai.
> >
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004
> >
> >
> > -- 
> > 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]
>  
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/14/2004


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