How can I calculate the codon adaptation index of my sequences with Biopython?
2
1
Entering edit mode
8.3 years ago
philipp ▴ 30

Hi there,

I need to figure out if my sequences have been codon optimized. I learned about the Biopython CodonUsage module and tried to get it running. When I run my code:

from Bio import SeqIO
from Bio.SeqUtils import CodonUsage
from Bio.SeqUtils.CodonUsage import CodonAdaptationIndex

Sequence = SeqIO.read("my_seq.fasta", format="fasta")

Seq_Cai = CodonUsage.CodonAdaptationIndex()

Seq_Cai.cai_for_gene(Sequence)

print(SeqCai)

I receive an error: "AttributeError: 'SeqRecord' object has no attribute 'islower' ". I looked that error up but cannot find a solution. Please forgive me if that question is stupid, I started coding a few days ago. Your help is very much appreciated!

Thanks, Philipp

codon biopython optimization • 3.9k views
ADD COMMENT
2
Entering edit mode
8.3 years ago
Asaf 10k

The input should be a string, not SeqRecord. Make sure you set the index first. http://biopython.org/DIST/docs/api/Bio.SeqUtils.CodonUsage.CodonAdaptationIndex-class.html

ADD COMMENT
0
Entering edit mode
8.3 years ago
philipp ▴ 30

Thanks for the hint. I got that script working.

ADD COMMENT

Login before adding your answer.

Traffic: 1604 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6