Errata

Bioinformatics Programming Using Python

Errata for Bioinformatics Programming Using Python

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
PDF
Page 8
Last Boolean operation example near top of page

Example is missing Python interpreter output.

Note from the Author or Editor:
Delete the line ">>> False or True":

Kevin Ford  Jan 04, 2013 
Printed
Page 8
Bottom

The example

>>> 3 > 13 % 5
False

is misleading for non-programmers since the precedence of the operations in this case is "%" first and ">" second. While the example is correct in its answer, it is also correct if one uses the wrong precedence. Changing the "13" to another value would be helpful, but may introduce complexity to your description.

>>> 3 > 12 % 5
True

You could also use a footnote saying "see page 16, Compound Expressions" for a treatment of precedence. Alternately, you can refer back to the example on p. 8 from p. 16 and show how changing the "13" to a different value changes the answer and exposes the precedence rule.

Note from the Author or Editor:
This example and the one before it are both confusing. Change "2 == 5 // 2" to just "2 == 2" and change "3 > 13 % 5" to just "3 > 3".

Mark Morrissey  Dec 29, 2012 
Printed
Page 4
Last amino acid sequence example

The sequence:
'''MWNSNLPKPN AIYVYGVANA NITFFKGSDI LSYETREVLL KYFDILDKDE RSLKNALKD LEN PFGFAPYI TRAYEHKRNF LTTTRLKASF RPTTF'''

when entered shows this part "D LEN" modifies to be "DL EN" when it should remain "D LEN".

Also, without a cross reference to other formats, some (perhaps most) of the errata is lost on people with other formats. Columns listing the location in each format would be most helpful.

Note from the Author or Editor:
There is some confusion in the output of the examples on this page. Replace the lines of these examples after the first four with the following, but without the blank lines. The blank lines are here to indicate where new lines begin, since these lines will probably be broken up differently when this erratum is displayed in a browser.

'''MKQLNFYKKN SLNNVQEVFS YFMETMISTN RTWEYFINWD KVFNGADKYR NELMKLNSLC GSLFPGEELK

SLLKKTPDVV KAFPLLLAVR DESISLLD'''

'MKQLNFYKKN SLNNVQEVFS YFMETMISTN RTWEYFINWD KVFNGADKYR NELMKLNSLC GSLFPGEELK\nSLLKKT

PDVV KAFPLLLAVR DESISLLD'

'''MWNSNLPKPN AIYVYGVANA NITFFKGSDI LSYETREVLL KYFDILDKDE RSLKNALKDL
ENPFGFAPYI

RKAYEHKRNF LTTTRLKASF RPTTF'''

'MWNSNLPKPN AIYVYGVANA NITFFKGSDI LSYETREVLL KYFDILDKDE RSLKNALKDL ENPFGFAPYI\nRKAYEH

KRNF LTTTRLKASF RPTTF'

Finally, before the line "There are three situations that cause ..." Add "If you type these examples to Python you may see slight differences in where one line ends and another begins."

Mark Morrissey  Dec 29, 2012 
Printed, PDF
Page 259
Example 7-1

In function multi_search, the start of the list comprehension is
"target .find" (space between "target" and ".find"). It works OK but this might be confusing. Better without the space?

Note from the Author or Editor:
Delete the space after "target" in the third from last line (the one beginning "return min".

Phillip Wilmarth  Dec 06, 2012 
Printed, PDF, ePub
Page 272
Examples 7-4 and 7-5

the variable "m" is not defined. Is "m" supposed to be "matchobj"?

Note from the Author or Editor:
Replace "while m" with "while matchobj" and in the next line, "m.group" with "matchobj.group".

Also, on the last line of the next Example (7-5) replace "m =" with "matchobj =".

Phillip Wilmarth  Dec 06, 2012 
Printed
Page 38
Example 2-15

newbase = bases[randint(0,2)]

should be

newbase = bases[randint(0,3)]

in order to include base 'G' as a possible mutation

Note from the Author or Editor:
Change (0, 2) to (0, 3).

Mariana  Aug 28, 2012 
Printed
Page 233
last line of Example 6-9

"return path" --> "return paths"

Note from the Author or Editor:
Change as suggested.

Anonymous  Mar 07, 2012 
Printed
Page 134
Example 4-27

First line after the doc string of extract_gi_id should be indented four spaces fewer and "line" should be replaced with "description".

(This is page 134 not 127)

Note from the Author or Editor:
The line beginning "if line[0]" should be indented 4 fewer spaces and the word "line" should be replaced with the word "description".

Anonymous  Mar 07, 2012 
Printed
Page 8
penultimate interactive prompt part

>>> 'no' if 1 % 2 else 'no'
isn't a very instructive example, since the outcome is always 'no' regardless of the resolving of the if-else-clause. A better example (together with the first example) would be:
>>> 'yes' if 1//2 else 'no'
'no'
Wouldn't it?

Note from the Author or Editor:
Change as suggested.

Anonymous  Mar 07, 2012 
PDF
Page 55
In the list "Testing" methods

str1.numeric() should be str1.isnumeric()

Note from the Author or Editor:
Yes. This is why it's a good policy to name all predicate functions consistently -- if it returns True or False, it should begin with "is". But then, that doesn't help notice when you've left out the "is", does it!

Anonymous  Oct 06, 2011 
PDF
Page 38
first code block, replace_base_randomly_using_names function

The code line:

bases.replace(base, '')

is not altering the bases string in Python 3.0. Changing the code to:

bases = bases.replace(base, '') fixed this for me.

Note from the Author or Editor:
Yes. Strings are modifiable in some languages and not in others. This often leads to confusion, including among people like myself who have used many of each kind of language!

Steven Jackson  Sep 28, 2011 
PDF
Page 29
Example 2-5

seq = base_seq.upper()

should be

seq = base_sequence.upper()

as in example 2-4.

Note from the Author or Editor:
yes

Patrick Augereau  Sep 08, 2011 
PDF
Page 19
3rd paragraph

You can use Ctrl-P or the down arrow to move to a later
line in the input history.

instead of :

You can use Ctrl-N ...

Note from the Author or Editor:
yes

Patrick Augereau  Sep 07, 2011 
PDF
Page 454
Middle (Appendix A, Table A-10. Augmented numeric assignment statements)

It's a table of two columns: Statement and Equivalent. The mistake is on the last row.

First column reads: name **= expression
Second column reads: name = name * expression

(second column should be: name = name ** expression .)

Note from the Author or Editor:
yes

Guy Rapaport  May 14, 2011 
Printed
Page 203
Inside Figure 5-2

The second DNASequence from left to right at the bottom of Figure 5-2 should be ProteinSequence

Note from the Author or Editor:
yes

Jesus A Izaguirre  Feb 27, 2011 
PDF
Page 69
Example 3-3

Error in RNA_codon_table:

'UGG': 'Urp' has to be 'UGG': 'Trp'

3-Letter-code for Tryptophan : TRP

Note from the Author or Editor:
yes.

Benjamin Wellmann  Dec 28, 2010 
Printed
Page 93
Example 3-24

In Example 3-24, it states

>>>some({'a string', ''}, len)
False

This is incorrect. The output is True because len('a string') = 8. Running the provided sample code ch03_24.py confirms this.

John Blischak  Dec 14, 2010 
Printed
Page 11
output

on Page 11, the output ist wrong:

Book:
>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[:8]
'MNKMDLVADVAEKTDLSKAKAT'

Python3:
>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[:8]
'MNKMDLVA'

Note from the Author or Editor:
Whoops. Should be -8, not 8.

Anonymous  Nov 08, 2010 
Printed
Page 203
figure caption at top of page

The caption for Figure 5-2 should read "A deeper class hierarchy"

Mitchell L Model
 
Aug 29, 2010 
Printed
Page 52
bottom

The title of Table 3-7 should be "Operations generally supported by sequence types"

Mitchell L Model
 
Aug 29, 2010 
PDF
Page 155
Footnote 2

The following sentence should appear at the end of the footnote: "The idea to use the restriction enzyme database as an example comes from James Tisdall's Beginning Perl for Bioinformatics, O'Reilly Media, 2001.

Mitchell L Model
 
Aug 22, 2010 
PDF, Other Digital Version
Page 8
middle

The explanation of conditional expressions is incorrect: "Written using the keywords if and else, it returns the value **preceding** (not following) the if when the condition is true and the value following the else when it is false.

Tim Pietzcker  Aug 16, 2010 
PDF
Page 7
middle of the page

"In Python 2, it would have printed as 0.0089999999999999993, and 0.003 would have printed as 0.0089999999999999993."

should be

"In Python 2, it would have printed as 0.0089999999999999993, and 0.03 would have printed as 0.029999999999999999."

Stefan Schmidt  Aug 03, 2010 
PDF
Page 93
End of page

I think the sentence order in the last paragraph should be reversed. The first sentence describes the sixth and seventh calls to "some" and the second sentence describes the fourth and fifth calls to "some". This was confusing at first.

...
>>> some([0, 1, 4], lambda x: isinstance(x, int) and x % 2) # odd ints?
True
>>> def odd(n):
... return bool(n % 2) )
>>> some([0, 2, 4], odd)
False
>>> some({'a string', ''}, len)
False
>>> some({tuple(), ''}, len)
False

The last two lines of input illustrate that some can be used on any collection, not just a sequence. The definition of odd and the input before and after it show that the name of a function and a lambda expression have the same effect in a function call.

R. Mark Sharp  Jul 04, 2010 
PDF
Page 93
First use of "some" function in Example 3-24

I think the returned value would be False each time "some" is called with the same arguments. I suspect that the arguments are wrong in the first call to "some".

>>> some([0, '', False])
True
>>> some([0, '', False])
False

Note from the Author or Editor:
change first call to some([0, 'A', False])

R. Mark Sharp  Jul 04, 2010 
PDF
Page 15
last paragraph

string1.find(string2[, start[, end]])
Returns the position of the last occurrence of string2 in string1


should be


string1.find(string2[, start[, end]])
Returns the position of the first occurrence of string2 in string1

Stefan Schmidt  Jun 17, 2010 
PDF
Page 11
1st example of last paragraph

>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[:8]
'MNKMDLVADVAEKTDLSKAKAT'

should be

>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[:-8]
'MNKMDLVADVAEKTDLSKAKAT'

Stefan Schmidt  Jun 16, 2010 
PDF
Page 39
Example 2-18

1) gc_content doesn't work with lowercase input because of a minor mistake:

def gc_content(base_seq):
assert validate_base_sequence(base_seq), 'Argument has invalid characters'
seq = base_seq.upper()
return (base_seq.count('G') + base_seq.count('C')) / len(base_seq)

should be changed to:

def gc_content(base_seq):
assert validate_base_sequence(base_seq), 'Argument has invalid characters'
seq = base_seq.upper()
return (seq.count('G') + seq.count('C')) / len(base_seq)

2) gc_content doesn't work with RNA input (raises assertion error). I'm not sure if this was by design. If not, it could be fixed by adding the RNAflag parameter to its definition:

def gc_content(base_seq, RNAflag=False):
assert validate_base_sequence(base_seq, RNAflag), 'Argument has invalid characters'
seq = base_seq.upper()
return (base_seq.count('G') + base_seq.count('C')) / len(base_seq)

S. Hessam Moosavi Mehr  Jun 07, 2010 
PDF
Page 10
3rd example, 1st paragraph

>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[7//2]
'K'

should be changed to:

>>> 'MNKMDLVADVAEKTDLSKAKATEVIDAVFA'[7//2]
'M'

Note from the Author or Editor:
Thank you!

S. Hessam Moosavi Mehr  Jun 07, 2010 
Printed
Page 446
last bullet

"variable" should be "name"

Mitchell L Model
 
Apr 20, 2010 
Printed
Page 315
middle of last full paragraph

"variables" should be "values"

Mitchell L Model
 
Apr 20, 2010 
Printed
Page 226
middle of page, just after the heading "Environment access"

"variables" should be "values"

Mitchell L Model
 
Apr 20, 2010 
Printed
Page 310
middle of page (first bullet)

"variables" should be "values"

Mitchell L Model
 
Apr 20, 2010 
Printed
Page 283
top

The code for the while loop should be:

while itm:
itm, nxtpos = next_item(buffer, curpos) # reread to ensure complete
yield itm
itm, curpos, nxtpos = nxtitm, nxtpos, nxtend
nxtitm, buffer, nxtend = get_item(file, buffer, nxtpos, chunksize)

Mitchell L Model
 
Apr 18, 2010 
Printed
Page 428
Example 11-10, middle of the page

In the last line of __init__ (the call to super) filename should be ps_filename

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 427
middle of page

x_label_height should be xlabel_height

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 344
Exercise 9-12

In the definition of run, portnum, portnumbe, and portnumber should each be just port

The second line of open_port should be
for portnum in range(startport, startport+100):

The next to last line of the definition of run should use CGIHTTPRequestHandler not HTTPRequestHandler

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 342
Example 9-9

6th line from bottom:
SimpleHTTPRequestHandler
should be
http.server.SimpleHTTPRequestHandler

The names protnum in the parameter list and portnumber in the next to last line of the definition of run should both be port

The 2nd line of open_port should be:
for portnum in range(startport, startport+100):

The parameter server_class should be handler_class

Add parameter handler_class to open_port and handler_class to its call in run

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 340
Example 9-9

After assignments to HOST and PORT add:

encoding = 'ASCII'

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 340
Example 9-8

First line on page, the l at the end of the line should be )

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 330
Example 9-20, next to last line on page

Add 'name' at the end of the function name make_html_for_file

The syllable write_ would have been a better first syllable for all the names beginning with make_ in Example 9-20.

In the line
atagformat = "<li><a href="{0}">{1}</a></li>\n"
replace
href="{0}"
with
{0}

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 320
Example 8-17

Remove p in the for places it appears in
from self.parser.p

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 306
Example 8-11

remove the s from tagnames

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 297
Step 5

Choose XML ABOVE Overview instead of Protein Table BELOW. It will take a while for the page to download. When it's done, do step 6.

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 302
Step #2

The information on the web page was reorganized somewhat since the book was published, but the general idea of the step is unaffected.

Mitchell L Model
 
Apr 08, 2010 
Printed
Page 297
Example 8-8

remove the right parenthesis from the first line

add a single quote before the comma on the second line

replace the right parenthesis on the third line with a single quote

Add a colon at the end of the second to last line of the example (that begins with def remove_html)

Mitchell L Model
 
Apr 08, 2010 
PDF
Page 32
Example 2-10. Adding an assertion to the gc_content function

>>>return ((base_seq.count('G') + base_seq.count('C')) /
>>> len(base_seq))

should be

>>>return ((seq.count('G') + seq.count('C')) /
>>> len(base_seq))

Note from the Author or Editor:
Yes, and might as well make it len(seq) too.

Michele Seeber  Mar 09, 2010 
1.3.3
2nd example

"For a string of length N, an index (i.e., the value between square brackets) must be in the range -N <= index < N-1."

should read

"[...] must be in the range -N <= index < N."
or
"[...] must be in the range -N <= index <= N-1."

Peter Combs  Mar 04, 2010 
Printed
Page 441
last line

"+1 5" should be "+ 15"

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 421
middle of Example 11-5

Delete the following extraneous lines are extraneous:
tic_width = 3
xaxis_width = yaxis_width = 0
xlabel_height = ylabel_width = 0

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 380
near top, in definition of recognition_info

in return statement change sequence to seqdata

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 409
next to last line

add ' after Verdana

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 383
Example 10-8

max(Name, --> max(Name)

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 379
Example 10-5, near the bottom of the page

in the line after "try:" replace "get_connection" with sqlite3.connect

delete the next to last line of the definition of load_enzyme_data and the + at the end of the line before the deleted one

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 368
Example 10-1

replace the last 5 lines of parse_organism (the if/elif/return code) with:

return (parts[0],
parts[1],
None if len(parts) == 2 else ' '.join(parts[2:])

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 348
Example 9-15

table.get(sequence, set()).add(enzyme)
-->
if sequence in table:
table[sequence].add(enzyme)
else:
table[sequence] = {enzyme} # first enzyme for sequence

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 329
middle of Example 9-1

in the assignment of urlpart1, the semicolon after the question mark should be a colon

quote_plus(words) --> quote_plus(' '.join(words))

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 321
last line of page

indent 4 spaces

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 246
last line of Example 6-11

val --> value

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 233
last line of Example 6-9

"return path" --> "return path"

Mitchell L Model
 
Feb 05, 2010 
Printed
Page 224
First # line in Example 6-3

Insert before the first comment line, the line:
# other ports commonly used are 465 and 587

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 225
line 7

"conneection" --> "connection"

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 222
last line

"(command)" --> "(command, shell=True)"

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 191
Last line of page

add:
self.read_next_line()
at the end of the definition skip_intro, repeating the first line of the definition.

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 187
second def of Example 5-2

In the definition of __repr__, delete a space before the first quote of the doc string and before "repr" on the second line of the return statement.

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 222
Exercise 6-1

Remove right parentheses after "path"

Mitchell L Model
 
Jan 27, 2010 
Printed
Page 203
below Figure 5-2 i

in definition of complement get rid of first self in self(self.get_sequence)

in class RNASequence, change ComplementTrans to ComplementTable

Note from the Author or Editor:
Yes. Clarification on the first: remove first left parentheses and final right parentheses on same line too.

Shira Rockowitz  Jan 26, 2010 
Printed
Page 202
Example 5-9

change class AmbiguousDNASequence(DNASequence): to
class AmbiguousDNASequence(BaseSequence):

Shira Rockowitz  Jan 26, 2010 
Printed
Page 55
bottom of page

str1.endswith(str2[, startpos, [endos]]) should be str1.endswith(str2[, startpos, [endpos]])

Shira Rockowitz  Jan 26, 2010 
Printed
Page 54
bottom of page

under creating char(n) should be chr(n), ord(char) should be ord(chr)

Note from the Author or Editor:
char(n) should be chr(n), but ord(char) does not need to be changed

Shira Rockowitz  Jan 26, 2010 
Printed
Page 493
next to last paragraph

"genus name" --> "species name" !!!

Mitchell L Model
 
Jan 22, 2010 
Printed
Page 409
Example 11-1

Add footnote to the paragraph beginning "Example 11-1":

The simple form of tkinter programs shown in this chapter cannot be run from IDLE, because IDLE is itself a tkinter program; they must be run from the command line or another IDE.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 344
Example 9-12

At the end of the definition of run replace SimpleHTTPRequestHandler with CGIHTTPRequestHandler.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 321
Example 8-18

Delete the first line after the doc string in the definition of start_element.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 198
Example 5-7

In the definition of gc_content replace "get_sequence" with "get_sequence()".

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 162
Definition of expect_equal

Add a right parentheses at the end of the doc string

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 143
In paragraph following title "Extracting Information from an HTML File"

Before "click the search button" add "select Gene from the dropdown to the left of the search box, "

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 143
In paragraph following title "Extracting Information from an HTML File"

Replace "sites/entrez" with "gene" in the URL for Entrez Gene.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 159
Near top

In the definition of test, delete the second space after "result =", and change "== 2" to "== 3559" in the first assertion statement.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 158
Example 4-39

Add a colon to the end of the first line of the definition of load_enzyme_data_into_table

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 157
Example 4-38

Add a colon to the end of the first line of the definition of load_enzyme_data_into_table

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 154
Example 4-36

Replace "RNA" with "DNA" in the example title

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 154-155
Examples beginning with ">>>"

Replace "print_translations" with "print_translations_with_open_reading_frame_in_both_directions"

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 154
Examples beginning with ">>>"

Replace "print_translations" with "print_translations_with_open_reading_frame"

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 153
Example 4-35

In definition of translate_with_open_reading_frames "frame-1" should be "framenum-1"

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 153
Example 4-35

Replace "RNA" with "DNA" in the code and the example title

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 153
Example 4-34

Replace "RNA" with "DNA" in the code and the example title

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 152
Example 4-33

Replace "RNA" with "DNA" in the code and the example title

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 152
Example 4-32

The table should contain DNA codons not RNA codons: replace U with T throughout the table. Likewise, replace "RNA" with "DNA" in the function definition and the example title.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 153
Example 4-34

"print" in the definition of print_translation_in_frame should line up with the first quote of the doc string

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 151
Example 4-31

This section should refer to DNA throughout, not RNA. Change "RNA" to "DNA" in the title and the first sentence of the subsequent paragraph, as well as in the Table of Contents. The last sentence of that paragraph should be replaced with the "This example, though, will be based on DNA, instead of RNA, codons. (For the purpose of this example we are pretending that DNA is directly translated into amino acids rather than first being transcribed into RNA which is then tranlsated into amino acid sequences.)"

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 149
Example 4-31

Rename next_item to item_generator and add the following definition:

def get_items(src, testfn=None):
"""Return all the items in src; if testfn then include only those
items for which testfn is true"""
return [item for item in item(src)
if not testfn or testfn(item)]

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 146
Example 4-30

Remove the argument "testfn" from the call to item_generator at the beginning of find_item.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 147
Example 4-30

The next to last line of item_generator should eliminate the initial '>' and final '\n', reading:
description = line[1:-1].split('|')

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 143
Example 4-29

In the definition of get_gene_info_from_file the open statement should have a second argument:
encoding = 'utf-8'
which is often necessary for HTML files saved from a web page.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 143
Example 4-29

The last two lines should be indented an additional 6 spaces each.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 127
Example 4-27

First line after the doc string of extract_gi_id should be indented four spaces fewer and "line" should be replaced with "description".

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 127
Example 4-22

Add a colon at the end of the first line of the definition of list_sequences_in_file.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 125
Example 4-19

In the definition of is_number replace "elt" with "value"

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 122
Table 4-3

On the right side of the table insert a right parentheses between the right parentheses and right bracket.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 122
Table 4-2

There should be no line break after "def" at the beginning of the table.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 121
Table 4-1

Add a right parentheses at the end of the code on the right side of the table.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 119
Example 4-15

First line after the docstring of extract_gi_id should be indented four spaces fewer and "line" should be replaced with "description".

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 83
Example 3-12

Remove "[1:]" from the first line of the body of read_FASTA_sequences.

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 82
Example 3-11

Replace the body of the definition of read_FASTA_sequences with:
return [[seq[0], seq[2].replace('\n', '')] # delete newlines
for seq in read_FASTA_entries(filename)]

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 88
Example 3-22

The definition of first_common can be used with any two collections, so (1) replace "list1" and "list2" with "collection1" and "collection2"; and (2) in the sentence preceding the example replace "list" with "collection".

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 88
first three lines

Replace with:

return {line.split('|')[2] for line in file
if line[0] == '>' and len(line.split('|')) > 2}

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 85
Example 3-16

replace [0] with [1]

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 80
Example 3-7

Delete one of the two spaces between "return" and "all".

Mitchell L Model
 
Jan 18, 2010 
Printed
Page 39
definition of recognition_site

The lines with the doc string and return statement should each begin with an additional space. In the definition of test, True and False should be exchanged.

Mitchell L Model
 
Jan 18, 2010 
215
2nd paragraph

The paragraph is entirely incorrect and should be deleted. In its place, the following sentence should be added to the end of the previous paragraph: "Note that output sent to both streams is "line-buffered", meaning that characters are accumulated until an end-of-line character is encountered, at which point the line is sent to the stream's actual destination.

Mitchell L Model
 
Jan 11, 2010 
PDF
Page 33
Example 2-12. Adding a default value for the flag parameter

>>> validate_base_sequence('AUCG')
>>> # second argument omitted; defaults to True
True

should be

>>> validate_base_sequence('AUCG')
>>> # second argument omitted; defaults to False
False

TALHA KARABIYIK  Dec 21, 2009