I want to write a python function that gets a string as input and returns part of the…
- User
I want to write a python function that gets a string as input and returns part of the string based on the criteria below. Here (in double quotes) is an example of how the string might look like:
“v40_promoter em7_promoter bleor <dist100+> sv40_poly(a)_signal lac_operator cap_binding_site <dist100+> cmv_enhancer cmv_promoter 5'ltr(truncated) hiv-1_psi <dist100+> rre <dist100+> gp41_peptide <dist100+> cppt/cts u6_promoter <dist100+> grna_scaffold tight_tre_promoter cas9 nucleoplasmin_nls flag t2a ef-1-alpha_core_promoter puror p2a rtta-advanced wpre 3'ltr(delta-u3) bgh_poly(a)_signal f1_ori lac_promoter <dist100+> ampr_promoter <dist100+> ampr ampr <dist100+> ori”
I want to separate the part that includes the “cas” string and in between two “<dist…>” tags. For the example above it is the following string:
“cas9 nucleoplasmin_nls flag t2a”
If multiple “cas” strings are found, then the function must raise a “InvalidSequenceError” exception. Note that a “cas” string can be at the beginning and the end of a sequence.
First write a few test cases for this in python and then write the python function.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.