[Biopython] error writing fasta file using SeqIO

A M Torres, Hugo mnemonico at posthocergopropterhoc.net
Tue Jul 12 07:59:54 UTC 2011


Yes of course! I should've known. Thanks a bunch, this one was killing me.

On Mon, Jul 11, 2011 at 2:02 PM, Wibowo Arindrarto
<w.arindrarto at gmail.com>wrote:

> Hi Hugo,
>
> I think you should pass 'alinhar' as the argument for subprocess.call()
> instead of 'needle_cline'. You can use the 'needle_cline' for the argument,
> but you should also set shell to true, so the command
> is subprocess.call(needle_cline, shell=True).
>
> Hope that helps.
> ---
> Wibowo Arindrarto (bow)
> http://bow.web.id
>
>
>
> On Mon, Jul 11, 2011 at 08:22, A M Torres, Hugo <
> mnemonico at posthocergopropterhoc.net> wrote:
>
>> Hi folks.
>>
>> Thanks once again for helping me out. That problem is solved. I took a
>> look at the glob module. It is really just neat!
>>
>> A new problem has arised when I try to call the process that should run
>> the sequence alignment. I try to use the 'needle' subprocess but it fails
>> with this error: http://paste.pound-python.org/show/9395/.
>>
>> Here is how the code looks now: http://paste.pound-python.org/show/9394/.
>>
>> The weird thing is needle executes ok when I use needle_cline as it is in
>> a bash shell. I took care to write full paths when pointing to individual
>> files and the needle binary but that hasn't solved the error.
>>
>> Any clues?
>>
>>
>> On Fri, Jul 8, 2011 at 1:46 AM, Wibowo Arindrarto <w.arindrarto at gmail.com
>> > wrote:
>>
>>> Hi Hugo,
>>>
>>> I think the problem is you tried to concatenate a SeqRecord object and a
>>> string object. Do this in 'salva_fasta' instead:
>>>
>>> SeqIO.write([obj_SeqRecord], obj_SeqRecord.id + '.fasta', 'fasta')
>>>
>>> And just as an additional input, in the 'processar_lote' method, you can
>>> use this to generate a list of absolute file name paths (import the os and
>>> glob module beforehand).
>>>
>>> files = [os.path.abspath(x) for x in glob.glob('*.ab1')]
>>>
>>> os.path.abspath() returns the absolute file path for a given file, and
>>> glob.glob() returns a list of names that matches the given pattern.
>>>
>>> Hope that helps!
>>> ---
>>> Wibowo Arindrarto (bow)
>>> http://bow.web.id
>>>
>>>
>>>
>>>
>>
>



More information about the Biopython mailing list