Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Kronopt committed Jan 27, 2020
1 parent 0005cd3 commit 3fa9a96
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ $ pip install fastaparser
```

## Usage

### Read FASTA files
Generate python objects from FASTA files:

```Python
>>> import fastaparser
>>> with open("fasta_file.fasta") as fasta_file:
Expand Down Expand Up @@ -54,6 +57,27 @@ Header: >sp|P15822|ZEP1_HUMAN Zinc finger protein 40 OS=Homo sapiens OX=9606 GN.
Sequence: MPRTKQIHPRNLRDKIEEAQKELNGAEVSKKEILQAGVKGTSESLKGVKRKKIVAENHLKKIPKSPLRN...
```

### Write FASTA files
Create FASTA files from FastaSequence objects:
```Python
>>> import fastaparser
>>> with open("fasta_file.fasta", 'w') as fasta_file:
writer = fastaparser.Writer(fasta_file)
fasta_sequence = fastaparser.FastaSequence(
sequence='ACTGCTGCTAGCTAGC',
id='id123',
description='test sequence'
)
writer.writefasta(fasta_sequence)
```
or single header and sequence strings:
```Python
>>> import fastaparser
>>> with open("fasta_file.fasta", 'w') as fasta_file:
writer = fastaparser.Writer(fasta_file)
writer.writefasta(('id123 test sequence', 'ACTGCTGCTAGCTAGC'))
```

## Documentation
Documentation for FastaParser is available here: [fastaparser.rtfd.io](https://fastaparser.readthedocs.io/en/latest/)

Expand Down

0 comments on commit 3fa9a96

Please sign in to comment.