File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ $ pip install fastaparser
1515```
1616
1717## Usage
18+
19+ ### Read FASTA files
1820Generate python objects from FASTA files:
21+
1922``` Python
2023>> > import fastaparser
2124>> > with open (" fasta_file.fasta" ) as fasta_file:
@@ -54,6 +57,27 @@ Header: >sp|P15822|ZEP1_HUMAN Zinc finger protein 40 OS=Homo sapiens OX=9606 GN.
5457Sequence: MPRTKQIHPRNLRDKIEEAQKELNGAEVSKKEILQAGVKGTSESLKGVKRKKIVAENHLKKIPKSPLRN ...
5558```
5659
60+ ### Write FASTA files
61+ Create FASTA files from FastaSequence objects:
62+ ``` Python
63+ >> > import fastaparser
64+ >> > with open (" fasta_file.fasta" , ' w' ) as fasta_file:
65+ writer = fastaparser.Writer(fasta_file)
66+ fasta_sequence = fastaparser.FastaSequence(
67+ sequence = ' ACTGCTGCTAGCTAGC' ,
68+ id = ' id123' ,
69+ description = ' test sequence'
70+ )
71+ writer.writefasta(fasta_sequence)
72+ ```
73+ or single header and sequence strings:
74+ ``` Python
75+ >> > import fastaparser
76+ >> > with open (" fasta_file.fasta" , ' w' ) as fasta_file:
77+ writer = fastaparser.Writer(fasta_file)
78+ writer.writefasta((' id123 test sequence' , ' ACTGCTGCTAGCTAGC' ))
79+ ```
80+
5781## Documentation
5882Documentation for FastaParser is available here: [ fastaparser.rtfd.io] ( https://fastaparser.readthedocs.io/en/latest/ )
5983
You can’t perform that action at this time.
0 commit comments