[BioPython] suggestion on Fasta.index_file()

CL WU anewgene at hotpop.com
Sun Nov 23 01:19:30 EST 2003


Hi, group,
              Biopython's Fasta module provides a convenient way to 
generate a index file for a large fasta file. However, the generated 
index file stores the absolute path for fasta_seq_file, thus, the 
generated index file can not be used once the fasta_seq_file was moved. 
For my case, I store fasta_seq_file and its index file at a network 
drive and I need to access it from both windows and linux server. The 
original index file can not be used for both environments. To solve this 
problem, I modified two lines of Bio/Fasta/__init__.py as below. As the 
result, it require the index file is placed at the same directory of 
fasta_seq_file.

class Dictionary:
     ...
    def __init__(self, indexname, parser=None):
        ...
        #self._handle = open(self._index[Dictionary.__filename_key])
        self._handle = 
open(os.path.join(os.path.split(indexname)[0],self._index[Dictionary.__filename_key]))
...
def index_file(filename, indexname, rec2key=None):
    ...
    #index[Dictionary._Dictionary__filename_key] = filename
    index[Dictionary._Dictionary__filename_key] = os.path.split(filename)[1]

Do you it's worth to make this modification? Or, any better solution? 
Please discuss.

Thanks.

Chunlei Wu




More information about the BioPython mailing list