Skip to content

Commit

Permalink
refactor to component and website
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson committed Nov 24, 2023
1 parent be988bd commit eff831e
Show file tree
Hide file tree
Showing 31 changed files with 115,330 additions and 43 deletions.
15 changes: 11 additions & 4 deletions gensplore-component/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "genbank_view",
"name": "gensplore",
"version": "0.1.0",
"private": true,
"dependencies": {
"devDependencies": {
"@headlessui/react": "^1.7.16",
"@tanstack/react-virtual": "^3.0.0-beta.48",
"@testing-library/jest-dom": "^5.16.5",
Expand All @@ -15,9 +15,7 @@
"postcss": "^8.4.21",
"qs": "^6.11.0",
"rc-slider": "^10.1.1",
"react": "^18.2.0",
"react-debounce-input": "^3.3.0",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
"react-router-dom": "^6.8.1",
"react-spinners": "^0.13.8",
Expand All @@ -28,8 +26,17 @@
"ve-range-utils": "^2.6.6",
"ve-sequence-utils": "^5.2.9",
"vite": "^5.0.2",
"vite-plugin-css-injected-by-js": "^3.3.0",
"web-vitals": "^2.1.4"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"main": "dist/gensplore.umd.js",
"files": [
"dist"
],
"scripts": {
"start": "vite",
"build": "vite build",
Expand Down
2 changes: 1 addition & 1 deletion gensplore-component/src/components/GensploreView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useCallback,
} from "react";


import "../App.css"
import Offcanvas from './Offcanvas'; // Import the new offcanvas component

import Tooltip from "./Tooltip";
Expand Down
3 changes: 3 additions & 0 deletions gensplore-component/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Gensplore from "./components/GensploreView";

export default Gensplore;
54 changes: 40 additions & 14 deletions gensplore-component/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";

export default defineConfig({
// depending on your application, base can also be "/"
base: '',
plugins: [react()],
define: {
global: {},
},
worker: {
format: "umd",
},
plugins: [
react(),
cssInjectedByJsPlugin(),

],

server: {
// this ensures that the browser opens upon server start
open: true,
// this sets a default port to 3000
port: 3000,
build: {
//extry: 'src/index.js',

lib: {
entry: "src/index.js",
name: "Gensplore", // give your library a name
fileName: (format) => `gensplore.${format}.js`,
// formats: ['iife']
},

//entry: 'src/App.jsx',

rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["react", "react-dom", "react/jsx-runtime"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: "React",
"react-dom": "ReactDOM",
},
},
},
})
},
optimizeDeps: {
include: [], //add 'prop-types' here
},
});
29 changes: 6 additions & 23 deletions gensplore-component/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ lodash@^4.17.15, lodash@^4.17.21, lodash@^4.17.4:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

loose-envify@^1.1.0, loose-envify@^1.4.0:
loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -1954,14 +1954,6 @@ react-debounce-input@^3.3.0:
lodash.debounce "^4"
prop-types "^15.8.1"

react-dom@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d"
integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==
dependencies:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-icons@^4.7.1:
version "4.12.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.12.0.tgz#54806159a966961bfd5cdb26e492f4dafd6a8d78"
Expand Down Expand Up @@ -2047,13 +2039,6 @@ react-use@^17.4.0:
ts-easing "^0.2.0"
tslib "^2.1.0"

react@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
dependencies:
loose-envify "^1.1.0"

read-cache@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774"
Expand Down Expand Up @@ -2156,13 +2141,6 @@ safe-buffer@~5.2.0:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

scheduler@^0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
dependencies:
loose-envify "^1.1.0"

screenfull@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.2.0.tgz#6533d524d30621fc1283b9692146f3f13a93d1ba"
Expand Down Expand Up @@ -2449,6 +2427,11 @@ ve-sequence-utils@^5.2.9:
jsondiffpatch "^0.3.11"
string-splice "^1.3.0"

vite-plugin-css-injected-by-js@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.3.0.tgz#c19480a9e42a95c5bced976a9dde1446f9bd91ff"
integrity sha512-xG+jyHNCmUqi/TXp6q88wTJGeAOrNLSyUUTp4qEQ9QZLGcHWQQsCsSSKa59rPMQr8sOzfzmWDd8enGqfH/dBew==

vite@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/vite/-/vite-5.0.2.tgz#3c94627dace83b9bf04b64eaf618038e30fb95c0"
Expand Down
24 changes: 24 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js
dist

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
19 changes: 19 additions & 0 deletions website/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1" # Use the sha / tag you want to point at
hooks:
- id: prettier
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
additional_dependencies: [toml]
11 changes: 11 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Gensplore

A simple genome browser for smallish genomes (e.g. viruses and bacteria)

![image](https://user-images.githubusercontent.com/19732295/219011538-43b9b66b-0227-4171-87c6-08b496a7bf2e.png)

## https://gensplore.theo.io/

### Adding custom genomes

For viewing a custom genome every now and then, just use the "Choose file" option. If you are doing this all the time you might want an easier method. Bacterial genomes load too slowly from NCBI for us to load them directly, but you can upload your own to a website that allows CORS access, then go to `http://gensplore.theo.io/?gb=http://mywebsite.com/myfile.gb`. If you have trouble with this feel free to raise an Issue and we may be able to add your genome.
55 changes: 55 additions & 0 deletions website/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Simple genbank viewer" />
<!-- HTML Meta Tags -->
<title>Gensplore</title>
<meta name="description" content="Simple genbank viewer" />

<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-W3TJTHDBX3"
></script>
<script>
function gtag() {
dataLayer.push(arguments);
}
(window.dataLayer = window.dataLayer || []),
gtag("js", new Date()),
gtag("config", "G-W3TJTHDBX3");
</script>
<!-- Facebook Meta Tags -->
<meta property="og:url" content="http://gensplore.theo.io" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Gensplore" />
<meta property="og:description" content="Simple genbank viewer" />
<meta property="og:image" content="https://gensplore.theo.io/splash.png" />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="gensplore.theo.io" />
<meta property="twitter:url" content="https://gensplore.theo.io" />
<meta name="twitter:title" content="Gensplore" />
<meta name="twitter:description" content="Simple genbank viewer" />
<meta name="twitter:image" content="https://gensplore.theo.io/splash.png" />

<!-- Meta Tags Generated via https://www.opengraph.xyz -->
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />

<title>Basic SARS-CoV-2 genome browser</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="/src/index.jsx"></script>
<div id="root"></div>
</body>
</html>
Loading

0 comments on commit eff831e

Please sign in to comment.