How to get antisense sequence from any strings ?
Opened this issue · 1 comments
galaxy001 commented
How to make a new Read object from string, so that I can call Read.antisense ?
fa = pyfastx.Fastx("x.fq")
for name,seq,_ in fa:
seqF = seq[:100]
I want to get antisense of seqF
.
However, fa[-1][:100]
not working as "TypeError: 'Read' object is not subscriptable".
lmdu commented
Currently, the Read object of pyfastx could not support for slicing. You can implement a function for conversion like this:
def reverse_complement(s):
bases = {'A': 'T', 'G': 'C', 'T': 'A', 'C': 'G', 'N': 'N'}
return ''.join([bases[b] for b in s][::-1])
fa = pyfastx.Fastx("x.fq")
for name, seq, _ in fa:
seqF = reverse_complement(seq[:100])