I've been trying to write a code to find a consensus motif in a given sequence, and for this purpose, I was only able to reach till finding a substring in a string. I want to be able to allot multiple nucleotides/amino acids at each position, and also enter N/X representing any of the nucleotides/amino acids. I would very much appreciate any help.
P.S. The post tags represent the languages I'm comfortable understanding.
Edit: Example of the consensus motif - A/T A A G C A A/T/G N N A
Sequence - CGATCGTG TAAGCAGCTA GTCATG
Bolded sequence is the consensus