I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
#!/usr/bin/env python
import sys
with open(sys.argv[1], 'r') as f:
for line in f:
if line.startswith('>'):
print (line.strip())
else:
print(line.strip()[-20:] + line.strip())
Save as append_last20.py, run as python append_last20.py input.fasta
I think the format shown in original thread was not exact format OP wanted. Actually it is fasta but biostars assumes a line starting with > sign as block quote. Hence this different format.
why would you want to do this?
to change linear sequence to circle transcripts
Thanks so much cschu 181 and venu, both codes worked awesome :))
I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Thank you all for your nice solutions