Skip to content

Commit

Permalink
Merge pull request #641 from chgibb/beta-staging
Browse files Browse the repository at this point in the history
Loading Text for BAM Importing and Ref Indexing
  • Loading branch information
chgibb authored Aug 30, 2017
2 parents 241e8dc + 0a31617 commit b7633e5
Show file tree
Hide file tree
Showing 20 changed files with 294 additions and 5 deletions.
1 change: 1 addition & 0 deletions scripts/opt/optIIFE.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if [[ "$OSTYPE" == "cygwin" ]]; then
fi
if [[ "$APPVEYOR" == "true" ]]; then
exit 0
fi
for f in $target/*.js
do
if [[ "$f" != "$target/pileup.js" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion scripts/optPackage.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ if [[ "$OSTYPE" == "cygwin" ]]; then
fi

bash scripts/opt/collapseBundle.bash
bash scripts/opt/optIIFE.bash

#bash scripts/opt/asi.bash
bash scripts/opt/minify.bash
bash scripts/opt/optIIFE.bash

cd "$target"

Expand Down
10 changes: 9 additions & 1 deletion src/AlignRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ $
replyChannel : "align"
}
);

ipc.send(
"getKey",
<GetKeyEvent>{
action : "getKey",
channel : "application",
key : "operations",
replyChannel : "align"
}
);
ipc.send(
"keySub",
<KeySubEvent>{
Expand Down
5 changes: 5 additions & 0 deletions src/InputBamFileProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,25 @@ process.on(
{
(async function(){
progressMessage = "Copying BAM";
update();
await new Promise<void>((resolve,reject) => {
fse.copySync(bamPath,getUnSortedBam(align));
resolve();
});
progressMessage = "Sorting BAM";
update();
await samToolsSort(align,logger);

progressMessage = "Getting Flag Statistics";
update();
await samToolsFlagStat(align,logger);

progressMessage = "Generating index";
update();
await samToolsIndex(align,logger);

progressMessage = "Getting mapped reads";
update();
await samToolsIdxStats(align,logger);

flags.done = true
Expand Down
51 changes: 51 additions & 0 deletions src/InputRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import * as viewMgr from "./req/renderer/viewMgr";
import * as masterView from "./req/renderer/inputRenderer/masterView";
import * as fastqView from "./req/renderer/inputRenderer/FastqView";
import * as fastaView from "./req/renderer/inputRenderer/FastaView";

import {AtomicOperation} from "./req/operations/atomicOperations";
import {IndexFastaForAlignment} from "./req/operations/indexFastaForAlignment";
import {IndexFastaForVisualization} from "./req/operations/indexFastaForVisualization";
import {InputBamFile} from "./req/operations/InputBamFile";
import {LinkRefSeqToAlignment} from "./req/operations/LinkRefSeqToAlignment";

import * as $ from "jquery";
(<any>window).$ = $;
require("./req/renderer/commonBehaviour");
Expand Down Expand Up @@ -65,6 +72,15 @@ $
action : "getKey"
}
);
ipc.send(
"getKey",
<GetKeyEvent>{
action : "getKey",
channel : "application",
key : "operations",
replyChannel : "input"
}
);

//subscribe to changes in data
ipc.send(
Expand Down Expand Up @@ -94,6 +110,16 @@ $
action : "keySub"
}
);
ipc.send(
"keySub",
<KeySubEvent>{
action : "keySub",
channel : "application",
key : "operations",
replyChannel : "input"
}
);

viewMgr.render();

//on message from main process
Expand Down Expand Up @@ -126,6 +152,31 @@ $
masterView.aligns = arg.val;
}
}
let found = false;
if(arg.key == "operations")
{
if(arg.val !== undefined)
{
let ops : Array<AtomicOperation> = arg.val;
console.log(ops);
for(let i = 0; i != ops.length; ++i)
{
if(ops[i].running)
{
if(ops[i].name == "inputBamFile" || ops[i].name == "linkRefSeqToAlignment" ||
ops[i].name == "indexFastaForVisualization" || ops[i].name == "indexFastaForAlignment")
{
console.log("found input bam file");
masterView.progressMessage = ops[i].progressMessage;
found = true;
break;
}
}
}
}
}
if(!found)
masterView.progressMessage = "";
masterView.dataChanged();
}
viewMgr.render();
Expand Down
9 changes: 9 additions & 0 deletions src/QCRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ $
replyChannel : "QC"
}
);
ipc.send(
"getKey",
<GetKeyEvent>{
action : "getKey",
channel : "application",
key : "operations",
replyChannel : "QC"
}
);
ipc.send(
"getKey",
<GetKeyEvent>{
Expand Down
5 changes: 5 additions & 0 deletions src/req/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ app.on
//on completion of any operation, wait and then broadcast the queue to listening windows
atomicOp.setOnComplete(
function(op : atomicOp.AtomicOperation){
//upon success of any operation except compiling templates to SVGs
if(op.flags.success && op.name != "compileTemplates")
{
dataMgr.saveData();
}
setTimeout(function(){
setImmediate(function(){
dataMgr.setKey("application","operations",atomicOp.operationsQueue);
Expand Down
2 changes: 1 addition & 1 deletion src/req/operations/atomicOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export abstract class AtomicOperation


/**
* Indicates whether the current operation is currently executing
* Indicates whether the operation is currently executing
*
* @type {boolean}
* @memberof AtomicOperation
Expand Down
8 changes: 8 additions & 0 deletions src/req/operations/indexFastaForAlignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,22 @@ export class IndexFastaForAlignment extends atomic.AtomicOperation
return new Promise<void>(async (resolve,reject) => {
try
{
self.progressMessage = "Building bowtie2 index";
self.update();
await bowTie2Build(self);
self.setSuccess(self.bowtieFlags);
self.update();

self.progressMessage = "Building fai index";
self.update();

await samToolsFaidx(self.fasta,self);
self.setSuccess(self.faiFlags);
self.update();

self.progressMessage = "Reading contigs";
self.update();

//don't reparse contigs if we don't have to
//contigs are parsed during viz indexing as well
//if we reparse, we will clobber contig uuids and all references which point to them
Expand Down
4 changes: 4 additions & 0 deletions src/req/operations/indexFastaForVisualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ export class IndexFastaForVisualization extends atomic.AtomicOperation
return new Promise<void>(async (resolve,reject) => {
try
{
self.progressMessage = "Building 2bit archive";
self.update();
await faToTwoBit(self);
self.setSuccess(self.twoBitFlags);

self.progressMessage = "Reading contigs";
self.update();

//don't reparse contigs if we don't have to
Expand Down
2 changes: 2 additions & 0 deletions src/req/renderer/inputRenderer/AlignView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {AlignData} from "./../../alignData";
export class View extends viewMgr.View
{
public aligns : Array<AlignData>;
public progressMessage : string;
public constructor(div : string)
{
super("alignView",div);
Expand All @@ -15,6 +16,7 @@ export class View extends viewMgr.View
{
return `
<img class="topButton activeHover activeHoverButton" id="browseAlignFiles" src="${getReadable("img/browseButton.png")}"><br />
<p id="loadingText">${this.progressMessage}</p>
<div id="alignTableDiv" style="width:100%;">
<table style="width:100%;">
<tr>
Expand Down
4 changes: 3 additions & 1 deletion src/req/renderer/inputRenderer/FastaView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Fasta} from "./../../fasta";
export class View extends viewMgr.View
{
public fastaInputs : Array<Fasta>;
public progressMessage : string;
public constructor(div : string)
{
super("fastaView",div);
Expand All @@ -14,7 +15,8 @@ export class View extends viewMgr.View
public renderView() : string
{
return `
<img class="topButton activeHover activeHoverButton" id="browseFastaFiles" src="${getReadable("img/browseButton.png")}"><br />
<img class="topButton activeHover activeHoverButton" id="browseFastaFiles" src="${getReadable("img/browseButton.png")}"><br />
<p id="loadingText">${this.progressMessage}</p>
<div id="fastaTableDiv" style="width:100%;">
<table style="width:100%;">
<tr>
Expand Down
2 changes: 2 additions & 0 deletions src/req/renderer/inputRenderer/FastqView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Fastq from "./../../fastq";
export class View extends viewMgr.View
{
public fastqInputs : Array<Fastq>;
public progressMessage : string;
public constructor(div : string)
{
super("fastqView",div);
Expand All @@ -15,6 +16,7 @@ export class View extends viewMgr.View
{
return `
<img class="topButton activeHover activeHoverButton" id="browseFastqFiles" src="${getReadable("img/browseButton.png")}"><br />
<p id="loadingText">${this.progressMessage}</p>
<div id="fastqTableDiv" style="width:100%;">
<table style="width:100%;">
<tr>
Expand Down
2 changes: 2 additions & 0 deletions src/req/renderer/inputRenderer/LinkRefView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class View extends viewMgr.View
public inspectingAlign : AlignData;
public fastaInputs : Array<Fasta>;
public linkableRefSeqs : Array<LinkableRefSeq>;
public progressMessage : string;
public constructor(div : string)
{
super("linkRefView",div);
Expand All @@ -24,6 +25,7 @@ export class View extends viewMgr.View
{
return `
<img class="topButton activeHover activeHoverButton" id="linkRefViewGoBackAlignView" src="${getReadable("img/GoBack.png")}"><br />
<p id="loadingText">${this.progressMessage}</p>
<br />
<br />
<p>Potentially Compatible References</p>
Expand Down
21 changes: 21 additions & 0 deletions src/req/renderer/inputRenderer/masterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class View extends viewMgr.View
public fastaInputs : Array<Fasta>;
public aligns : Array<AlignData>;
public currentView : "fastqView" | "fastaView" | "alignView" | "linkRefView";
public progressMessage : string;
public constructor(div : string)
{
super("masterView",div);
Expand All @@ -35,6 +36,7 @@ export class View extends viewMgr.View
this.fastaInputs = new Array<Fasta>();
this.aligns = new Array<AlignData>();
this.currentView = "fastqView";
this.progressMessage = "";
}
public onMount() : void
{
Expand Down Expand Up @@ -284,15 +286,34 @@ export class View extends viewMgr.View
{
let fastqView = <fastqView.View>viewMgr.getViewByName("fastqView",this.views);
fastqView.fastqInputs = this.fastqInputs;
fastqView.progressMessage = this.progressMessage;

let fastaView = <fastaView.View>viewMgr.getViewByName("fastaView",this.views);
fastaView.fastaInputs = this.fastaInputs;
fastaView.progressMessage = this.progressMessage;

let alignView = <alignView.View>viewMgr.getViewByName("alignView",this.views);
alignView.aligns = this.aligns;
alignView.progressMessage = this.progressMessage;

let linkRefView = <linkRefView.View>viewMgr.getViewByName("linkRefView",this.views);
linkRefView.fastaInputs = this.fastaInputs;
linkRefView.progressMessage = this.progressMessage;
if(linkRefView.inspectingAlign && this.currentView == "linkRefView")
{
for(let i = 0; i != this.aligns.length; ++i)
{
if(this.aligns[i].uuid == linkRefView.inspectingAlign.uuid)
{
if(this.aligns[i].fasta !== undefined)
{
this.currentView = "alignView";
viewMgr.render();
break;
}
}
}
}
}
}
export function addView(arr : Array<viewMgr.View>,div : string) : void
Expand Down
2 changes: 1 addition & 1 deletion src/req/samToolsFlagStatReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function samToolsFlagStatReportParser(report : string) : SamToolsFlagStat
}
if(/mapped/.test(lines[i]))
{
let percentages = /(\d\d\d\.\d\d%)|(\d\d.\d\d%)/.exec(lines[i]);
let percentages = /(\d\d\d\.\d\d%)|(\d\d.\d\d%)|(\d.\d\d%)/.exec(lines[i]);
if(percentages)
{
let trimmed = percentages[0].substr(0,percentages[0].length - 1);
Expand Down
13 changes: 13 additions & 0 deletions src/req/tests/L6R1HPV18AlignImported.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {AlignData} from "./../alignData";

let L6R1HPV18AlignImported : AlignData;

export function get() : AlignData
{
return L6R1HPV18AlignImported;
}

export function set(align : AlignData) : void
{
L6R1HPV18AlignImported = align;
}
Loading

0 comments on commit b7633e5

Please sign in to comment.