epam / epam/Indigo

Reading and writing GenBank format files

Open
#3,046 0 comments 0 reactions 0 assignees View on GitHub
Import from GB
Dominant language
C++
Stars
406
Forks
134
Avg merge
2d 11h
Merged PRs (30d)
24

Description

## Background
For proper plasmid support in Ketcher, Indigo should be able to read (and write) GenBank files.
Four important pieces of information are needed for this first implementation:
- DNA/RNA (explicitly stated in the file LOCUS section)
- Single stranded/Double stranded (double stranded assumed, unless otherwise stated in the DEFINITION or COMMENT sections)
- Linear/Circular (explicitly stated in the file LOCUS section)
- Sequence (single strand explicitly stated in the file ORIGIN section)

## Antisense Complements

### RNA complementary bases

| Sense base | Antisense base |
| --- | --- |
| Adenine, and all other bases with natural analogue A | U (uracil) |
| Cytosine, and all other bases with natural analogue C | G (guanine) |
| Guanine, and all other bases with natural analogue G | C (cytosine) |
| Thymine, and all other bases with natural analogue T | A (adenine) |
| Uracil, and all other bases with natural analogue U | A (adenine) |
| N (ambiguous DNA base) and N (ambiguous RNA base) | N (ambiguous RNA base) |
| B (ambiguous DNA base) and B (ambiguous RNA base) | V (ambiguous base) |
| D (ambiguous DNA base) and D (ambiguous RNA base) | H (ambiguous RNA base) |
| H (ambiguous DNA base) and H (ambiguous RNA base) | D (ambiguous RNA base) |
| K (ambiguous DNA base) and K (ambiguous RNA base) | M (ambiguous base) |
| W (ambiguous DNA base) and W (ambiguous RNA base) | W (ambiguous RNA base) |
| Y (ambiguous DNA base) and Y (ambiguous RNA base) | R (ambiguous base) |
| M (ambiguous base) | K (ambiguous RNA base) |
| R (ambiguous base) | Y (ambiguous RNA base) |
| S (ambiguous base) | S (ambiguous base) |
| V (ambiguous base) | B (ambiguous RNA base) |

### DNA complementary bases

| Sense base | Antisense base |
| --- | --- |
| Adenine, and all other bases with natural analogue A | T (thymine) |
| Cytosine, and all other bases with natural analogue C | G (guanine) |
| Guanine, and all other bases with natural analogue G | C (cytosine) |
| Thymine, and all other bases with natural analogue T | A (adenine) |
| Uracil, and all other bases with natural analogue U | A (adenine) |
| N (ambiguous DNA base) and N (ambiguous RNA base) | N (ambiguous DNA base) |
| B (ambiguous DNA base) and B (ambiguous RNA base) | V (ambiguous base) |
| D (ambiguous DNA base) and D (ambiguous RNA base) | H (ambiguous DNA base) |
| H (ambiguous DNA base) and H (ambiguous RNA base) | D (ambiguous DNA base) |
| K (ambiguous DNA base) and K (ambiguous RNA base) | M (ambiguous base) |
| W (ambiguous DNA base) and W (ambiguous RNA base) | W (ambiguous DNA base) |
| Y (ambiguous DNA base) and Y (ambiguous RNA base) | R (ambiguous base) |
| M (ambiguous base) | K (ambiguous DNA base) |
| R (ambiguous base) | Y (ambiguous DNA base) |
| S (ambiguous base) | S (ambiguous base) |
| V (ambiguous base) | B (ambiguous DNA base) |

## Requirements for reading GenBank files

1. From the LOCUS section of the file, Indigo should extract following information:
- If the sequence is DNA or RNA;
- If the sequence is linear or circular;

2. From the ORIGIN section of the file, Indigo should extract following information:
- The single-stranded sequence.

3. Ketcher will pass to Indigo the following information:
- If the sequence is single-stranded or double-stranded.

4. If the sequence is DNA, every letter of the sequence is interpreted as a nucleotide or nucleoside (see requirement 6), with deoxyribose as the sugar, phosphate as the phosphate, and the appropriate natural base (A, C, G, or T).

5. If the sequence is RNA, every letter of the sequence is interpreted as a nucleotide or nucleoside (see requirement 6), with ribose as the sugar, phosphate as the phosphate, and the appropriate natural base (A, C, G, or U).

6. If the sequence is linear, the last letter of the sequence represents a nucleoside (a sugar-base pair without a phosphate).

7. If the sequence is circular, the last letter of the sequence represents a nucleotide, where the phosphate of the nucleotide is connected via an R1-R2 bond with the sugar of the first nucleotide.

8. If the sequence is single-stranded, only the sequence stored in the file itself needs to be taken into account.

9. If the sequence is double stranded, an appropriate complement should be added for every nucleotide/nucleoside (see Antisense Complements section of the ticket). Complementary bases should be connected via a single bond.

## Examples of reading GenBank files

Sequence is: ACGACG

1. It represents a single-stranded, linear RNA sequence:

Image

2. It represents a single-stranded, linear DNA sequence:

Image

3. It represents a single-stranded, circular RNA sequence:

Image

4. It represents a single-stranded, circular DNA sequence:

Image

5. It represents a double-stranded, linear RNA sequence:

Image

6. It represents a double-stranded, linear DNA sequence:

Image

7. It represents a double-stranded, circular RNA sequence:

Image
(NOTE: There is an issue on Ketcher's side with the visual representation of these sequences - incorrect terminal indicator, an the base numbering of the antisense strand)

8. It represents a double-stranded, circular DNA sequence:

Image
(NOTE: There is an issue on Ketcher's side with the visual representation of these sequences - incorrect terminal indicator, an the base numbering of the antisense strand)

## Requirements for writing GenBank files:

## Example GenBank files

More information about the file can be found at the [link]
(https://www.ncbi.nlm.nih.gov/genbank/samplerecord/).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.