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LjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square)

# Table of sgRNA with radial representation

![example display](https://github.com/sophielem/result_page_crispr/blob/master/docs/exmaple.png)

## Usage
Need property to launch integrated components. So need *complete_data* to create the __table-crispr__ component to the left side and *alL_data*, *org_names* and potentially *gene* to create __genomic-card__ component.

If the *gene* property is given, then the __linear-card__ component is created when the user click on a sector on the sunburst.

#### complete_data
A list of dictionary object in JSON format. Each dictionary has two keys : sequence and occurences. Occurences contains a list of dictionary object with org and all_ref as keys. all_ref contains a list of dictionary object with ref and coords keys which contains a list of coordinates. Coordinate must match the regex : __[+-]\\([0-9]\*,[0-9]*\\)__
```JSON
[
    {
        "sequence": "AAAACTCAAATGAATTGACGGGG",
        "occurences": [
            {
                "org": "Buchnera aphidicola (Cinara tujafilina) GCF_000217635.1",
                "all_ref": [
                    {
                        "ref": "NC_015662.1",
                        "coords": [
                            "-(195725,195747)"
                        ]
                    }
                ]
            },
            {
                "org": "Aliivibrio wodanis GCF_000953695.1",
                "all_ref": [
                    {
                        "ref": "NZ_LN554846.1",
                        "coords": [
                            "+(2675080,2675102)",
                            "+(2862314,2862336)",
                            "+(2959996,2960018)",
                            "-(507284,507306)",
                            "-(559657,559679)",
                            "-(661047,661069)"
                        ]
                    },
                    {
                        "ref": "NZ_LN554847.1",
                        "coords": [
                            "+(894485,894507)"
                        ]
                    }
                ]
            }
        ]
    }
]
```

#### all_data
A dictionary of organisms selected in JSON format with their referencesn sgRNA on them and their coordinates which must match the regex : __[+-]\\([0-9]\*,[0-9]*\\)__

```JSON
{
  "Buchnera aphidicola (Cinara tujafilina) GCF_000217635.1":
  {"NC_015662.1":
    {"AAAACTCAAATGAATTGACGGGG":
      ["-(195725,195747)"],
    "AAACTCAAATGAATTGACGGGGG":
      ["-(195726,195748)"],
    "TCCCCACTGCTGCCTCCCGTAGG":
      ["+(506719,506741)", "+(559092,559114)", "+(660482,660504)", "-(2675645,2675667)", "-(2862879,2862901)", "-(2960561,2960583)"]
    }
  },
  "Aliivibrio wodanis GCF_000953695.1":
    {"NZ_LN554846.1":
      {"AAAACTCAAATGAATTGACGGGG":
        ["+(2675080,2675102)", "+(2862314,2862336)", "+(2959996,2960018)", "-(507284,507306)", "-(559657,559679)", "-(661047,661069)"]
      },
    "NZ_LN554847.1":
      {"AAAACTCAAATGAATTGACGGGG":
        ["+(894485,894507)"]
      }
    }
}
```

#### org_names
A string of organisms names selected seperated by "&".
```
"Enterobacter sp. 638 GCF_000016325.1&Candidatus Blochmannia vafer str. BVAF GCF_000185985.2"
```

#### size
If no precise, all size are set to 4,518,734.
```JSON
{
  "Enterobacter sp. 638 GCF_000016325.1":
    {"NC_009436.1":100000},
  "Candidatus Blochmannia vafer str. BVAF GCF_000185985.2":
    {"NC_014909.2": 2000000}}
```

#### gene
A dictionary object with organisms as keys and their references. Then, a list of dictionary with *start* and *end* keys to indicate coordinates of gene.
```JSON
{
  "Enterobacter sp. 638 GCF_000016325.1":
    {"NC_009436.1":
      [{"start": "255180", "end": "255599"}, {"start": "842680", "end": "843099"}, {"start": "3343077", "end": "3343496"}, {"start": "4024310", "end": "4024729"}, {"start": "4269724", "end": "4270143"}, {"start": "4360796", "end": "4361215"}, {"start": "4466539", "end": "4466958"}]
    },
  "Candidatus Blochmannia vafer str. BVAF GCF_000185985.2":
    {"NC_014909.2":
      [{"start": "626246", "end": "626664"}]
    }
}
```


## Event
 \*\*\*\*\* __GENOMIC-CARD__  \*\*\*\*\*
### Emit
* __changeOrgCard__ : sent the name of the organism selected

* __changeRefCard__ : sent the reference selected

* __changeSgrnaCard__ : sent the sgRNA selected

* __sgDataSection__ : sent : *allSgrna* --> dictionary of sgRNA with their coordinates in a list<br> *gene* --> a list of dictionary containing start and stop for genes

### Send
* __changeOrgCard__ : change the organism selected, find data associated to this organism and create a new representation

* __changeRefCard__ : change the reference selected, find data associated and create a new representation

* __changeSgrnaCard__ : represent sgRNA selected by a red vertical line around the circle

* __changeOrgRefSgrna__ : find name of the organism name and its reference in *axis* key and sgRNA selected in *sgrna* key. Find data associated and create a new representation

## Authors
Sophie LEMATRE

## Date
July 22 2019
