except AlphabetError:
pass
try:
return NucleotideSequence(nuc_seq_str, ambiguous=True)
except AlphabetError:
raise ValueError("FASTA data cannot be converted either to """NucleotideSequence" nor to "ProteinSequence"")
After Change
seq_str = seq_str.replace("U", "C")
else:
warn = False
prot_seq = ProteinSequence(seq_str)// Raise Warning after conversion into "ProteinSequence"// to wait for potential "AlphabetError"if warn:
warnings.warn(
"ProteinSequence objects do not support selenocysteine (U), ""occurrences were substituted by cysteine (C)"
)
return prot_seq
except AlphabetError:
raise ValueError("FASTA data cannot be converted either to """NucleotideSequence" nor to "ProteinSequence"")