Skip to content

Commit 3609a39

Browse files
authored
Merge branch 'staging' into yukthiw/world-efp
2 parents 44a1923 + 33df24f commit 3609a39

11 files changed

Lines changed: 361 additions & 127 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- main
66
- staging
7-
7+
88
permissions:
99
contents: read
1010
pages: write
@@ -27,7 +27,9 @@ jobs:
2727
- run: npm ci
2828
- run: npm run build
2929
env:
30-
BASE_URL: "/ePlant"
30+
BASE_URL: '/ePlant'
31+
VITE_MAPS_API_KEY: ${{ secrets.VITE_MAPS_API_KEY }}
32+
VITE_MAPS_API_KEY: ${{ secrets.VITE_MAPS_ID }}
3133
- run: mv dist _site
3234
- name: Upload artifact
3335
uses: actions/upload-pages-artifact@v2

CODE_OF_CONDUCT

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, visible or invisible disability, ethnicity, sex characteristics, gender
9+
identity and expression, level of experience, education, socio-economic status,
10+
nationality, personal appearance, race, caste, color, religion, or sexual
11+
identity and orientation.
12+
13+
We pledge to act and interact in ways that contribute to an open, welcoming,
14+
diverse, inclusive, and healthy community.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to a positive environment for our
19+
community include:
20+
21+
* Demonstrating empathy and kindness toward other people
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
* Giving and gracefully accepting constructive feedback
24+
* Accepting responsibility and apologizing to those affected by our mistakes,
25+
and learning from the experience
26+
* Focusing on what is best not just for us as individuals, but for the overall
27+
community
28+
29+
Examples of unacceptable behavior include:
30+
31+
* The use of sexualized language or imagery, and sexual attention or advances of
32+
any kind
33+
* Trolling, insulting or derogatory comments, and personal or political attacks
34+
* Public or private harassment
35+
* Publishing others' private information, such as a physical or email address,
36+
without their explicit permission
37+
* Other conduct which could reasonably be considered inappropriate in a
38+
professional setting
39+
40+
## Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of
43+
acceptable behavior and will take appropriate and fair corrective action in
44+
response to any behavior that they deem inappropriate, threatening, offensive,
45+
or harmful.
46+
47+
Community leaders have the right and responsibility to remove, edit, or reject
48+
comments, commits, code, wiki edits, issues, and other contributions that are
49+
not aligned to this Code of Conduct, and will communicate reasons for moderation
50+
decisions when appropriate.
51+
52+
## Scope
53+
54+
This Code of Conduct applies within all community spaces (including issues and pull requests), and also applies when
55+
an individual is officially representing the community in public spaces.
56+
Examples of representing our community include using an official email address,
57+
posting via an official social media account, or acting as an appointed
58+
representative at an online or offline event.
59+
60+
## Enforcement
61+
62+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
63+
reported to the community leaders responsible for enforcement at
64+
[INSERT CONTACT METHOD].
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at
127+
[https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).

CONTRIBUTING.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Contributing to ePlant
2+
3+
First off, thank you for considering contributing to ePlant! By submitting your work, you
4+
agree that it can be shared under the terms of our license.
5+
6+
### Code of Conduct
7+
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
8+
9+
## How to Contribute
10+
11+
### Reporting Bugs
12+
13+
If you find a bug, please create an issue on GitHub with the following information:
14+
15+
- **Summary**: A brief summary of the bug.
16+
- **Steps to Reproduce**: Detailed steps to reproduce the bug.
17+
- **Expected Result**: What you expected to happen.
18+
- **Actual Result**: What actually happened.
19+
- **Screenshots**: Any screenshots that might help us understand the issue.
20+
21+
### Feature Requests
22+
23+
We welcome feature requests! To suggest a new feature, please open an issue on GitHub and provide:
24+
25+
- **Summary**: A brief summary of the feature.
26+
- **Motivation**: Why you think this feature is needed.
27+
- **Use Cases**: How you expect the feature to be used.
28+
- **Workarounds (Optional)**: Any workaround that you currently use.
29+
30+
### Getting started
31+
32+
1. **Fork the repository**: [Click the "Fork" button](https://github.com/BioAnalyticResource/ePlant/fork) at the top of this repository to create your own copy of the project.
33+
34+
2. **Clone the repository**: Go to the new fork. There is a big green button to clone.
35+
```bash
36+
git clone <fork_address>
37+
```
38+
3. **Set upstream**: Set up the main ePlant project as your upstream branch.
39+
```bash
40+
git remote add upstream https://github.com/BioAnalyticResource/ePlant
41+
```
42+
4. **Verify versions**: Most folks are working with _Node v18.0.0^ and npm 9.8.0^. [You can install Node from here.](https://nodejs.org/en/download/package-manager)
43+
```bash
44+
node -v
45+
npm -v
46+
```
47+
5. **Download all dependancies**:
48+
```bash
49+
npm i
50+
```
51+
6. **Run the app locally**:
52+
```bash
53+
npm run dev
54+
```
55+
56+
### Submitting changes
57+
1. **Create a branch**
58+
```bash
59+
git checkout -b your-branch-name
60+
```
61+
2. **Make changes**: Make changes in your forked repository.
62+
3. **Test your changes**: Make sure your changes are working correctly.
63+
4. **Commit your changes**:
64+
```bash
65+
git commit -m "Your commit message"
66+
```
67+
5. **Push to your own fork**:
68+
```bash
69+
git push origin your-branch-name
70+
```
71+
6. **Submit a pull request**: Choose your fork as the head repository and https://github.com/BioAnalyticResource/ePlant/ as the base repository.
72+
73+
#### PR templates
74+
75+
Please include in the PR:
76+
77+
- **Issue**: The issue(s) related to the work done.
78+
- **Previous behaviour**: A description of the behaviour was changed.
79+
- **Updated behaviour**: How the new changes affect the expected behaviour.
80+
- **Notes (Optional)**: Additional notes.
81+
82+
### Code Style
83+
This is an abridged version of the [Google style guide](https://google.github.io/styleguide/tsguide.html) and [MS Typescript Coding guidelines](https://github.com/microsoft/TypeScript/wiki/Coding-guidelines), plus some tweaks to make it our own.
84+
85+
Use Prettier and ESLint for code formatting. You may want to install the plugin for your IDE to get live feedback and you can configure your IDE to apply auto formatting when you save a file. Using the tsconfig.json file, you can customize the rules for type checking. Avoid removing and/or ignoring default rules as much as possible. If you feel strongly about a rule please outline the changes into a PR and we can discuss the merits of introducing a new change.
86+
87+
All the new code must be written in typescript and all the types should be clearly defined in the project.
88+
89+
### Documentation
90+
If your change affects any part of the documentation, please update the `README.md` accordingly.
91+
92+
### Testing
93+
Make sure to run all tests before submitting your changes. If you add new functionality, please include tests for it.
94+
95+
### Getting Help
96+
If you need help, feel free to ask questions by opening an issue. We appreciate your contributions!
97+
98+
Thank you for contributing to ePlant!

Eplant/views/ChromosomeViewer/Viewer/Chromosome.tsx

Lines changed: 14 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// -------
22
// IMPORTS
33
// -------
4-
import React, { FC, useEffect, useLayoutEffect, useState } from 'react'
4+
import React, { FC, useEffect, useState } from 'react'
55

6-
import { useCollections, useGeneticElements } from '@eplant/state'
6+
import { useCollections } from '@eplant/state'
77
import { Unstable_Popup as Popup } from '@mui/base/Unstable_Popup'
88
import ArrowLeft from '@mui/icons-material/ArrowLeft'
99
import Box from '@mui/material/Box'
@@ -17,28 +17,32 @@ import {
1717
GeneAnnotationItem,
1818
GeneRange,
1919
} from '../types'
20-
21-
import GeneAnnotation from './GeneAnnotation'
22-
import GeneList from './GeneList'
2320
import {
2421
getChromosomeSvg,
2522
getChromosomeXCoordinate,
26-
getGeneAnnotation,
2723
pixelToBp,
28-
} from './utilities'
24+
} from '../utilities'
25+
26+
import GeneAnnotation from './GeneAnnotation'
27+
import GeneList from './GeneList'
2928

3029
//----------
3130
// TYPES
3231
//----------
3332
interface ChromosomeProps {
34-
scale: number
3533
chromosome: ChromosomeItem
34+
annotations: GeneAnnotationItem[]
35+
scale: number
3636
}
3737

3838
//----------
3939
// COMPONENT
4040
//----------
41-
const Chromosome: FC<ChromosomeProps> = ({ scale, chromosome }) => {
41+
const Chromosome: FC<ChromosomeProps> = ({
42+
chromosome,
43+
annotations,
44+
scale,
45+
}) => {
4246
// State
4347
const [isHovered, setIsHovered] = useState<boolean>(false)
4448
const [anchorOrigin, setAnchorOrigin] = useState<number[]>([])
@@ -47,13 +51,7 @@ const Chromosome: FC<ChromosomeProps> = ({ scale, chromosome }) => {
4751
start: 0,
4852
end: 0,
4953
})
50-
// Gene Annotation drawing
51-
const [geneAnnotationArray, setGeneAnnotationArray] = useState<
52-
GeneAnnotationItem[]
53-
>([])
5454

55-
// Global State
56-
const [geneticElements] = useGeneticElements()
5755
const [collections] = useCollections()
5856
const theme = useTheme()
5957

@@ -73,45 +71,6 @@ const Chromosome: FC<ChromosomeProps> = ({ scale, chromosome }) => {
7371
// Gene List popover variables
7472
const openPopup = Boolean(anchorEl)
7573

76-
// Fire before paint, converts geneticElements into geneAnnotationArray
77-
useLayoutEffect(() => {
78-
// TODO: move this to top level to prevent uneccessary api calls
79-
const poplar = false
80-
const species = poplar ? 'Populus_trichocarpa' : 'Arabidopsis_thaliana'
81-
let newGeneAnnotationArray: GeneAnnotationItem[] = []
82-
geneticElements.map((gene) => {
83-
// for each item in geneticElements, fetch it's gene information to add to it's geneAnnotation
84-
fetch(
85-
`https://bar.utoronto.ca/eplant${
86-
poplar ? '_poplar' : ''
87-
}/cgi-bin/querygene.cgi?species=${species}&term=${gene.id}`
88-
)
89-
.then((response) => response.json())
90-
.then((geneItem) => {
91-
if (geneItem.chromosome === chromosome.id) {
92-
newGeneAnnotationArray = geneAnnotationArray
93-
const geneAnnotation: GeneAnnotationItem =
94-
getGeneAnnotation(geneItem)
95-
96-
// Make sure new geneAnnotation is not already in geneAnnotationArray
97-
const isDuplicate = newGeneAnnotationArray.some((gene) => {
98-
if (gene.id === geneAnnotation.id) {
99-
return true
100-
}
101-
return false
102-
})
103-
if (!isDuplicate) {
104-
newGeneAnnotationArray.push(geneAnnotation)
105-
setGeneAnnotationArray(newGeneAnnotationArray)
106-
}
107-
}
108-
})
109-
.catch((err) => {
110-
console.log(err)
111-
})
112-
})
113-
}, [])
114-
11574
// Execute on first render, after paint
11675
useEffect(() => {
11776
const svg: HTMLElement & SVGSVGElement = getChromosomeSvg(chromosome.id)
@@ -288,7 +247,7 @@ const Chromosome: FC<ChromosomeProps> = ({ scale, chromosome }) => {
288247
</g>
289248
{/* GENES ANNOTATION TAGS */}
290249
<g id={`${chromosome.id}_geneAnnotationTags`}>
291-
{geneAnnotationArray.map((gene, i) => {
250+
{annotations.map((gene, i) => {
292251
// Flatten collections into array of gene IDs - important for not drawing removed gene annotations
293252
const flatGeneCollection = collections.flatMap(
294253
(collection) => collection.genes

0 commit comments

Comments
 (0)