def revp(seq: str, k: int) -> List[int]: """ Return positions of reverse palindromes """ kmers = find_kmers(seq, k) revc = map(Seq.reverse_complement, kmers) pairs = enumerate(zip(kmers, revc)) return [pos + 1 for pos, pair in pairs if operator.eq(*pair)]
def main() -> None: """ Make a jazz noise here """ args = get_args() for rec in SeqIO.parse(args.file, 'fasta'): for k in range(4, 13): kmers = find_kmers(str(rec.seq), k) revc = list(map(Seq.reverse_complement, kmers)) for pos, pair in enumerate(zip(kmers, revc)): if operator.eq(*pair): print(pos + 1, k)
def main() -> None: """ Make a jazz noise here """ args = get_args() if seqs := [str(rec.seq) for rec in SeqIO.parse(args.file, 'fasta')]: seq = seqs[0] for k in range(4, 13): kmers = find_kmers(seq, k) revc = map(Seq.reverse_complement, kmers) pairs = enumerate(zip(kmers, revc)) for pos in [pos + 1 for pos, pair in pairs if operator.eq(*pair)]: print(pos, k)
def main() -> None: """ Make a jazz noise here """ args = get_args() if seqs := [str(rec.seq) for rec in SeqIO.parse(args.file, 'fasta')]: seq = seqs[0] for k in range(4, 13): kmers = find_kmers(seq, k) revc = list(map(Seq.reverse_complement, kmers)) for pos, pair in enumerate(zip(kmers, revc)): if fst(pair) == snd(pair): print(pos + 1, k)