Permalink
Browse files

Add a doctest to quick_FASTA_reader, declare it obsolete

  • Loading branch information...
1 parent 751fe39 commit 239b739a8a4c6c72be9c8b05e6f2852ce0d34a24 @peterjc peterjc committed Oct 22, 2012
Showing with 35 additions and 9 deletions.
  1. +33 −9 Bio/SeqUtils/__init__.py
  2. +2 −0 DEPRECATED
@@ -315,17 +315,26 @@ def six_frame_translations(seq, genetic_code = 1):
def quick_FASTA_reader(file):
- """Simple FASTA reader, returning a list of string tuples.
+ """Simple FASTA reader, returning a list of string tuples (OBSOLETE).
The single argument 'file' should be the filename of a FASTA format file.
This function will open and read in the entire file, constructing a list
of all the records, each held as a tuple of strings (the sequence name or
title, and its sequence).
- This function was originally intended for use on large files, where its
- low overhead makes it very fast. However, because it returns the data as
- a single in memory list, this can require a lot of RAM on large files.
-
+ >>> seqs = quick_FASTA_reader("Fasta/dups.fasta")
+ >>> for title, sequence in seqs:
+ ... print title, sequence
+ alpha ACGTA
+ beta CGTC
+ gamma CCGCC
+ alpha (again - this is a duplicate entry to test the indexing code) ACGTA
+ delta CGCGC
+
+ This function was is fast, but because it returns the data as a single in
+ memory list, is unsuitable for large files where an iterator approach is
+ preferable.
+
You are generally encouraged to use Bio.SeqIO.parse(handle, "fasta") which
allows you to iterate over the records one by one (avoiding having all the
records in memory at once). Using Bio.SeqIO also makes it easy to switch
@@ -350,11 +359,26 @@ def quick_FASTA_reader(file):
def _test():
- """Run the Bio.SeqUtils module's doctests (PRIVATE)."""
- print "Runing doctests..."
+ """Run the module's doctests (PRIVATE)."""
+ import os
import doctest
- doctest.testmod()
- print "Done"
+ if os.path.isdir(os.path.join("..","Tests")):
+ print "Runing doctests..."
+ cur_dir = os.path.abspath(os.curdir)
+ os.chdir(os.path.join("..","Tests"))
+ doctest.testmod()
+ os.chdir(cur_dir)
+ del cur_dir
+ print "Done"
+ elif os.path.isdir(os.path.join("Tests")):
+ print "Runing doctests..."
+ cur_dir = os.path.abspath(os.curdir)
+ os.chdir(os.path.join("Tests"))
+ doctest.testmod()
+ os.chdir(cur_dir)
+ del cur_dir
+ print "Done"
+
if __name__ == "__main__":
_test()
View
@@ -398,6 +398,8 @@ Funtions GC_Frame, fasta_uniqids, apply_on_multi_fasta, and
quicker_apply_on_multi_fasta were deprecated in Release 1.55, and removed
in Release 1.58.
+Function quick_FASTA_reader was decleared obsolete in Release 1.61.
+
Bio.GFF (for accessing a MySQL database created with BioPerl, etc)
=======
The functions 'forward_complement' and 'antiparallel' in Bio.GFF.easy have

0 comments on commit 239b739

Please sign in to comment.