Issue
I am trying to pass BioPython sequences to Ilya Stepanov's implementation of Ukkonen's suffix tree algorithm in iPython's notebook environment. I am stumbling on the argparse component.
I have never had to deal directly with argparse before. How can I use this without rewriting main()?
By the by, this writeup of Ukkonen's algorithm is fantastic.
Solution
I've had a similar problem before, but using optparse
instead of argparse
.
You don't need to change anything in the original script, just assign a new list to sys.argv
like so:
if __name__ == "__main__":
from Bio import SeqIO
path = '/path/to/sequences.txt'
sequences = [str(record.seq) for record in SeqIO.parse(path, 'fasta')]
sys.argv = ['-f'] + sequences
main()
Answered By - BioGeek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.