Hi
I am trying to use pyDNA to stimulate a simple cloning example that I know should work as a positive control.
My code given below does generate two fragments whose Dseqrecord outputs are given below . The overhangs in printed output seem to have the correct ends. Yet the circular assembly is blank and hence does not print any output. Any help troubleshooting this will be greatly appreciated. Its been a long time since I used pyDNA and know I am close to getting this example to work.
Thanks for a great library and for your help
Hari
My output:
Dseqrecord
circular: False
size: 3971
ID: id
Name: name
Description: description
Number of features: 0
/molecule_type=DNA
Dseq(-3971)
GGTCATC..AAAA
GTAG..TTTTTAC
Dseqrecord
circular: False
size: 4143
ID: id
Name: name
Description: description
Number of features: 0
/molecule_type=DNA
Dseq(-4143)
ATGAAGA..GGAC
TTCT..CCTGCCA
Assembled products:
#########################
Code with Vector file and input truncated
#########################
# Import necessary modules from pyDNA
from io import StringIO
from Bio import SeqIO
from pydna.dseqrecord import Dseqrecord
from pydna.assembly import Assembly
from pydna.amplify import Anneal
from Bio.Restriction import SapI
# Step 1: Import the GenBank file for the plasmid vector
# Assume the file "pd441-ch.gb" is in the current directory
genbank_file = "inputvector.gb"
biopython_record = SeqIO.read(genbank_file, "genbank")
# Convert Biopython SeqRecord to pydna Dseqrecord
plasmid = Dseqrecord(biopython_record.seq, circular=False)
# Verify the plasmid import
# print(f"Pasmid Sequence:{plasmid}")
# Step 2: Simulate the digestion of the vector with SapI to generate the backbone
backbone_digested = plasmid.cut(SapI)
# Verify the digestion result
backbone = None
for index,fragment in enumerate(backbone_digested):
if len(fragment) > 1000:
backbone = fragment
# Step 3: Represent an insert sequence from a text string
insert_sequence_str = "TACACGTACTTAGTCGCTGAAGCT..........GGGGACGGTAGAAGAGCCGTCAATCGAGTTCGTACCTA"
insert_sequence = Dseqrecord(insert_sequence_str)
# Verify the insert sequence
# print(insert_sequence)
# Step 4: Simulate the digestion of the insert sequence with SapI
insert_digested = insert_sequence.cut(SapI)
insert_chosen = None
for index,fragment in enumerate(insert_digested):
if len(fragment.seq) >= 1000:
insert_chosen = fragment
# Step 5: Assemble the digested backbone and insert sequences
# Assuming we have identified the correct backbone and insert fragments to ligate
# Here we select the first fragment of each for simplicity
print(backbone)
print(insert_chosen)
assembly = Assembly([insert_chosen,backbone])
assembled_products = assembly.assemble_circular()
# Verify the assembly result
print("Assembled products:")
for product in assembled_products:
print(product)
if product.ok():
print("Assembly successful!")
else:
print("Assembly failed.")