Spaces:
Running
Running
supercat666
commited on
Commit
•
c2ffe9b
1
Parent(s):
f19aae0
fix
Browse files
cas9on.py
CHANGED
@@ -178,8 +178,15 @@ def create_genbank_features(data):
|
|
178 |
|
179 |
|
180 |
def generate_genbank_file_from_df(df, gene_sequence, gene_symbol, output_path):
|
|
|
|
|
|
|
|
|
181 |
features = create_genbank_features(df)
|
182 |
-
|
|
|
|
|
|
|
183 |
description=f'CRISPR Cas9 predicted targets for {gene_symbol}', features=features)
|
184 |
record.annotations["molecule_type"] = "DNA"
|
185 |
SeqIO.write(record, output_path, "genbank")
|
|
|
178 |
|
179 |
|
180 |
def generate_genbank_file_from_df(df, gene_sequence, gene_symbol, output_path):
|
181 |
+
# Ensure gene_sequence is a string before creating Seq object
|
182 |
+
if not isinstance(gene_sequence, str):
|
183 |
+
gene_sequence = str(gene_sequence)
|
184 |
+
|
185 |
features = create_genbank_features(df)
|
186 |
+
|
187 |
+
# Now gene_sequence is guaranteed to be a string, suitable for Seq
|
188 |
+
seq_obj = Seq(gene_sequence)
|
189 |
+
record = SeqRecord(seq_obj, id=gene_symbol, name=gene_symbol,
|
190 |
description=f'CRISPR Cas9 predicted targets for {gene_symbol}', features=features)
|
191 |
record.annotations["molecule_type"] = "DNA"
|
192 |
SeqIO.write(record, output_path, "genbank")
|