From 995a65f99763e78ddc2d763366740d4275af7831 Mon Sep 17 00:00:00 2001 From: Eachan Johnson Date: Tue, 16 May 2023 13:42:22 +0100 Subject: [PATCH] Add language tags to docs code blocks --- README.md | 26 +++++++++++++------------- docs/source/installation.md | 4 ++-- docs/source/usage.md | 26 +++++++++++--------------- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index ddcd5db..f5ade88 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Python utilities for working with nucleotide sequence strings. Install the pre-compiled version from PyPI: -``` +```bash pip install streq ``` @@ -16,7 +16,7 @@ pip install streq Clone the repository, then `cd` into it. Then run: -``` +```bash pip install -e . ``` @@ -29,7 +29,7 @@ Sequences can be upper or lower case, and case will be preserved through transfo Reverse complement. -``` +```python >>> import streq as sq >>> >>> sq.reverse_complement('ATCG') @@ -38,7 +38,7 @@ Reverse complement. Convert between RNA and DNA alphabets. -``` +```python >>> sq.to_rna('ATCG') 'AUCG' >>> sq.to_dna('AUCG') @@ -47,7 +47,7 @@ Convert between RNA and DNA alphabets. Slice circular sequences such as plasmids or bacterial genomes. -``` +```python >>> sq.Circular('ATCG')[-1:3] 'GATC' >>> sq.reverse_complement(sq.Circular('ATCG'))[-1:3] @@ -56,7 +56,7 @@ Slice circular sequences such as plasmids or bacterial genomes. Cases are preserved throughout the transformations. -``` +```python >>> sq.reverse_complement(sq.Circular('ATCg')) 'cGAT' ``` @@ -65,7 +65,7 @@ Cases are preserved throughout the transformations. Get GC and pyrimidine content. -``` +```python >>> sq.gc_content('AGGG') 0.75 >>> sq.pyrimidine_content('AUGGG') @@ -74,7 +74,7 @@ Get GC and pyrimidine content. Get autocorrelation (rough indicator for secondary structure). -``` +```python >>> sq.correlation('AACC') 0.0 >>> sq.correlation('AAATTT') @@ -87,7 +87,7 @@ Get autocorrelation (rough indicator for secondary structure). Provide a second sequence to get correlation between sequences. -``` +```python >>> sq.correlation('AAA', 'TTT') 0.0 >>> sq.correlation('AAA', 'AAA') @@ -98,7 +98,7 @@ Provide a second sequence to get correlation between sequences. Calculate Levenshtein (insert, delete, mutate) distance. -``` +```python >>> sq.levenshtein('AAATTT', 'AAATTT') 0 >>> sq.levenshtein('AAATTT', 'ACTTT') @@ -109,7 +109,7 @@ Calculate Levenshtein (insert, delete, mutate) distance. Calculate Hamming (mismatch) distance. -``` +```python >>> sq.hamming('AAA', 'ATA') 1 >>> sq.hamming('AAA', 'ATT') @@ -122,7 +122,7 @@ Calculate Hamming (mismatch) distance. Search sequences using IUPAC symbols and iterate through the results. -``` +```python >>> for (start, end), match in sq.find_iupac('ARY', 'AATAGCAGTGTGAAC'): ... print(f"Found ARY at {start}:{end}: {match}") ... @@ -134,7 +134,7 @@ Found ARY at 12:15: AAC Find common Type IIS restriction sites: -``` +```python >>> sq.which_re_sites('AAAGAAG') () >>> sq.which_re_sites('AAAGAAGAC') diff --git a/docs/source/installation.md b/docs/source/installation.md index db81b83..bc9b71e 100644 --- a/docs/source/installation.md +++ b/docs/source/installation.md @@ -4,7 +4,7 @@ Install the pre-compiled version from PyPI: -``` +```bash pip install streq ``` @@ -12,6 +12,6 @@ pip install streq Clone the repository, then `cd` into it. Then run: -``` +```bash pip install -e . ``` \ No newline at end of file diff --git a/docs/source/usage.md b/docs/source/usage.md index 0ff90a4..4b52f92 100644 --- a/docs/source/usage.md +++ b/docs/source/usage.md @@ -7,7 +7,7 @@ Sequences can be upper or lower case, and case will be preserved through transfo Reverse complement. -``` +```python >>> import streq as sq >>> >>> sq.reverse_complement('ATCG') @@ -16,7 +16,7 @@ Reverse complement. Convert between RNA and DNA alphabets. -``` +```python >>> sq.to_rna('ATCG') 'AUCG' >>> sq.to_dna('AUCG') @@ -25,7 +25,7 @@ Convert between RNA and DNA alphabets. Slice circular sequences such as plasmids or bacterial genomes. -``` +```python >>> sq.Circular('ATCG')[-1:3] 'GATC' >>> sq.reverse_complement(sq.Circular('ATCG'))[-1:3] @@ -34,7 +34,7 @@ Slice circular sequences such as plasmids or bacterial genomes. Cases are preserved throughout the transformations. -``` +```python >>> sq.reverse_complement(sq.Circular('ATCg')) 'cGAT' ``` @@ -43,7 +43,7 @@ Cases are preserved throughout the transformations. Get GC and pyrimidine content. -``` +```python >>> sq.gc_content('AGGG') 0.75 >>> sq.pyrimidine_content('AUGGG') @@ -52,7 +52,7 @@ Get GC and pyrimidine content. Get autocorrelation (rough indicator for secondary structure). -``` +```python >>> sq.correlation('AACC') 0.0 >>> sq.correlation('AAATTT') @@ -65,7 +65,7 @@ Get autocorrelation (rough indicator for secondary structure). Provide a second sequence to get correlation between sequences. -``` +```python >>> sq.correlation('AAA', 'TTT') 0.0 >>> sq.correlation('AAA', 'AAA') @@ -76,7 +76,7 @@ Provide a second sequence to get correlation between sequences. Calculate Levenshtein (insert, delete, mutate) distance. -``` +```python >>> sq.levenshtein('AAATTT', 'AAATTT') 0 >>> sq.levenshtein('AAATTT', 'ACTTT') @@ -87,7 +87,7 @@ Calculate Levenshtein (insert, delete, mutate) distance. Calculate Hamming (mismatch) distance. -``` +```python >>> sq.hamming('AAA', 'ATA') 1 >>> sq.hamming('AAA', 'ATT') @@ -100,7 +100,7 @@ Calculate Hamming (mismatch) distance. Search sequences using IUPAC symbols and iterate through the results. -``` +```python >>> for (start, end), match in sq.find_iupac('ARY', 'AATAGCAGTGTGAAC'): ... print(f"Found ARY at {start}:{end}: {match}") ... @@ -112,7 +112,7 @@ Found ARY at 12:15: AAC Find common Type IIS restriction sites: -``` +```python >>> sq.which_re_sites('AAAGAAG') () >>> sq.which_re_sites('AAAGAAGAC') @@ -120,7 +120,3 @@ Find common Type IIS restriction sites: >>> sq.which_re_sites('AAAGAAGACACCTGC') ('BbsI', 'PaqCI') ``` - -## Documentation - -Check the API [here](https://streq.readthedocs.io/). \ No newline at end of file