-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·129 lines (105 loc) · 5.43 KB
/
main.cpp
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
121
122
123
124
125
126
127
128
129
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
/*
* To know file info
*/
// QString file = "/home/chao/Desktop/test/output/a.b.assoc.txt";
// QFileInfo fileInfo(file);
// QString baseName = fileInfo.baseName();
// QString abPath = fileInfo.absolutePath();
// QDir abDir = fileInfo.absoluteDir();
// QString fileName = fileInfo.fileName();
// QString suffix = fileInfo.suffix();
// QString comSuffix = fileInfo.completeSuffix();
// QString comBaseName = fileInfo.completeBaseName();
/*
* To test open external tool
*/
// QProcess pro;
// pro.start("Rscript");
// if (pro.waitForStarted(-1))
// {
// qDebug() << "started." <<endl;
// }
// else
// {
// qDebug() << "Not started." << endl;
// }
/*
* To test QRegExp
*/
// QString str = "HDH_G00730plitHDH_T00730:exon1:c.A132G:p.T44T,";
// QRegExp regExp("([^:]*):(.*),");
// int pos = regExp.indexIn(str);
// QStringList list = regExp.capturedTexts();
// QString strA = regExp.cap(1);
// QString strB = regExp.cap(2);
// QString str("A(B)");
// QStringList gene = str.split(QRegExp("\\(|\\)"), QString::SkipEmptyParts);
// QRegExp regExp("transcript_id \"(.*)\"");
// QString item = "transcript_id \"ID\"";
// int pos = regExp.indexIn(item);
// QString tmp;
// if (pos >= 0)
// tmp = regExp.cap(1);
// FuncAnnotator funcAnnotator;
// funcAnnotator.getTransIDFromGff("/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic.gff");
// funcAnnotator.makeBaseFromNcbi("/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic.gtf",
// "/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic_anno_ncbi.csv",
// "/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic_anno_ncbi.out");
// QMap<QString, QString> map = funcAnnotator.getProteinIDandTransIDFromGff("/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic.gff");
// QFile out("/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic_anno_ncbi.out");
// out.open(QIODevice::WriteOnly);
// QTextStream stream(&out);
// for (auto it = map.begin(); it != map.end(); ++it)
// {
// stream << it.key() << "\t" << it.value() << endl;
// }
// QSet<QString> set = funcAnnotator.getTransIDFromGff("/media/dengchao/data/data/Yesso_scallop/GCF_002113885.1_ASM211388v2_genomic.gff");
// for (auto it : set)
// {
// stream << it << endl;
// }
// QFile funcAnno("/media/dengchao/data/data/Funcional_anno/Hdhv3_changeID_annotation");
// QFile funcBase("/media/dengchao/data/data/Funcional_anno/Hdhv3_changeID_annotation.funcanno");
// QFile funcEnsemCsv("/media/dengchao/data/data/Funcional_anno/Hdhv3_changeID_annotation.ensem.csv");
// QFile funcNcbiCsv("/media/dengchao/data/data/Funcional_anno/Hdhv3_changeID_annotation.ncbi.csv");
// funcAnno.open(QIODevice::ReadOnly);
// funcBase.open(QIODevice::WriteOnly);
// funcEnsemCsv.open(QIODevice::WriteOnly);
// funcNcbiCsv.open(QIODevice::WriteOnly);
// QTextStream funcAnnoStream(&funcAnno);
// QTextStream funcBaseStream(&funcBase);
// QTextStream funcCsvStream(&funcEnsemCsv);
// QTextStream funcNcbiStream(&funcNcbiCsv);
// funcAnnoStream.readLine();
// funcCsvStream << "Gene stable ID,Transcript stable ID,Protein stable ID,Gene name,Gene description" << endl;
// funcNcbiStream << "#Accession,Locus,Protein product,Protein Name" << endl;
// while (!funcAnnoStream.atEnd())
// {
// QStringList curLineList = funcAnnoStream.readLine().split("\t");
// curLineList[0] = curLineList[0].replace("T", "G");
// funcBaseStream << curLineList.join("\t") << endl;
// funcCsvStream << curLineList[0] << ",,,,Description_"+curLineList[0] << endl;
// funcNcbiStream << ",\"" << curLineList[0] << "\""
// << ",,\"Description_"+curLineList[0] << "\"" << endl;
// }
FuncAnnotator funcAnnotator;
// funcAnnotator.complExoSnpInfo("/media/dengchao/data/data/function_annotation/tmp_pos",
// "/media/dengchao/data/data/function_annotation/snp_anno.exonic_variant_function",
// "/media/dengchao/data/data/function_annotation/exonic_pos");
// funcAnnotator.complNonExoSnpInfo("/media/dengchao/data/data/function_annotation/exonic_pos_cpy",
// "/media/dengchao/data/data/function_annotation/tmp_pos",
// "/media/dengchao/data/data/function_annotation/snp_anno.variant_function",
// "/media/dengchao/data/data/function_annotation/non_exonic_pos");
// funcAnnotator.complFuncAnnoInfo("/media/dengchao/data/data/function_annotation/exonic_pos",
// "/media/dengchao/data/data/function_annotation/non_exonic_pos",
// "/media/dengchao/data/data/Funcional_anno/Hdhv3_changeID_annotation.ncbi.csv",
// "/media/dengchao/data/data/Funcional_anno/func_anno_res");
MainWindow w;
w.show();
return a.exec();
}