This is very close! It just isn't working perfectly for me. I actually searched this forum first and have this script you gave in a previous answer, albeit it was specific to a certain feature type. I wasn't sure how to edit it to make it more broad. I'm very glad you saw my question haha.
My first .gbk file is a cluster containing 11 CDSs, of which 3 are full genes. I want the nucleotide sequence for all of these, not just the 3 genes.
Right now it's just pulling the 3 "gene" tags and their sequences, but is ignoring the entries that have no "gene" but only a "locus_tag". Is there a way to parse them based on the "locus_tag" object?
An example of a gene in my file:
gene 2975..4210
/gene="gnl_1"
/locus_tag="CPIDKGOP_01341"
CDS 2975..4210
/EC_number="3.1.1.17"
/codon_start=1
/gene="gnl_1"
/inference="ab initio prediction:Prodigal:2.6"
/inference="similar to AA sequence:UniProtKB:Q01578"
/locus_tag="CPIDKGOP_01341"
/product="Gluconolactonase"
/transl_table=11
/translation="MEQGMRDAQVLNGALARRRVLRGVGAVLGSAMLAPQLVRAQAAGA
AIAPPSTVTQPPRDFGPNGAPTTYFTDPDVLTVDPAFDGLRQPNAAIQRLWTGALWSEG
PAWNSVGRFLVWSDIPNNRQLRWSEDDGHVSVFRSPSNNSNGNTFDYQGRQLSCEHLTR
RVVRYELDGSTTILASTFNGKRLNSPNDVVPHPDGSYWFTDPPYGAQFYEGTVDAAGGP
ANKAGRMNPRLGQPPEIGFYKRELPTAVYRLDKSGTLTQVAGEDLVPDPNGLCFSPDFK
KLYIVSTGQGPGDSIAGGKGDMYAFDVGADNKLSNGKLFSNFMIDGVKCGPDGVRADVD
GNLWCSSNAGRSVGYSGVTVWTPQGRLIGRIRLPEICGNVCFGGPKRNRLFMAASQSLY
AVYTGTQGAAPG"
An example of CDS without a "gene" tag:
gene complement(4231..4512)
/locus_tag="CPIDKGOP_01342"
CDS complement(4231..4512)
/codon_start=1
/inference="ab initio prediction:Prodigal:2.6"
/locus_tag="CPIDKGOP_01342"
/product="hypothetical protein"
/transl_table=11
/translation="MNTLFQKLVLSRLWLSFIVLGLAFLAFGAGTLNLGLLFIANARLL
GAHGWQAVMDGALWQLLELIVTGYLSIAAYVVLKACEHRLSQWLAHER"