Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
test_SeqIO_features.NC_005816 Class Reference
Inheritance diagram for test_SeqIO_features.NC_005816:
Inheritance graph
[legend]
Collaboration diagram for test_SeqIO_features.NC_005816:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_GenBank_vs_EMBL
def test_Translations
def test_Genome
def test_Features
def setUp
def test_CDS

Public Attributes

 gb_filename
 ffn_filename
 faa_filename
 fna_filename
 embl_filename

Static Public Attributes

string basename = "NC_005816"
string emblname = "AE017046"
int table = 11
list skip_trans_test = []

Static Private Attributes

string __doc__ = "Tests using %s GenBank and FASTA files from the NCBI"

Detailed Description

Definition at line 993 of file test_SeqIO_features.py.


Member Function Documentation

def test_SeqIO_features.NC_000932.setUp (   self) [inherited]

Definition at line 962 of file test_SeqIO_features.py.

00962 
00963     def setUp(self):
00964         self.gb_filename = os.path.join("GenBank",self.basename+".gb")
00965         self.ffn_filename = os.path.join("GenBank",self.basename+".ffn")
00966         self.faa_filename = os.path.join("GenBank",self.basename+".faa")
00967         self.fna_filename = os.path.join("GenBank",self.basename+".fna")
00968         if self.emblname:
00969             self.embl_filename = os.path.join("EMBL",self.emblname+".embl")

def test_SeqIO_features.NC_000932.test_CDS (   self) [inherited]

Definition at line 971 of file test_SeqIO_features.py.

00971 
00972     def test_CDS(self):
00973         #"""Checking GenBank CDS translations vs FASTA faa file."""
00974         gb_record = SeqIO.read(open(self.gb_filename),"genbank")
00975         gb_cds = list(SeqIO.parse(open(self.gb_filename),"genbank-cds"))
00976         fasta = list(SeqIO.parse(open(self.faa_filename),"fasta"))
00977         compare_records(gb_cds, fasta)
00978         cds_features = [f for f in gb_record.features if f.type=="CDS"]
00979         self.assertEqual(len(cds_features), len(fasta))
00980         for f, r in zip(cds_features, fasta):
00981             if r.id in self.skip_trans_test:
00982                 continue
00983             #Get the nucleotides and translate them
00984             nuc = f.extract(gb_record.seq)
00985             self.assertEqual(len(nuc), len(f))
00986             pro = nuc.translate(table=self.table, cds=True)
00987             #print r.id, nuc, pro, r.seq
00988             #print f
00989             if pro[-1] == "*":
00990                 self.assertEqual(str(pro)[:-1], str(r.seq))
00991             else:
00992                 self.assertEqual(str(pro), str(r.seq))

Here is the call graph for this function:

Definition at line 1048 of file test_SeqIO_features.py.

01048 
01049     def test_Features(self):
01050         #"""Checking GenBank features sequences vs FASTA ffn file."""
01051         gb_record = SeqIO.read(open(self.gb_filename),"genbank")
01052         features = [f for f in gb_record.features if f.type=="CDS"]
01053         fa_records = list(SeqIO.parse(open(self.ffn_filename),"fasta"))
01054         self.assertEqual(len(fa_records), len(features))
01055         #This assumes they are in the same order...
01056         for fa_record, f in zip(fa_records, features):
01057             #TODO - check the FASTA ID line against the co-ordinates?
01058             f_seq = f.extract(gb_record.seq)
01059             self.assertEqual(len(fa_record.seq),
01060                              len(f_seq))
01061             self.assertEqual(str(fa_record.seq),
01062                              str(f_seq))
01063             self.assertEqual(len(f_seq), len(f))
01064 

Here is the call graph for this function:

Definition at line 1000 of file test_SeqIO_features.py.

01000 
01001     def test_GenBank_vs_EMBL(self):
01002         if not self.emblname:
01003             return
01004         gb_record = SeqIO.read(open(self.gb_filename),"genbank")
01005         embl_record = SeqIO.read(open(self.embl_filename),"embl")
01006         if len(embl_record.features) < len(gb_record.features):
01007             #Used to match, but I've update the GenBank files
01008             #which now has lots of misc_feature entries not in EMBL
01009             embl_record.features = [f for f in embl_record.features \
01010                                     if f.type != "misc_feature"]
01011             gb_record.features = [f for f in gb_record.features \
01012                                   if f.type != "misc_feature"]
01013         return compare_record(gb_record, embl_record, expect_minor_diffs=True)

Here is the call graph for this function:

Definition at line 1032 of file test_SeqIO_features.py.

01032 
01033     def test_Genome(self):
01034         #"""Checking GenBank sequence vs FASTA fna file."""
01035         gb_record = SeqIO.read(open(self.gb_filename),"genbank")
01036         fa_record = SeqIO.read(open(self.fna_filename),"fasta")
01037         compare_record(gb_record, fa_record)
01038         if self.emblname is None:
01039             return
01040         embl_record = SeqIO.read(open(self.embl_filename),"embl")
01041         if len(embl_record.features) < len(gb_record.features):
01042             #Hack since now out of sync for NC_005816
01043             embl_record.features = [f for f in embl_record.features \
01044                                     if f.type != "misc_feature"]
01045             gb_record.features = [f for f in gb_record.features \
01046                                   if f.type != "misc_feature"]
01047         compare_record(gb_record, embl_record, expect_minor_diffs=True)

Here is the call graph for this function:

Definition at line 1014 of file test_SeqIO_features.py.

01014 
01015     def test_Translations(self):
01016         #"""Checking translation of FASTA features (faa vs ffn)."""
01017         faa_records = list(SeqIO.parse(open(self.faa_filename),"fasta"))
01018         ffn_records = list(SeqIO.parse(open(self.ffn_filename),"fasta"))
01019         self.assertEqual(len(faa_records),len(ffn_records))
01020         for faa, fna in zip(faa_records, ffn_records):
01021             translation = fna.seq.translate(self.table, cds=True)
01022             if faa.id in self.skip_trans_test:
01023                 continue
01024             if (str(translation) != str(faa.seq)) \
01025             and (str(translation) != str(faa.seq)+"*"):
01026                 t = SeqRecord(translation, id="Translation",
01027                               description="Table %s" % self.table)
01028                 raise ValueError("FAA vs FNA translation problem:\n%s\n%s\n%s\n" \
01029                                  % (fna.format("fasta"),
01030                                     t.format("fasta"),
01031                                     faa.format("fasta")))
    

Here is the call graph for this function:


Member Data Documentation

string test_SeqIO_features.NC_005816.__doc__ = "Tests using %s GenBank and FASTA files from the NCBI" [static, private]

Reimplemented from test_SeqIO_features.NC_000932.

Definition at line 998 of file test_SeqIO_features.py.

string test_SeqIO_features.NC_005816.basename = "NC_005816" [static]

Reimplemented from test_SeqIO_features.NC_000932.

Definition at line 994 of file test_SeqIO_features.py.

Definition at line 968 of file test_SeqIO_features.py.

string test_SeqIO_features.NC_005816.emblname = "AE017046" [static]

Reimplemented from test_SeqIO_features.NC_000932.

Definition at line 995 of file test_SeqIO_features.py.

Definition at line 965 of file test_SeqIO_features.py.

Definition at line 964 of file test_SeqIO_features.py.

Definition at line 966 of file test_SeqIO_features.py.

Definition at line 963 of file test_SeqIO_features.py.

Reimplemented from test_SeqIO_features.NC_000932.

Definition at line 997 of file test_SeqIO_features.py.

Reimplemented from test_SeqIO_features.NC_000932.

Definition at line 996 of file test_SeqIO_features.py.


The documentation for this class was generated from the following file: