-
Notifications
You must be signed in to change notification settings - Fork 2
/
QCData.ts
120 lines (110 loc) · 2.87 KB
/
QCData.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import {Fastq} from "./fastq";
import {getReadableAndWritable} from "./getAppPath";
export type QCReportDisposition =
"pass" |
"warn" |
"fail" |
"No Data";
export type QCReportType =
"Per base sequence quality" |
"Per sequence quality scores" |
"Per sequence GC content" |
"Sequence Duplication Levels" |
"Overrepresented sequences" |
"Basic Stastics";
export class QCData
{
public summary : Array<QCSummary>;
public validID : string | undefined;
public reportRun : boolean;
public constructor()
{
this.reportRun = false;
this.summary = new Array<QCSummary>();
}
}
/**
* Return path to the given fastq file's quality control report
*
* @export
* @param {Fastq} fastq - Fastq file
* @returns {string}
*/
export function getQCReportHTML(fastq : Fastq) : string
{
return getReadableAndWritable(`rt/QCReports/${fastq.uuid}/fastqc_report.html`);
}
/**
* Return path to the given fastq file's raw quality control data
*
* @export
* @param {Fastq} fastq - Fastq file
* @returns {string}
*/
export function getQCReportData(fastq : Fastq) : string
{
return getReadableAndWritable(`rt/QCReports/${fastq.uuid}/fastqc_data.txt`);
}
export class QCSummary
{
public name : QCReportType;
public status : QCReportDisposition | undefined;
public constructor(name : QCReportType,status : QCReportDisposition)
{
this.name = name;
this.status = status;
}
}
/**
* Retrieve the given summary status of the quality control report in the given location in the given index
*
* @export
* @param {Array<Fastq>} fastqInputs - Collection of fastq files
* @param {number} index - Index to retrieve
* @param {QCReportType} summary - Summary to retrieve
* @returns {QCReportDisposition}
*/
export function getQCSummaryByNameOfReportByIndex(fastqInputs : Array<Fastq>,index : number,summary : QCReportType) : QCReportDisposition
{
try
{
for(let i = 0; i != fastqInputs[index].QCData.summary.length; ++i)
{
if(fastqInputs[index].QCData.summary[i].name == summary)
{
return fastqInputs[index].QCData.summary[i].status!;
}
}
}
catch(err)
{
err;
}
return "No Data";
}
/**
* Retrieve the given quality control report summary in the given fastq file
*
* @export
* @param {Fastq} fastq - Fastq file
* @param {QCReportType} summary - Quality control report summary
* @returns {QCReportDisposition}
*/
export function getQCSummaryByName(fastq : Fastq,summary : QCReportType) : QCReportDisposition
{
try
{
for(let i = 0; i != fastq.QCData.summary.length; ++i)
{
if(fastq.QCData.summary[i].name == summary)
{
return fastq.QCData.summary[i].status!;
}
}
}
catch(err)
{
err;
}
return "No Data";
}