[29354] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 598 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 28 21:14:24 2007

Date: Thu, 28 Jun 2007 18:14:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 28 Jun 2007     Volume: 11 Number: 598

Today's topics:
    Re: Oh great gurus of the list, I need help with a regu <tadmc@seesig.invalid>
    Re: Oh great gurus of the list, I need help with a regu <paduille.4061.mumia.w+nospam@earthlink.net>
    Re: PERL and Active DIrectory QoS@domain.invalid
    Re: Perl Standard for Remote Objects. <glex_no-spam@qwest-spam-no.invalid>
    Re: Problem with PERL function <mzhao1@gmail.com>
    Re: Problem with PERL function <jurgenex@hotmail.com>
    Re: Problem with PERL function <mzhao1@gmail.com>
    Re: Problem with PERL function <wahab-mail@gmx.de>
    Re: Problem with PERL function <wahab-mail@gmx.de>
    Re: Problem with PERL function <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 29 Jun 2007 00:04:34 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Oh great gurus of the list, I need help with a regular expression please
Message-Id: <slrnf88fsg.o52.tadmc@tadmc30.sbcglobal.net>

Mumia W. <paduille.4061.mumia.w+nospam@earthlink.net> wrote:
> On 06/28/2007 11:24 AM, Clenna Lumina wrote:
>> Tad McClellan wrote:
>>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>>
>>>> I think the usefulness it would
>>>> represent would of made it a shoe in?
>>>            ^^^^^^^^
>>>            ^^^^^^^^  heh. So it's a case of mistaken identity huh?


> Now I'm beginning to think you're a troll. Clenna, 


Just now beginning?

You're way behind everybody who was here in 2002 when it was
here last...


> I advise you do just 
> drop it.


That won't happen as long as people keep following up to its posts.


> (My spidey sense tells me that you're a morph of PG, 


Gurl is most definitely not the Jsut Troll, she is a more
"honorable" person, if that can be said of any troll, than
Jsut is.

She only displays 2 of the 6 Jsut telltales, while we have now
seen all 6 of them with Clenna Lumina and friends.


> but my killfile 
> won't care.)


If you are willing to go through the captcha, you can get a couple
dozen of the addresses it has used in the past:

   http://groups.google.com/group/comp.lang.perl.misc/msg/52eedd87f97ff558


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 28 Jun 2007 22:16:28 GMT
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: Oh great gurus of the list, I need help with a regular expression please
Message-Id: <0rWgi.1912$tj6.1863@newsread4.news.pas.earthlink.net>

On 06/28/2007 11:24 AM, Clenna Lumina wrote:
> Tad McClellan wrote:
>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>
>>> I think the usefulness it would
>>> represent would of made it a shoe in?
>>            ^^^^^^^^
>>            ^^^^^^^^  heh. So it's a case of mistaken identity huh?
> 
> Oh, so now I'm the only one on the planet who doesn't know the correct 
> spelling of "shoo-in", heh.. brilliant detective work once again... 
> (note the sarcasm.)
> 
>>    http://en.wiktionary.org/wiki/shoo-in
> 
> And you're called me a troll in another thread? You're the one who KEEPS 
> "flame-baiting" and quite frankly [...]

Now I'm beginning to think you're a troll. Clenna, I advise you do just 
drop it.

(My spidey sense tells me that you're a morph of PG, but my killfile 
won't care.)



------------------------------

Date: Thu, 28 Jun 2007 22:41:18 GMT
From: QoS@domain.invalid
Subject: Re: PERL and Active DIrectory
Message-Id: <iOWgi.4791$%w5.4331@trndny04>


gaz_5_m@yahoo.co.uk wrote in message-id:  <1183058740.045092.304550@k79g2000hse.googlegroups.com>

> 
> Hi folks,
> 
> I was just wondering if anyone was using PERL to any great effect to
> query Active DIrectory.
> 
> I'm in the middle of a fairly large project at work that requires
> getting (constantly changing) info from AD. I was doing the same
> things on a daily basis so thought it best to try and script it.
> 
> Is there any way to directly interrogate AD from within PERL. At the
> moment, the only way I have been able to figure out is to use the
> Windows Admin Pak to call:
> 
> open query, "dsquery group -name "x" | dsget group -members |";
> 
> from within the script and then use the piped output of the open
> command to strip out the data that I want.
> 
> It works OK, just takes a hell of a long time!
> 
> The other issue I get is the default return size that is set in our AD
> environment, 1000, so groups with any larger than 1000 users return
> nothing.
> 
> I know you can get round this with VB, but PERL is my language of
> choice! :-)
> 
> Anyone with any tips?

Yeah you probably want to use Net::LDAP
it is part of the perl-ldap package
btw this will work with all major directory services
Netscape, AD, NDS, and Solaris Directory






------------------------------

Date: Thu, 28 Jun 2007 16:02:30 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Perl Standard for Remote Objects.
Message-Id: <468421e6$0$10307$815e3792@news.qwest.net>

Ilias Lazaridis wrote:
> Is there any standard library to deal with remote objects on perl?

Well, what did you find on CPAN?


------------------------------

Date: Thu, 28 Jun 2007 14:21:14 -0700
From:  michaelzhao <mzhao1@gmail.com>
Subject: Re: Problem with PERL function
Message-Id: <1183065674.583722.135460@o61g2000hsh.googlegroups.com>

Here is my code. Keep in mind that this is like my 2nd week on Perl so
it probably is pretty crappy ;). Try not to give me too much flak
about it.

The DNA File is called "verified.fa". It is a FASTA file, a common
file format for storing DNA strings.

#!/usr/bin/perl -w

#The filename of the file containing the e-coli sequence data

$fastadata = 'verified.fa';

#This step is to open the file, if the file cannot be opened, an error
message is printed and the program exits
unless ( open(FASTAFILE,$fastadata) ) {
	print "Could not open file $fastadata!\n";
	exit;
}

#Read the protein sequence into an array. This array will be used to
generate the Markov Transitional Matrices
@fasta = <FASTAFILE>;

#Close the FASTA data now as all the data has been read into the array
close FASTAFILE;

#Extracting the FASTA file from the array and putting it into a
sequence data

sub extract_sequence_from_fasta_data {
	my(@fasta) =@_;

	use strict;
	use warnings;

	#declaing the variables
	my $fastasequence = '';

	foreach my $line (@fasta) {

			#Discard blank line
			if ($line =~ /^\s*$/) {
				next;

			#Discard comment line
			} elsif($line =~ /^\s*#/) {
				next;

			#Discard fasta header line
			} elsif($line =~ /^>/) {
				next;
			 #Keep line, add to sequence string
			 } else {
				$fastasequence .= $line;
			}
		}

		#remove non-sequence data from the $sequence string
		$fastasequence =~ s/\s//g;

		return $fastasequence;
	}

$fastasequence = extract_sequence_from_fasta_data (@fasta);

#Split up the FASTA sequence into individual elements
@fastasequence = split( '' , $fastasequence);

#Initialize the tally
$tally_of_Adenosine = 0;
$tally_of_Thymine = 0;
$tally_of_Guanine = 0;
$tally_of_Cytosine = 0;
$errors = 0;


#Initialize a loop so it can tally the nucleotides
foreach $base (@fastasequence) {

	if	( $base eq 'A') {
			++$tally_of_Adenosine;
	} elsif ( $base eq 'T') {
			++$tally_of_Thymine;
	} elsif ( $base eq 'G') {
			++$tally_of_Guanine;
	} elsif	( $base eq 'C') {
			++$tally_of_Cytosine;
	} else {
		print "!!!!!! Error - Base not recognized: $base\n";
		++$errors;
		}
}
#Now that we have a tally of the bases, we have have to calculate the
zero-order Markov Transitional Matrice
print "$tally_of_Adenosine\n";
print "$tally_of_Thymine\n";
print "$tally_of_Guanine\n";
print "$tally_of_Cytosine\n";
unless ($errors eq '0') {
	print "$errors\n";
}





------------------------------

Date: Thu, 28 Jun 2007 21:52:52 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Problem with PERL function
Message-Id: <U4Wgi.2312$t95.1447@trndny01>

michaelzhao wrote:
> Here is my code.

I won't pretend to understand all of your code, but in this part below it 
appears as if all you are doing is counting how often a specific character 
appears in the given string $fastasequence.

> #Split up the FASTA sequence into individual elements
> @fastasequence = split( '' , $fastasequence);
>
> #Initialize the tally
> $tally_of_Adenosine = 0;
> $tally_of_Thymine = 0;
> $tally_of_Guanine = 0;
> $tally_of_Cytosine = 0;
> $errors = 0;
>
>
> #Initialize a loop so it can tally the nucleotides
> foreach $base (@fastasequence) {
>
> if ( $base eq 'A') {
> ++$tally_of_Adenosine;
> } elsif ( $base eq 'T') {
> ++$tally_of_Thymine;
> } elsif ( $base eq 'G') {
> ++$tally_of_Guanine;
> } elsif ( $base eq 'C') {
> ++$tally_of_Cytosine;
> } else {
> print "!!!!!! Error - Base not recognized: $base\n";
> ++$errors;
> }

If my guess is correct, then this whole section can be replaces with a 
simple

    $tally_of_Adenosine = tr/A/A/;
    $tally_of_Thymine = tr/T/T/;
    $tally_of_Guanine = tr/G/G/;
    $tally_of_Cytosine = tr/C/C/;

The tr// operator returns the number of replacements it has performed and 
thus tells you how many A's it has replaced with A's.
From "perldoc perlop"
    tr/SEARCHLIST/REPLACEMENTLIST/cds
            Transliterates all occurrences of the characters found in the
            search list with the corresponding character in the replacement
            list. It returns the number of characters replaced or deleted.
            [...]

jue




------------------------------

Date: Thu, 28 Jun 2007 15:03:37 -0700
From:  michaelzhao <mzhao1@gmail.com>
Subject: Re: Problem with PERL function
Message-Id: <1183068217.468743.242080@g4g2000hsf.googlegroups.com>

On Jun 26, 5:23 pm, jgra...@ti.com wrote:
> use...@DavidFilmer.com writes:
> > On Jun 26, 12:15 pm, michaelzhao <mzh...@gmail.com> wrote:
>
> > > Basically, I need the frequencies of the 4 bases, Adenosine (A),
> > > Thymine (T), Cytosine (C), and Guanine (G).
>
> > > However, here is my problem. Instead of doing it globally. I need to
> > > be able to specify an arbitrary start and stop position
>
> > I don't know bioperl (and there are LOTS of modules related to
> > bioperl; maybe one does exactly what/how you want) but if all you want
> > to do is basic frequency analysis on an array (assuming your bases are
> > in an array) then there are several statistics packages that will do
> > this for you.  Consider:
>
> snip example of      use Statistics::Frequency;
>
> > If you want to specify an arbitrary range, just slice the array, such
> > as:
> >    my $freq = Statistics::Frequency->new( @dna[4..9] );
> > (remember arrays start numbering at zero, so this will get the fifth-
> > tenth items)
>
> I don't know bioperl either, but it seems like the DNA strings of ATCG
> might be represented as long strings because dna people might like to
> use regexp to search for subsets.
>
> In that case, here are some idioms
> for counting characters in a scalar using tr///,
> and for accessing a subset of a string with substr; (pasted and tested)
>  #       0123456789.12345678
>  $dna = 'TCTCTCGGGAAGAGATTGA';
>  $Tcount = $dna =~ tr/T/T/;  # tr returns number of T->T replacements
>  $start = 3; # inclusive, based at 0
>  $stop  = 9; # inclusive
>  $len   = $stop-$start+1
>  $Tcountss = substr($dna,$start,$len) =~ tr/T/T/; # access subset of $dna
>  print "dna = '$dna' has $Tcount T's,\n";
>  print " but only $Tcountss T's in $start to $stop, inclusive\n",
>  printf " for a relative frequency of %f\n", $Tcountss/$len;
>
> -- output is
>
> dna = 'TCTCTCGGGAAGAGATTGA' has 5 T's,
>   but only 1 T's in 3 to 9, inclusive
>   for a relative frequency of 0.142857
>
> As mentioned before,  posting short example datastructures from your code
> shows you are paying attention, and enable more appropriate assistance.
>
> --
> Joel

Wow Joel! Thanks a lot for your help. Your suggestion really hit the
spot. I was able to learn quite a bit from the code you put up and
succesfully modified it to fit my needs.

To everyone else: Thanks for the suggestions and the help! With the
exception of the jerkoff who wrote the first response.



------------------------------

Date: Thu, 28 Jun 2007 23:49:21 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Problem with PERL function
Message-Id: <f61f1i$1lc$1@mlucom4.urz.uni-halle.de>

michaelzhao wrote:
> Here is my code. Keep in mind that this is like my 2nd week on Perl so
> it probably is pretty crappy ;). Try not to give me too much flak
> about it.

Thats really good! It works.

> The DNA File is called "verified.fa". It is a FASTA file, a common
> file format for storing DNA strings.
> #!/usr/bin/perl -w
> #The filename of the file containing the e-coli sequence data
> $fastadata = 'verified.fa';


I'd guess all your program does or intends to do is the following:

    ...

    my $fastasequence = '';
    my %Tally;

    open my $fh, '<', 'verified.fa' or die "can't open file!$!";
    while (<$fh>) {
       /([ATCG]+)(?{ $fastasequence .= $1 })/g unless /^[>#]/
    }
    close $fh;

    1 while $fastasequence =~ /(.)(?{ ++$Tally{$1} })/g;


    print
       map "$_: $Tally{$_} " . (100. * $Tally{$_}/length $fastasequence) . "%\n",
          keys %Tally;

    ...

(Please correct me if I'm wrong)


Please have also a look at:
http://www.perl.com/pub/a/2003/09/10/bioinformatics.html

Regards

M.


------------------------------

Date: Thu, 28 Jun 2007 23:57:22 +0200
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Problem with PERL function
Message-Id: <f61gvs$2ba$1@mlucom4.urz.uni-halle.de>

Mirco Wahab wrote:
>    1 while $fastasequence =~ /(.)(?{ ++$Tally{$1} })/g;

Oh, I forgot: if you need defined ranges in the nucleotide
string, you could use the 'substr' function directly,
($st and $nn denote sequence start/seqence count)

    ...
    my ($fastasequence, $st, $nn) = ('', 1, 444);

    open my $fh, '<', 'verified.fa' or die "can't open file!$!";
    while (<$fh>) { /([ATCG]+)(?{ $fastasequence .= $1 })/g unless /^[>#]/ }
    close   $fh;

    my %Tally;
    1 while substr($fastasequence, $st, $nn) =~ /(.)(?{ ++$Tally{$^N} })/g;

    print
       map "$_: $Tally{$_} ".(100*$Tally{$_}/length substr $fastasequence, $st, $nn)."%\n",
          keys %Tally;
    ...

Regards

M.



------------------------------

Date: Fri, 29 Jun 2007 00:04:34 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Problem with PERL function
Message-Id: <slrnf88i62.o52.tadmc@tadmc30.sbcglobal.net>

michaelzhao <mzhao1@gmail.com> wrote:
> On Jun 26, 5:23 pm, jgra...@ti.com wrote:


>> As mentioned before,  


Who mentioned it before?


>> posting short example datastructures from your code
>> shows you are paying attention, and enable more appropriate assistance.


> To everyone else: Thanks for the suggestions and the help! With the
> exception of the jerkoff who wrote the first response.


Oh. It was the "jerkoff" who mentioned how to get help with your problem.

Calling the regulars names will have a negative effect on your ability
to get quality help here in the future. I suggest you try to refrain
from doing that anymore.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 598
**************************************


home help back first fref pref prev next nref lref last post