This repo contains several classes to help work with Genbank files
The flow goes:
File -> Locus -> Feature
To use:
from genbank.file import File
file = File('infile.gbk')
for locus in file:
print(locus.name())
for feature in locus:
print(feature)
You can also build a Locus object from the ground up:
from genbank.locus import Locus
locus = Locus('test', 'actgactgatcgtagctagc')
# then add a feature by parsing text of a genbank feature
locus.read_feature(' CDS 1..9')
# or add manually by specifing the type,strand,location
locus.add_feature('CDS',+1,[['6','20']])
locus.write('genbank')
which gives:
LOCUS test 20 bp
FEATURES Location/Qualifiers
CDS 1..9
CDS 6..20
ORIGIN
1 actgactgat cgtagctagc
//
This package also allows you to perform various conversions on a given genome file:
You can also slice the locus to a specified range and only the nucleotides and
features that occur within the slice are kept. The command to take the first two
hundred bases of the phiX174 genome is shown below.
genbank
Python code to work with Genbank files
This repo contains several classes to help work with Genbank files
The flow goes:
To use:
You can also build a Locus object from the ground up:
which gives:
This package also allows you to perform various conversions on a given genome file:
You can also slice the locus to a specified range and only the nucleotides and features that occur within the slice are kept. The command to take the first two hundred bases of the phiX174 genome is shown below.
The slice arguement can be paired with all the other output format options:
You can also easily edit features by running multiple commands.
Print out the features of a specified key:tag into a file
Change the H of the second gene to something more informative: (ideally you will have columns from other sources, like excel)
Edit all the features of a specified key:tag with the updated labels: