<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Obtaining overrepresented motifs in DNA sequences, part 4</title>
	<atom:link href="http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/</link>
	<description>a step-by-step guide to create Python applications in bioinformatics</description>
	<lastBuildDate>Sun, 02 May 2010 04:24:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
	<item>
		<title>By: Paulo Nuin</title>
		<link>http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/comment-page-1/#comment-13164</link>
		<dc:creator>Paulo Nuin</dc:creator>
		<pubDate>Fri, 16 May 2008 12:55:14 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/?p=106#comment-13164</guid>
		<description>Thanks Mike. I am away until Tuesday and I am going to test too. Would you mind sending me the code you have?

Cheers</description>
		<content:encoded><![CDATA[<p>Thanks Mike. I am away until Tuesday and I am going to test too. Would you mind sending me the code you have?</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/comment-page-1/#comment-13062</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 15 May 2008 00:34:33 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/?p=106#comment-13062</guid>
		<description>I coded the routine 8 different ways.  The code in comment number 1 was fastest.  A routine similar to the code in the original post was second fastest.  The difference in run time among the 4 fastest routines was not significant (only about 2 or 3%).  The slowest routine was about 20% slower than the fastest routine.</description>
		<content:encoded><![CDATA[<p>I coded the routine 8 different ways.  The code in comment number 1 was fastest.  A routine similar to the code in the original post was second fastest.  The difference in run time among the 4 fastest routines was not significant (only about 2 or 3%).  The slowest routine was about 20% slower than the fastest routine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo Nuin</title>
		<link>http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/comment-page-1/#comment-12961</link>
		<dc:creator>Paulo Nuin</dc:creator>
		<pubDate>Tue, 13 May 2008 02:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/?p=106#comment-12961</guid>
		<description>Hi Mike

I don&#039;t know if I can thank you enough, your comments always make the topic better. 

I was aware of the iteritems method but forgot to use in this case. Thanks for pointing out the enumerate. I am wondering about a possible speed increase with the solution you suggested.

Cheers</description>
		<content:encoded><![CDATA[<p>Hi Mike</p>
<p>I don&#8217;t know if I can thank you enough, your comments always make the topic better. </p>
<p>I was aware of the iteritems method but forgot to use in this case. Thanks for pointing out the enumerate. I am wondering about a possible speed increase with the solution you suggested.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://python.genedrift.org/2008/05/12/obtaining-overrepresented-motifs-in-dna-sequences-part-4/comment-page-1/#comment-12960</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 13 May 2008 00:02:30 +0000</pubDate>
		<guid isPermaLink="false">http://python.genedrift.org/?p=106#comment-12960</guid>
		<description>The &quot;enumerate&quot; function is handy when you want to number items in a list (or tuple, generator, etc.) as you loop over them with a &#039;for&#039; loop.  You pass the iterable into enumerate and it returns two-tuples a sequence number and an item from the iterator.

The built-in &quot;set&quot; class is handy when you want to keep track of a group of items, but don&#039;t want duplicates.  The .add() method adds an element to the set, unless it is already in the set.  

Dictionary methods items() and iteritems() return tuples of key-value pairs

(Leading &quot;.&quot;s represent spaces for indentation)

quorum = defaultdict(set)

for seq_number,seq in enumerate(seqs):
...for n in range(len(i.sequence) - length):
......quorum[i.sequence[n:n+length]].add(seq_number)

for motif,seq_numbers in quorum.iteritems():
...print motif.upper(), len(seq_numbers)</description>
		<content:encoded><![CDATA[<p>The &#8220;enumerate&#8221; function is handy when you want to number items in a list (or tuple, generator, etc.) as you loop over them with a &#8216;for&#8217; loop.  You pass the iterable into enumerate and it returns two-tuples a sequence number and an item from the iterator.</p>
<p>The built-in &#8220;set&#8221; class is handy when you want to keep track of a group of items, but don&#8217;t want duplicates.  The .add() method adds an element to the set, unless it is already in the set.  </p>
<p>Dictionary methods items() and iteritems() return tuples of key-value pairs</p>
<p>(Leading &#8220;.&#8221;s represent spaces for indentation)</p>
<p>quorum = defaultdict(set)</p>
<p>for seq_number,seq in enumerate(seqs):<br />
&#8230;for n in range(len(i.sequence) &#8211; length):<br />
&#8230;&#8230;quorum[i.sequence[n:n+length]].add(seq_number)</p>
<p>for motif,seq_numbers in quorum.iteritems():<br />
&#8230;print motif.upper(), len(seq_numbers)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

