Skip to content

Commit

Permalink
Merge pull request #405 from chgibb/dev
Browse files Browse the repository at this point in the history
398, 374, 372
  • Loading branch information
chgibb authored Jun 17, 2017
2 parents 4b96e91 + cbe8ec5 commit f9440b1
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 169 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ phat-linux-x64
phat-win32-x64
*.*~
npm-debug.log
.vscode
src/FastQC/bin/*
src/pileup.js
src/req/renderer/PathogenRenderer/pileup.js
Expand Down
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version" : "0.2.0",
"configurations" : [
{
"name" : "Debug Main",
"type" : "node",
"request" : "launch",
"cwd" : "${workspaceRoot}/phat-linux-x64",
"runtimeExecutable" : "${workspaceRoot}/phat-linux-x64/phat",
"program" : "${workspaceRoot}/phat-linux-x64/resources/app/main.js",
"protocol" : "legacy"
}
]
}
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.21",
"version": "0.0.22",
"description": "Pathogen Host Analysis Tool",
"main": "main.js",
"scripts": {
Expand Down
6 changes: 2 additions & 4 deletions src/req/renderer/OutputRenderer/masterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class View extends viewMgr.View
public fastqInputs : Array<Fastq>;
public fastaInputs : Array<Fasta>;

public displayInfo : "QCInfo" | "RefSeqInfo" | "AlignmentInfo" | "SNPPositions";
public displayInfo : "QCInfo" | "RefSeqInfo" | "AlignmentInfo" | "SNPPositions" | "MappedReadsPerContigInfo";
public inspectingUUID : string;
public constructor(div : string)
{
Expand Down Expand Up @@ -92,8 +92,6 @@ export class View extends viewMgr.View

public divClickEvents(event : JQueryEventObject) : void
{
let self = this;
console.log(event.target.id);


}
}
16 changes: 14 additions & 2 deletions src/req/renderer/OutputRenderer/reportView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {VCF2JSONRow} from "./../../varScanMPileup2SNPVCF2JSON";
import {renderQCReportTable} from "./reportView/renderQCReportTable";
import {renderAlignmentReportTable} from "./reportView/renderAlignmentReportTable";
import {renderSNPPositionsTable} from "./reportView/renderSNPPositionsTable";
import {renderMappedReadsPerContigTable} from "./reportView/renderMappedReadsPerContigTable";

export function addView(arr : Array<viewMgr.View>,div : string)
{
Expand All @@ -37,8 +38,6 @@ export class View extends viewMgr.View
let masterView = <masterView.View>viewMgr.getViewByName("masterView");
let rightPanel = <rightPanel.View>viewMgr.getViewByName("rightPanel",masterView.views);



//if we're looking at SNP position, refresh table information if the alignment being inspected has changed
if(masterView.displayInfo == "SNPPositions")
{
Expand All @@ -56,6 +55,7 @@ export class View extends viewMgr.View
${renderQCReportTable()}
${renderAlignmentReportTable()}
${renderSNPPositionsTable(this.vcfRows)}
${renderMappedReadsPerContigTable()}
`;
}
Expand Down Expand Up @@ -95,6 +95,18 @@ export class View extends viewMgr.View
}
);
}
if(event.target.id == masterView.alignData[i].uuid+"AlignmentRate")
{
if(!masterView.alignData[i].summary.overallAlignmentRate)
{
alert(`Can't view an alignment with 0% alignment rate`);
return;
}
masterView.inspectingUUID = masterView.alignData[i].uuid;
masterView.displayInfo = "MappedReadsPerContigInfo";
viewMgr.render();
return;
}
if(masterView.alignData[i].uuid == masterView.inspectingUUID)
{
for(let k = 0; k != this.vcfRows.length; ++k)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function renderAlignmentReportTable() : string
res += `<td>${masterView.alignData[i].summary.mates}</td>`;
if(rightPanel.alignmentInfoSelection.overallAlignmentRate)
res += `<td>${masterView.alignData[i].summary.overallAlignmentRate}</td>`;
res += `<td class="activeHover" id="${masterView.alignData[i].uuid}AlignmentRate">${masterView.alignData[i].summary.overallAlignmentRate}</td>`;
if(rightPanel.alignmentInfoSelection.minimumCoverage)
res += `<td>${masterView.alignData[i].varScanSNPSummary.minCoverage}</td>`;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as viewMgr from "./../../viewMgr";
import * as masterView from "./../masterView";
import * as rightPanel from "./../rightPanel";

export function renderMappedReadsPerContigTable() : string
{
let masterView = <masterView.View>viewMgr.getViewByName("masterView");
let rightPanel = <rightPanel.View>viewMgr.getViewByName("rightPanel",masterView.views);
if(masterView.displayInfo != "MappedReadsPerContigInfo")
return "";
return `
<table style="width:100%">
${(()=>{
let res = "";
res += `
<tr>
${rightPanel.mapppedReadsPerContigInfoSelection.refSeqName != false ? "<th>Contig Name</th>" : ""}
${rightPanel.mapppedReadsPerContigInfoSelection.seqLength != false ? "<th>Length</th>" : ""}
${rightPanel.mapppedReadsPerContigInfoSelection.mappedReads != false ? "<th>Mapped Reads</th>" : ""}
${rightPanel.mapppedReadsPerContigInfoSelection.unMappedReads != false ? "<th>Unmapped Reads</th>" : ""}
</tr>
`;
return res;
})()}
${(()=>{
let res = "";
for(let i = 0; i != masterView.alignData.length; ++i)
{
if(masterView.alignData[i].uuid == masterView.inspectingUUID)
{
for(let k = 0; k != masterView.alignData[i].idxStatsReport.length; ++k)
{
res += "<tr>";
if(rightPanel.mapppedReadsPerContigInfoSelection.refSeqName)
res += `<td>${masterView.alignData[i].idxStatsReport[k].refSeqName}</td>`;
if(rightPanel.mapppedReadsPerContigInfoSelection.seqLength)
res += `<td>${masterView.alignData[i].idxStatsReport[k].seqLength}</td>`;
if(rightPanel.mapppedReadsPerContigInfoSelection.mappedReads)
res += `<td>${masterView.alignData[i].idxStatsReport[k].mappedReads}</td>`;
if(rightPanel.mapppedReadsPerContigInfoSelection.unMappedReads)
res += `<td>${masterView.alignData[i].idxStatsReport[k].unMappedReads}</td>`;
res += "</tr>";
}
break;
}
}
return res;
})()}
</table>
`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function renderQCReportTable() : string
${rightPanel.fastQInfoSelection.PBSQ != false ? "<th>Per Base Sequence Quality</th>" : ""}
${rightPanel.fastQInfoSelection.PSQS != false ? "<th>Per Sequence Quality Score</th>" : ""}
${rightPanel.fastQInfoSelection.PSGCC != false ? "<th>Per Sequence GC Content</th>" : ""}
${rightPanel.fastQInfoSelection.SDL != false ? "<th>Sequence Duplication Levelsias</th>" : ""}
${rightPanel.fastQInfoSelection.SDL != false ? "<th>Sequence Duplication Levels</th>" : ""}
${rightPanel.fastQInfoSelection.ORS != false ? "<th>Over Represented Sequences</th>" : ""}
</tr>
`;
Expand Down
106 changes: 86 additions & 20 deletions src/req/renderer/OutputRenderer/rightPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export class FastQInfoSelection
[index : string] : boolean;
public constructor()
{
this.alias = false;
this.alias = true;
this.fullName = false;
this.sizeInBytes = false;
this.formattedSize = false;
this.formattedSize = true;
this.numberOfSequences = false;
this.PBSQ = false;
this.PSQS = false;
this.PSGCC = false;
this.SDL = false;
this.ORS = false;
this.PBSQ = true;
this.PSQS = true;
this.PSGCC = true;
this.SDL = true;
this.ORS = true;
}

}
Expand Down Expand Up @@ -53,19 +53,19 @@ export class AlignmentInfoSelection
[index : string] : boolean;
public constructor()
{
this.alias = false;
this.alias = true;
this.fullName = false;
this.sizeInBytes = false;
this.formattedSize = false;
this.reads = false;
this.mates = false;
this.overallAlignmentRate = false;
this.formattedSize = true;
this.reads = true;
this.mates = true;
this.overallAlignmentRate = true;
this.minimumCoverage = false;
this.minimumVariableFrequency = false;
this.minimumAverageQuality = false;
this.pValueThreshold = false;
this.SNPsPredicted = false;
this.indelsPredicted = false;
this.SNPsPredicted = true;
this.indelsPredicted = true;
this.dateRan = false;
this.SNPPositions = false;
}
Expand All @@ -87,10 +87,10 @@ export class SNPPositionsInfoSelection
[index : string] : boolean;
public constructor()
{
this.chrom = false;
this.position = false;
this.ref = false;
this.var = false;
this.chrom = true;
this.position = true;
this.ref = true;
this.var = true;
this.consCovReads1Reads2FreqPValue = false;
this.strandFilterR1R1R2R2pVal = false;
this.samplesRef = false;
Expand All @@ -101,19 +101,37 @@ export class SNPPositionsInfoSelection
}
}

export class MappedReadsPerContigInfoSelection
{
public refSeqName : boolean;
public seqLength : boolean;
public mappedReads : boolean;
public unMappedReads : boolean;
[index : string] : boolean;
public constructor()
{
this.refSeqName = true;
this.seqLength = true;
this.mappedReads = true;
this.unMappedReads = true;
}
}

export class View extends viewMgr.View
{
public fastQInfoSelection : FastQInfoSelection;
public refSeqInfoSelection : FastaInfoSelection;
public alignmentInfoSelection : AlignmentInfoSelection;
public snpPositionsInfoSelection : SNPPositionsInfoSelection;
public mapppedReadsPerContigInfoSelection : MappedReadsPerContigInfoSelection;
public constructor(name : string,div : string)
{
super(name,div);
this.fastQInfoSelection = new FastQInfoSelection();
this.refSeqInfoSelection = new FastaInfoSelection();
this.alignmentInfoSelection = new AlignmentInfoSelection();
this.snpPositionsInfoSelection = new SNPPositionsInfoSelection();
this.mapppedReadsPerContigInfoSelection = new MappedReadsPerContigInfoSelection();
}

public onMount() : void{}
Expand Down Expand Up @@ -268,6 +286,36 @@ export class View extends viewMgr.View
<br />
`;
}
if(masterView.displayInfo == "MappedReadsPerContigInfo")
{
res += `
<input type="checkbox" id="refSeqName">Contig Name</input>
<br />
<input type="checkbox" id="seqLength">Length</input>
<br />
<input type="checkbox" id="mappedReads">Mapped Reads</input>
<br />
<input type="checkbox" id="unMappedReads">Unmapped Reads</input>
<br />
`;
let found = false;
for(let i = 0; i != masterView.alignData.length; ++i)
{
if(masterView.inspectingUUID == masterView.alignData[i].uuid)
{
res += `
<h5>Mapped reads per contig for ${masterView.alignData[i].alias}</h5>
`;
found = true;
break;
}
}
if(!found)
throw new Error("No alignment to inspect");
}
return res;
})()}
Expand All @@ -277,7 +325,6 @@ export class View extends viewMgr.View
public postRender() : void
{
let masterView = <masterView.View>viewMgr.getViewByName("masterView");
console.log("post render");
try
{
if(masterView.displayInfo == "QCInfo")
Expand Down Expand Up @@ -333,7 +380,20 @@ export class View extends viewMgr.View
try
{
(<HTMLInputElement>document.getElementById(i)).checked = this.snpPositionsInfoSelection[i];
console.log("restored "+i+" to "+this.snpPositionsInfoSelection[i]);
}
catch(err){}
}
}
}
if(masterView.displayInfo == "MappedReadsPerContigInfo")
{
for(let i in this.mapppedReadsPerContigInfoSelection)
{
if(this.mapppedReadsPerContigInfoSelection.hasOwnProperty(i))
{
try
{
(<HTMLInputElement>document.getElementById(i)).checked = this.mapppedReadsPerContigInfoSelection[i];
}
catch(err){}
}
Expand Down Expand Up @@ -382,6 +442,12 @@ export class View extends viewMgr.View
viewMgr.render();
return;
}
else if(masterView.displayInfo == "MappedReadsPerContigInfo")
{
this.mapppedReadsPerContigInfoSelection[event.target.id] = checked;
viewMgr.render();
return;
}
}
}
}
Expand Down
Loading

0 comments on commit f9440b1

Please sign in to comment.