add extract seq from promoter

This commit is contained in:
mpabi 2024-06-14 19:36:10 +02:00
parent 7bdf12aa0d
commit dd24d02591
1 changed files with 48 additions and 0 deletions

48
gfp2.py
View File

@ -330,3 +330,51 @@ diagram.draw(format="circular", circular=True, pagesize='A4', start=0, end=len(r
diagram.write("pdf/plasmid_map.pdf", "PDF") diagram.write("pdf/plasmid_map.pdf", "PDF")
print("Zapisano diagram plazmidu do pliku 'plasmid_map.pdf'") print("Zapisano diagram plazmidu do pliku 'plasmid_map.pdf'")
#%%
class Model:
complement = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
def __init__ (self, seq=None):
self.seq = seq
def complement_dna(self):
complementary_sequence = ''.join(complement[base] for base in self.seq)
return complementary_sequence
#%%
promoter_models = []
# Iterate through the features in the record
for feature in record.features:
if feature.type == "promoter":
print(f"Type: {feature.type}")
print(f"Location: {feature.location}")
print(f"Strand: {'+' if feature.strand == 1 else '-'}")
# Extract the sequence from the feature
# Assuming the sequence is stored in feature.sequence (you might need to adjust this)
sequence = feature.extract(record.seq) # This is a common way to extract sequences in Biopython
# Create a Model object with the sequence
model_object = Model(seq=str(sequence))
# Add the Model object to the list
promoter_models.append(model_object)
#%%
r = Model(a)
#%%
for feature in record.features:
if feature.type in ["promoter",]:
print(f"Type: {feature.type}")
print(f"Location: {feature.location}")
print(f"Strand: {'+' if feature.strand == 1 else '-'}")