From 3fa9a964d4014588ce2b9e1b51db98605d231fc2 Mon Sep 17 00:00:00 2001 From: Kronopt Date: Mon, 27 Jan 2020 20:42:22 +0000 Subject: [PATCH] Update README.md --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 57a14fb..846e756 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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/)