# Copyright 2003 by Iddo Friedberg.  All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license.  Please see the LICENSE file that should have been included
# as part of this package.
from __future__ import print_function
from Bio.SeqUtils import CodonUsage
import os
import sys
# first make a CAI object
X = CodonUsage.CodonAdaptationIndex()
# now generate an index from a file
if os.path.exists("./CodonUsage/HighlyExpressedGenes.txt"):
elif os.path.exists("./Tests/CodonUsage/HighlyExpressedGenes.txt"):
    print("Cannot find the file HighlyExpressedGene.txt\nMake sure you run the tests from within the Tests folder")
# alternatively you could use any predefined dictionary like this:
# from CaiIndices import SharpIndex # you can save your dictionary in this file.
# X.SetCaiIndex(SharpIndex)
print("The current index used:")
print("-" * 60)
print("codon adaptation index for test gene: %.2f" % X.cai_for_gene("ATGAAACGCATTAGCACCACCATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGA"))