Skip to content

Commit

Permalink
start alignment onclick and wait for pending alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
chgibb committed Jun 24, 2019
1 parent a07bbc4 commit 0d4c18e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 8 deletions.
41 changes: 33 additions & 8 deletions src/req/renderer/AlignRenderer/app.tsx
Expand Up @@ -24,6 +24,8 @@ import {getPropertiesOfReferencesFromUuids, getReferencesFromUuids} from "../../
import {Button} from "../components/button";

import {headingPadding} from "./styles/headingPadding";
import { triggerBowtie2Alignment, triggerHisat2Alignment } from './publish';
import { ThreeQuartersLoader } from '../components/threeQuartersLoader';

export interface AlignRendererAppState
{
Expand Down Expand Up @@ -93,17 +95,23 @@ export class AlignRendererApp
{
if(ops[i].name == "indexFastaForBowtie2" || ops[i].name == "runBowtie2Alignment" || ops[i].name == "indexFastaForHisat2" || ops[i].name == "runHisat2Alignment")
{
this.setState({
shouldAllowTriggeringOps: false
});
found = true;
}
}
}
catch(err)
{}
}
}
if(!found)

if(found)
{
this.setState({
shouldAllowTriggeringOps: false
});
}

else
{
this.setState({
shouldAllowTriggeringOps: true
Expand Down Expand Up @@ -356,22 +364,39 @@ export class AlignRendererApp
Align {selectedFastqsObjs[0] ? `${selectedFastqsObjs[0].alias} forward, ` : ""} {selectedFastqsObjs[1] ? `${selectedFastqsObjs[1].alias} reverse, ` : ""} {"against "}
{selectedFastaObjs[0].alias} using {this.state.selectedAligner}.
</Typography>
{this.state.shouldAllowTriggeringOps ?

<GridWrapper>
<Grid container spacing={4} justify="center">
<Grid item>
<Button
{this.state.shouldAllowTriggeringOps ? <Button
label="Start"
type="remain"
onClick={() =>
{
if(this.state.selectedAligner == "bowtie2")
{
triggerBowtie2Alignment(
selectedFastaObjs[0],
selectedFastqsObjs[0],
selectedFastqsObjs[1]
);
}

if(this.state.selectedAligner == "hisat2")
{
triggerHisat2Alignment(
selectedFastaObjs[0],
selectedFastqsObjs[0],
selectedFastqsObjs[1]
);
}
}}
/>
/> :
<ThreeQuartersLoader />
}
</Grid>
</Grid>
</GridWrapper>
: ""}
</Paper>
</Grid>
</Grid>
Expand Down
61 changes: 61 additions & 0 deletions src/req/renderer/AlignRenderer/publish.ts
@@ -0,0 +1,61 @@
import * as electron from "electron";
import { Fastq } from '../../fastq';
import { Fasta } from '../../fasta';
import { AtomicOperationIPC } from '../../atomicOperationsIPC';
const ipc = electron.ipcRenderer;

export function triggerHisat2Alignment(fasta : Fasta,fastq1 : Fastq,fastq2 : Fastq | undefined) : void
{
if(!fasta.indexedForHisat2)
{
ipc.send(
"runOperation",
<AtomicOperationIPC>{
opName : "indexFastaForHisat2Alignment",
channel : "input",
key : "fastaInputs",
uuid : fasta.uuid
}
);
}

ipc.send(
"runOperation",
<AtomicOperationIPC>{
opName : "runHisat2Alignment",
alignParams : {
fasta : fasta,
fastq1 : fastq1,
fastq2 : fastq2
}
}
);
}

export function triggerBowtie2Alignment(fasta : Fasta,fastq1 : Fastq,fastq2 : Fastq | undefined) : void
{
if(!fasta.indexed)
{
ipc.send(
"runOperation",
<AtomicOperationIPC>{
opName : "indexFastaForBowtie2Alignment",
channel : "input",
key : "fastaInputs",
uuid : fasta.uuid
}
);
}

ipc.send(
"runOperation",
<AtomicOperationIPC>{
opName : "runBowtie2Alignment",
alignParams : {
fasta : fasta,
fastq1 : fastq1,
fastq2 : fastq2
}
}
);
}

0 comments on commit 0d4c18e

Please sign in to comment.