brentp/pyfasta — Issue #5: problems with pyfasta extract
Author: ialbert
Created: 2011-10-12 20:51:11+00:00
State: open

I am unable to make pyfasta extract work, it used to work for version 0.3.9. See error below.

Moreover there is a different error if the flat and gdx files are not present to begin with.

Error after running pyfasta info on the sequence:

$ head -1 mini.fasta
>chr01

ialbert@airy ~/refs/tmp
$ pyfasta extract --fasta mini.fasta chr01
Traceback (most recent call last):
File "/usr/local/bin/pyfasta", line 8, in
load_entry_point('pyfasta==0.4.3', 'console_scripts', 'pyfasta')()
File "/Library/Python/2.6/site-packages/pyfasta/__init__.py", line 37, in main
globals()[action](sys.argv[2:])
File "/Library/Python/2.6/site-packages/pyfasta/__init__.py", line 133, in extract
seq = f[seqname]
File "/Library/Python/2.6/site-packages/pyfasta/fasta.py", line 112, in __getitem__
c = self.index[i]
KeyError: None

Second type of error if no flat and gdx files are present when running the pyfasta extract:

$ pyfasta extract --fasta mini.fasta chr01
Traceback (most recent call last):
File "/usr/local/bin/pyfasta", line 8, in
load_entry_point('pyfasta==0.4.3', 'console_scripts', 'pyfasta')()
File "/Library/Python/2.6/site-packages/pyfasta/__init__.py", line 37, in main
globals()[action](sys.argv[2:])
File "/Library/Python/2.6/site-packages/pyfasta/__init__.py", line 126, in extract
f = Fasta(options.fasta, key_fn=key_fn)
File "/Library/Python/2.6/site-packages/pyfasta/fasta.py", line 47, in __init__
flatten_inplace)
File "/Library/Python/2.6/site-packages/pyfasta/records.py", line 59, in prepare
for i, (seqid, seq) in enumerate(seqinfo_generator):
File "/Library/Python/2.6/site-packages/pyfasta/fasta.py", line 75, in gen_seqs_with_headers
raise DuplicateHeaderException(header)
pyfasta.fasta.DuplicateHeaderException: headers must be unique: None is duplicated