Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KANBAN-619: Add BLAST page #1393

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cdk/amplify-test-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class AmplifyTestStack extends cdk.Stack {
{ source: '/bluegenes/', target: 'https://production-alliancemine.alliancegenome.org:444/bluegenes/alliancemine', status: amplify.RedirectStatus.REWRITE },
{ source: '/bluegenes/<*>', target: 'https://production-alliancemine.alliancegenome.org:444/bluegenes/<*>', status: amplify.RedirectStatus.REWRITE },

{ source: '/blast', target: 'https://test.alliancegenome.org/blast', status: amplify.RedirectStatus.REWRITE },
{ source: '/blast/', target: 'https://test.alliancegenome.org/blast/', status: amplify.RedirectStatus.REWRITE },
{ source: '/blast/<*>', target: 'https://blast.alliancegenome.org/blast/<*>', status: amplify.RedirectStatus.REWRITE },

motenko marked this conversation as resolved.
Show resolved Hide resolved
{ source: '/swagger-ui', target: 'https://test-alb.alliancegenome.org/swagger-ui', status: amplify.RedirectStatus.REWRITE },
{ source: '/swagger-ui/', target: 'https://test-alb.alliancegenome.org/swagger-ui/', status: amplify.RedirectStatus.REWRITE },
{ source: '/swagger-ui/<*>', target: 'https://test-alb.alliancegenome.org/swagger-ui/<*>', status: amplify.RedirectStatus.REWRITE },
Expand Down
59 changes: 59 additions & 0 deletions src/containers/blastPage/BlastService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import useBlastServers from "../../hooks/useBlastServers";

function listPublicServers(blastEnv) {
const mods = Object.entries(blastEnv);
let blastServerList = [];

mods.map(([mod, modServers]) => {
const servers = Object.entries(modServers);
servers.map(([server, serverData]) => {
if (serverData.public) {
const serverItem = { name: server, ...serverData };
blastServerList.push(serverItem);
}
});
});

return blastServerList;
};

const BlastService = () => {
const { data, isLoading, error } = useBlastServers();

if (error) return console.log("ERROR: BlastServerList: ", error);
if (isLoading) return null; // maybe change to <loadingPage /> ... or something like that ...

const blastEnv = data.environments;
const blastServers = listPublicServers(blastEnv);

// const title = page.title.rendered;
return (
<div>
<h3>
Welcome to the BLAST Service for the Alliance of Genome Resources!
</h3>
<p>
This BLAST service allows researchers to search genomic sequences using
the Basic Local Alignment Search Tool (BLAST). By entering a sequence or
query, users can find regions of similarity to various genomes within
the Alliance. This service supports separate environments for each of
the Model Organism Databases (MODs) as well as a unified environment for
the Alliance. Results provide detailed alignments and annotations to aid
in your research. Explore the various BLAST environments through the
links below to find the one that best suits your research needs:
</p>
<ul>
{
blastServers.map((server) => (
<li key={server.dataProvider + server.name}>
<a href={"/blast/" + server.dataProvider + "/" + server.name}>{server.dataProvider + " - " + server.name}</a>
</li>
))
}
</ul>
</div>
);
};

export default BlastService;
32 changes: 32 additions & 0 deletions src/containers/blastPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import style from "./style.module.scss";
import HeadMetaTags from "../../components/headMetaTags";
import BlastService from "./BlastService";

const BlastPage = () => {
return (
<div>
<HeadMetaTags title="BLAST Service" />
<div>
<div className={style.aboutMenuContainer}>
<div className="container-fluid">
<div className={style.secondaryNavEmptyRow}></div>
<div className={`row ${style.secondaryNav}`}>
<div className="container">
<h1>BLAST Service</h1>
</div>
</div>
</div>

</div>
</div>
<div className="container">
<div className="col-xs-12 col-sm-12 mission">
<BlastService />
</div>
</div>
</div>
);
};

export default BlastPage;
20 changes: 20 additions & 0 deletions src/containers/blastPage/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/mixins";
@import "../wordpress/style.module.scss";

$max-width: 800px;

.section {
padding: 3rem 1rem;
border-bottom: 1px solid $border-color;
}

.contentContainer {
width: 100%;
margin: 0 auto;

@media (min-width: $max-width) {
max-width: $max-width;
}
}
11 changes: 11 additions & 0 deletions src/hooks/useBlastServers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useQuery } from 'react-query';
import fetchData from '../lib/fetchData';

const BLAST_SERVER_ENVIRONMENT_URL = 'https://blast.alliancegenome.org/blast/environment_info.json';

export default function useBlastServers() {
return useQuery(['blast-servers'], () => {
// I changed this from quoted with back-ticks to qouted with single qoutes
return fetchData('https://blast.alliancegenome.org/blast/environment_info.json');
});
}
2 changes: 2 additions & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import AllelePage from './containers/allelePage/AllelePage';
import VariantPage from './containers/allelePage/VariantPage';
import MODLanding from './containers/modLanding/Main';
import AlzheimersPage from './containers/alzheimersPage';
import BlastPage from './containers/blastPage';

export default (
<Layout>
Expand All @@ -36,6 +37,7 @@ export default (
<Route exact path='/downloads' component={DownloadsPage} />
<Route exact path='/members/:id' render={({ match }) => <MODLanding modId={match.params.id} />} />
<Route exact path='/disease-portal/alzheimers-disease' component={AlzheimersPage} />
<Route exact path='/blast' component={BlastPage} />


{/* this one needs to be handled outside of the main application */}
Expand Down
Loading