Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 31 lines (25 sloc) 1.201 kB
8d52315 @peterjc Add missing copyright & license text to many unit tests
peterjc authored
1 # Copyright 2003 by Iddo Friedberg. All rights reserved.
2 # This code is part of the Biopython distribution and governed by its
3 # license. Please see the LICENSE file that should have been included
4 # as part of this package.
5
de12c5e @peterjc Add: from __future__ import print_statement
peterjc authored
6 from __future__ import print_function
7
dc3dcb8 Regression tests for yair Benita's additions to SeqUtils
idoerg authored
8 from Bio.SeqUtils import CodonUsage
9 import os
10 import sys
11
12 # first make a CAI object
13 X = CodonUsage.CodonAdaptationIndex()
14 # now generate an index from a file
15 if os.path.exists("./CodonUsage/HighlyExpressedGenes.txt"):
3c24267 @peterjc A couple more tab to space conversions
peterjc authored
16 X.generate_index("./CodonUsage/HighlyExpressedGenes.txt")
dc3dcb8 Regression tests for yair Benita's additions to SeqUtils
idoerg authored
17 elif os.path.exists("./Tests/CodonUsage/HighlyExpressedGenes.txt"):
3c24267 @peterjc A couple more tab to space conversions
peterjc authored
18 X.generate_index("./Tests/CodonUsage/HighlyExpressedGenes.txt")
dc3dcb8 Regression tests for yair Benita's additions to SeqUtils
idoerg authored
19 else:
7378e8a @superbobry Partially migrated to print-function-like syntax
superbobry authored
20 print("Cannot find the file HighlyExpressedGene.txt\nMake sure you run the tests from within the Tests folder")
3c24267 @peterjc A couple more tab to space conversions
peterjc authored
21 sys.exit()
dc3dcb8 Regression tests for yair Benita's additions to SeqUtils
idoerg authored
22 # alternatively you could use any predefined dictionary like this:
23 # from CaiIndices import SharpIndex # you can save your dictionary in this file.
24 # X.SetCaiIndex(SharpIndex)
25
7378e8a @superbobry Partially migrated to print-function-like syntax
superbobry authored
26 print("The current index used:")
dc3dcb8 Regression tests for yair Benita's additions to SeqUtils
idoerg authored
27 X.print_index()
28
7378e8a @superbobry Partially migrated to print-function-like syntax
superbobry authored
29 print("-" * 60)
30 print("codon adaptation index for test gene: %.2f" % X.cai_for_gene("ATGAAACGCATTAGCACCACCATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGA"))
Something went wrong with that request. Please try again.