I have been using the bedtools to extract fasta sequences based on genomic positions mentioned in a bed file. The command that I usually use os the following:
bedtools getfasta -fi input.fa -bed input.bed -fo out.fa
Now I want to implement the same command line from a python program. This is mainly because I will be doing some downstream analysis using the "bedtools getfasta" output and that part has been entirely written in python. Both the input and the output can be pandas dataframes. I am aware of the "pybedtools" module but my question also extends to integration of other command line tools as well.
or
You may need to pre-define input.fa, input.bed and out.fa before calling them.
Search for cmd in the link below, and see some examples:
https://sourceforge.net/p/fun4me/code/ci/master/tree/fun4me.py