Skip to content
This repository was archived by the owner on Jun 16, 2018. It is now read-only.
This repository was archived by the owner on Jun 16, 2018. It is now read-only.

PyFasta - Splitting large headers #6

@quacksawbones

Description

@quacksawbones

I am receiving some strange issues with PyFasta concerning splitting large headers within a Python script.

This is the code:

from pyfasta import Fasta

compare = Fasta('./test_pyfasta.fasta', key_fn=lambda key: key.split()[0])
print compare.keys()

when using the two sequences in my test dataset:

Ch_kdna_pair1_1|Len:90
AAAGAAGTTATCACTGTGTTTATACGTAAGTTATCAGGCCTGCTACACGTAAAGTATCAGACTATTAAACAAGTCACCC
CGGGGTCAAAG
Bx_kdna_pair1_4 Len:90
AAGCTGCGTCCTGACCGCGAAAAGACTTAGGCCCCGTTTGTTAGCTTAGTATTTTTAAAGTATTCTGAGAATACTACAT
TTTTTCAGATT

it will only split the space, NOT the pipe. I have some other files where I intend to (hopefully) split by "." rather than by " " or "|". Is there any way to specify the delimiting character, similar to the string.split function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions