简体   繁体   中英

How do I extract specific text values from a Genbank (.gb) file (Python, BioPython package)

This may sound like a dumb question, but how do I extract a specific text value from a GenBank file? I want to be able to take that text value and print that onto a separate text file but for now I just want to figure out how to retrieve that specific number.

我要检索的文本值

I was able to achieve this with the GenBank file ID by using some Biopython commands but I am very new to Biopython and cannot seem to figure a way to retrieve the CDS number.

我用来检索 GenBank 文件 ID 号的代码

代码输出

The SeqRecord object has additional attributes, among which features is a list of SeqFeature objects and will be where CDS information would be stored (if present).

For example, the following would print the start location of all CDS features in a SeqRecord :

for f in genbank_object.features:
  if f.type == "CDS":
    print(f.location.start.position)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM