Skip to content

Commit

Permalink
Merge pull request #550 from chgibb/beta-staging
Browse files Browse the repository at this point in the history
543, 531, Delete on Export
  • Loading branch information
chgibb authored Jul 25, 2017
2 parents 0589d9a + 35be08d commit c0542e8
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 68 deletions.
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
[![Build Status](https://travis-ci.com/chgibb/PHAT.svg?token=zVjAYguBNwfubJJZepif&branch=master)](https://travis-ci.com/chgibb/PHAT)
[![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)


# PHAT - Pathogen Host Analysis Tool
### Latest Releases
* [Windows Installer](https://github.com/chgibb/PHAT/releases/download/0.0.40/phat-win32-x64-setup.exe)
* [Ubuntu Linux Debian Package](https://github.com/chgibb/PHAT/releases/download/0.0.40/phat_0.0.40_amd64.deb)
* [Windows Portable](https://github.com/chgibb/PHAT/releases/download/0.0.40/phat-win32-x64-portable.zip)
* [Linux Portable](https://github.com/chgibb/PHAT/releases/download/0.0.40/phat-linux-x64-portable.tar.gz)
#### Experimental Releases
* [Red Hat Package Manager](https://github.com/chgibb/PHAT/releases/download/0.0.40/phat-0.0.40.x86_64.rpm)

The Pathogen Host Analysis Tool (PHAT) is an application for processing and analyzing next-generation sequencing (NGS) data as it relates to relationships between pathogen and host organisms. PHAT provides quality control (QC) reporting on sequence files, alignment of sequence files against reference files, alignment viewing and Excel and comma separated values (CSV) output.

PHAT is under development in the Zehbe Lab (http://zehbelab.weebly.com/) at the Thunder Bay Regional Health Research Institute (TBRHRI) and Lakehead University (LU) under the supervison of Dr. Ingeborg Zehbe. This work is supported by a Natural Sciences and Engineering Research Council of Canada (NSERC) Discovery grant to Dr. Ingeborg Zehbe (#RGPIN-2015-03855) and a NSERC Alexander Graham Bell Canada Graduate Scholarship-Doctoral (CGS-D) to Robert Jackson (#454402-2014).

**Project Supervisor/Principal Investigator:** Dr. Ingeborg Zehbe, LU/TBRHRI Research Chair & Senior Scientist
**Project Lead/Biologist:** Robert Jackson, PhD Biotech Candidate
**Project Lead/Software Developer:** Chris Gibb, HBSc Comp Sci Student
**Team Member:** Mitchell Pynn
**Team Member:** Shane Liu
**Team Member:** Jeremy Braun
See https://chgibb.github.io/PHATDocs/ for documentation and releases.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phat",
"version": "0.0.51-beta.2",
"version": "0.0.51-beta.3",
"description": "Pathogen Host Analysis Tool",
"main": "main.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions scripts/install/copyBootstrap.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(set -o igncr) 2>/dev/null && set -o igncr; # For Cygwin on Windows compaibility

cp node_modules/bootstrap/dist/css/bootstrap.min.css forDist/bootstrap.min.css
1 change: 0 additions & 1 deletion scripts/install/copyBootstrap.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
(set -o igncr) 2>/dev/null && set -o igncr; # For Cygwin on Windows compaibility

cp node_modules/@claviska/jquery-minicolors/jquery.minicolors.css forDist/styles
cp node_modules/@claviska/jquery-minicolors/jquery.minicolors.png forDist/styles
11 changes: 9 additions & 2 deletions src/req/QCData.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import Fastq from "./fastq";
import {getReadableAndWritable} from "./getAppPath";
export class QCData
{
public QCReport : string;
public summary : Array<QCSummary>;
public validID : string;
public reportRun : boolean;
public constructor()
{
this.QCReport = "";
this.reportRun = false;
this.summary = new Array<QCSummary>();
}
}

export function getQCReportHTML(fastq : Fastq) : string
{
return getReadableAndWritable(`rt/QCReports/${fastq.uuid}/fastqc_report.html`);
}

export class QCSummary
{
public name : string;
Expand Down
4 changes: 3 additions & 1 deletion src/req/main/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* Bootstrap module for the main process. Requires helper modules and sets up event handlers.
* The heart of PHAT. Any module should be able to require this module and have a fully functioning PHAT main process. This module should
* export nothing. It must be fully self contained.
* This behaviour is expected from integration tests. Tests will require this module and then hook into events and inspect behaviour.
* @module req/main/main
*/
import * as fs from "fs";
Expand Down
5 changes: 4 additions & 1 deletion src/req/openProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function openProject(
return new Promise((resolve,reject) => {
dataMgr.clearData();
rimraf.sync(getReadableAndWritable("rt"));
rebuildRTDirectory();

let projectTarBall : string;

Expand Down Expand Up @@ -52,7 +53,9 @@ export function openProject(
unPackedFiles++;
cb(totalFiles,unPackedFiles);
return false;
}
},
readable : true,
writable : true
});
extract.on("finish",() => {
if(externalProjectPath)
Expand Down
6 changes: 3 additions & 3 deletions src/req/operations/GenerateQCReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ export class GenerateQCReport extends atomic.AtomicOperation
self.abortOperationWithMessage(err);
return;
}
self.fastq.QCData.QCReport = self.destDir;
try
{
self.fastq.QCData.summary = getQCReportSummaries(`${self.fastq.QCData.QCReport}/fastqc_data.txt`);
self.fastq.QCData.summary = getQCReportSummaries(`${self.destDir}/fastqc_data.txt`);
self.fastq.QCData.reportRun = true;
}
catch(err)
{
self.abortOperationWithMessage(`Failed to get summaries for ${self.fastq.QCData.QCReport}/fastqc_data.txt
self.abortOperationWithMessage(`Failed to get summaries for ${self.destDir}/fastqc_data.txt
${err}`);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/req/operations/RunAlignment/bowTie2Align.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function bowTie2Align(alignData : alignData,logger : atomic.AtomicOperati
args.push(getReadable("bowtie2"));
args.push("-x");
args.push("\""+getReadableAndWritable(`rt/indexes/${alignData.fasta.uuid}`)+"\"");
if(alignData.fastqs[1] !== undefined)
if(alignData.fastqs[1])
{
args.push("-1");
args.push(getPath(alignData.fastqs[0]));
Expand All @@ -68,7 +68,7 @@ export function bowTie2Align(alignData : alignData,logger : atomic.AtomicOperati
invokeString += " ";
}
alignData.invokeString = invokeString;
if(alignData.fastqs[1] !== undefined)
if(alignData.fastqs[1])
alignData.alias = `${alignData.fastqs[0].alias}, ${alignData.fastqs[1].alias}; ${alignData.fasta.alias}`;
else
alignData.alias = `${alignData.fastqs[0].alias}; ${alignData.fasta.alias}`;
Expand Down
3 changes: 2 additions & 1 deletion src/req/operations/atomicOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export class ForkLogger extends AtomicOperation
export function handleForkFailures(logger? : ForkLogger,progressMessage? : string)
{
let signalFailure = function(err : string){
let flags : CompletionFlags;
console.log(err);
let flags : CompletionFlags = new CompletionFlags();
flags.done = true;
flags.failure = true;
flags.success = false;
Expand Down
23 changes: 23 additions & 0 deletions src/req/renderer/OutputRenderer/reportView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ import {renderAlignmentReportTable} from "./reportView/renderAlignmentReportTabl
import {renderSNPPositionsTable} from "./reportView/renderSNPPositionsTable";
import {renderMappedReadsPerContigTable} from "./reportView/renderMappedReadsPerContigTable";

export class QCReportTableSortOptions
{
public aliasAscending : boolean;
public aliasDescending : boolean;
public fullPathAscending : boolean;
public fullPathDescending : boolean;
public sizeInBytesAscending : boolean;
public sizeInBytesDescending : boolean;
public formattedSizeAscending : boolean;
public formattedSizeDescending : boolean;
public numberOfSequencesAscending : boolean;
public numberofSequencesDescending : boolean;
public perBaseSequenceQualityAscending : boolean;
public perBaseSequenceQualityDescending : boolean;
public perSequenceQualityScoreAscending : boolean;
public perSequenceQualityScoreDescending : boolean;
public perSequenceGCContentAscending : boolean;
public perSequenceGCContentDescending : boolean;
public sequenceDuplicationLevelsAscending : boolean;
public sequenceDuplicationLevelsDescending : boolean;
public overRepresentedSequencesAscending : boolean;
}

export function addView(arr : Array<viewMgr.View>,div : string)
{
arr.push(new View(div));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import * as fse from "fs-extra";

import * as electron from "electron";
const dialog = electron.remote.dialog;

import {ProjectManifest,getTarBallPath} from "./../../projectManifest";
const jsonFile = require("jsonfile");

import * as viewMgr from "./../viewMgr";
import {ProjectManifest,getTarBallPath,getProjectManifests} from "./../../projectManifest";

export function exportProjectBrowseDialog(proj : ProjectManifest) : Promise<undefined>
{
Expand All @@ -28,7 +30,34 @@ export function exportProjectBrowseDialog(proj : ProjectManifest) : Promise<unde
reject(err);
else
{
resolve();
let projects : Array<ProjectManifest>;
projects = jsonFile.readFileSync(getProjectManifests());
for(let i = 0; i != projects.length; ++i)
{
if(proj.uuid == projects[i].uuid)
{
new Promise<void>((resolve,reject) => {
fse.remove(getTarBallPath(projects[i]),(err : Error) => {
if(err)
{
alert(`Failed to remove original project`);
reject();
}
else
{
projects.splice(i,1);
jsonFile.writeFileSync(getProjectManifests(),projects);
resolve();
}
});
}).then(() => {
viewMgr.changeView("splashView");
viewMgr.render();
resolve();
});
break;
}
}
}
}
);
Expand Down
12 changes: 7 additions & 5 deletions src/req/renderer/QCRenderer/reportView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
import * as fs from "fs";

import * as viewMgr from "./../viewMgr";
import Fastq from "./../../fastq";
import {getQCReportHTML} from "./../../QCData";

export class ReportView extends viewMgr.View
{
public report : string;
public fastqToReport : Fastq;
public constructor(div : string)
{
super('report',div);
this.report = "";
this.fastqToReport = undefined;
}
onMount(){}
onUnMount(){}
renderView()
{
if(document.getElementById('reportIsOpen') || !this.report)
if(document.getElementById('reportIsOpen') || !this.fastqToReport)
return undefined;
return `
<div class="activeHover" id='gobackbutton' style='padding: 0px 0px 5px 20px'>
Expand All @@ -24,7 +26,7 @@ export class ReportView extends viewMgr.View
</div>
<div id='reportIsOpen'></div>
${(()=>{
return fs.readFileSync(`${this.report}/fastqc_report.html`).toString();
return fs.readFileSync(getQCReportHTML(this.fastqToReport)).toString();
})()}
`;
}
Expand All @@ -35,7 +37,7 @@ export class ReportView extends viewMgr.View
return;
if(event.target.id == "goBack")
{
this.report = "";
this.fastqToReport = undefined;
viewMgr.changeView('summary');
return;
}
Expand Down
26 changes: 3 additions & 23 deletions src/req/renderer/QCRenderer/summaryView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class SummaryView extends viewMgr.View
if(this.fastqInputs[i].checked)
{
res += `<tr>`;
if(this.fastqInputs[i].QCData.QCReport == "")
if(!this.fastqInputs[i].QCData.reportRun)
{
res += `<td class="activeHover" style='text-align:center;'><b id='${this.fastqInputs[i].uuid}'>click to analyze</b></td>`;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ export class SummaryView extends viewMgr.View
{
if(this.fastqInputs[i].uuid == event.target.id)
{
if(this.fastqInputs[i].QCData.QCReport == "")
if(!this.fastqInputs[i].QCData.reportRun)
{
ipc.send(
"runOperation",<AtomicOperationIPC>{
Expand All @@ -104,31 +104,11 @@ export class SummaryView extends viewMgr.View
}
else
{
(<ReportView>viewMgr.getViewByName("report")).report = this.fastqInputs[i].QCData.QCReport;
(<ReportView>viewMgr.getViewByName("report")).fastqToReport = this.fastqInputs[i];
viewMgr.changeView('report');
}
}
}
/*
if(!event || !event.target || !event.target.id)
return;
for(let i = 0; i != this.model.QCData.length; ++i)
{
if(this.model.QCData[i].validID == event.target.id)
{
if(this.model.QCData[i].QCReport == "")
{
this.model.generateQCReport(this.model.QCData[i].name);
return;
}
else
{
(<ReportView>viewMgr.getViewByName("report")).report = this.model.QCData[i].QCReport;
viewMgr.changeView('report');
}
}
}*/
}
dataChanged(){}
}
Expand Down

0 comments on commit c0542e8

Please sign in to comment.