Skip to content

Commit bac555e

Browse files
committed
removed comments and added test file for vcf
1 parent 2d4e47a commit bac555e

File tree

3 files changed

+61
-34
lines changed

3 files changed

+61
-34
lines changed

src/generate-tests.cpp

+21-18
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ int main(void) {
3535
const std::set<std::string> excludeExt {};
3636
const std::set<std::string> excludeFile {"random4.fasta", "random4.fastq", "random5.fasta", "random5.fastq", "random6.fastq", "random7.fastq", "random8.fastq", "random9.fastq", "random10.fastq", "random11.fasta", "random11.fastq", "random12.fasta", "random12.fastq", "to_correct.fasta", "to_correct.fastq", "decompressor1.fasta", "repeat1.fasta", "repeat1.fastq"};
3737

38-
std::vector<std::pair<std::set<std::string>, std::vector<std::string>>> file_args = {
39-
{{"random1.fasta"}, {"-r testFiles/random3.N.fastq", "-d testFiles/test1.kreeq", "-d testFiles/test2.kreeq"}},
40-
{{"random4.fasta"}, {"-r testFiles/random4.fastq -k3"}},
41-
{{"to_correct.fasta"}, {"-r testFiles/to_correct.fastq", "-r testFiles/to_correct.fastq -o gfa", "-r testFiles/to_correct.fastq -o vcf", "-r testFiles/to_correct.fastq -o vcf -p testFiles/random1.anomalies.bed"}}
42-
// {{set of test inputs}, {list of command line args to run with}}
43-
};
4438

4539
for(const std::string &file : list_dir("testFiles")) {
4640
std::string ext = getFileExt(file);
@@ -53,18 +47,8 @@ int main(void) {
5347
}
5448
}
5549
}
56-
57-
std::fstream fstream;
58-
for(const auto &pair : file_args) {
59-
for(const std::string &file : pair.first) {
60-
fstream.open("testFiles/"+file);
61-
if(!fstream) continue;
62-
fstream.close();
63-
for(const std::string &args : pair.second) {
64-
genTest("kreeq", "validate", "-f testFiles/" + file, args);
65-
}
66-
}
67-
}
50+
51+
std::vector<std::pair<std::set<std::string>, std::vector<std::string>>> file_args;
6852

6953
// test union
7054
file_args = {
@@ -126,5 +110,24 @@ int main(void) {
126110
}
127111
}
128112
}
113+
114+
// test variant calling
115+
file_args = {
116+
{{"to_correct.fasta"}, {"-r testFiles/to_correct.fastq -o vcf --search-depth 50 --max-span 32"}}
117+
// {{set of test inputs}, {list of command line args to run with}}
118+
};
119+
120+
std::fstream fstream;
121+
for(const auto &pair : file_args) {
122+
for(const std::string &file : pair.first) {
123+
fstream.open("testFiles/"+file);
124+
if(!fstream) continue;
125+
fstream.close();
126+
for(const std::string &args : pair.second) {
127+
genTest("kreeq", "validate", "-f testFiles/" + file, args);
128+
}
129+
}
130+
}
131+
129132
std::exit(EXIT_SUCCESS);
130133
}

src/variants.cpp

+3-16
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,9 @@ bool DBG::DBGtoVariants(InSegment *inSegment) {
129129
auto results = searchVariants(pair, mapRange, targetsQueue, targetsMap, localGraphCache);
130130
explored += results.first;
131131
if (results.first) {
132-
for (DBGpath &path : results.second) {
132+
for (DBGpath &path : results.second)
133133
path.pos = c+k;
134-
135-
std::cout<<inSegment->getSeqHeader()<<" "<<+path.pos<<" "<<" "<<path.sequence<<std::endl;
136-
137-
if (path.type == COM)
138-
std::cout<<"COM"<<std::endl;
139-
else if (path.type == SNV)
140-
std::cout<<"SNV"<<std::endl;
141-
else if (path.type == INS)
142-
std::cout<<"INS"<<std::endl;
143-
else
144-
std::cout<<"DEL"<<std::endl;
145-
146-
}
147-
134+
148135
if (results.second.size() != 0)
149136
variants.push_back(results.second);
150137

@@ -311,7 +298,7 @@ std::pair<bool,std::deque<DBGpath>> DBG::searchVariants(std::pair<const uint64_t
311298

312299
prevNode = prev[destination].first;
313300
bool direction = prev[prevNode].second;
314-
std::cout<<+direction<<" "<<+i<<" "<<+refLen<<std::endl;
301+
315302
while (b >= 0) {
316303
newPath.sequence.push_back(direction ? reverseHash(prevNode)[0] : revCom(reverseHash(prevNode)[k-1]));
317304
prevNode = prev[prevNode].first;

validateFiles/test.50.tst

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
kreeq validate -f testFiles/to_correct.fasta -r testFiles/to_correct.fastq -o vcf --search-depth 50 --max-span 32
2+
embedded
3+
##fileformat=VCFv4.2
4+
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
5+
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
6+
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE
7+
sequence2 25 . a T 0 PASS . GT:GQ 1/1:0
8+
sequence2 65 . t C 0 PASS . GT:GQ 1/1:0
9+
sequence3 33 . Ga G 0 PASS . GT:GQ 1/1:0
10+
sequence4 33 . GA GCA 0 PASS . GT:GQ 1/1:0
11+
sequence5 69 . Aa A 0 PASS . GT:GQ 1/1:0
12+
sequence6 68 . AT AAT 0 PASS . GT:GQ 1/1:0
13+
sequence7 25 . aCGTACATGCt TCGTACATGCA 0 PASS . GT:GQ 1/1:0
14+
sequence8 72 . c A 0 PASS . GT:GQ 1/1:0
15+
sequence9 50 . t C 0 PASS . GT:GQ 1/1:0
16+
sequence10 25 . aCc TCG 0 PASS . GT:GQ 1/1:0
17+
sequence11 25 . aCc TCG 0 PASS . GT:GQ 1/1:0
18+
sequence11 65 . t C 0 PASS . GT:GQ 1/1:0
19+
sequence12 25 . aCcTACATGCt TCGTACATGCA 0 PASS . GT:GQ 1/1:0
20+
sequence13 25 . a T 0 PASS . GT:GQ 1/1:0
21+
sequence13 68 . AT AAT 0 PASS . GT:GQ 1/1:0
22+
sequence14 33 . GA GCA 0 PASS . GT:GQ 1/1:0
23+
sequence14 67 . AT AAT 0 PASS . GT:GQ 1/1:0
24+
sequence15 46 . AT AAT 0 PASS . GT:GQ 1/1:0
25+
sequence15 67 . AT AAT 0 PASS . GT:GQ 1/1:0
26+
sequence16 67 . AT AAAT 0 PASS . GT:GQ 1/1:0
27+
sequence17 25 . a T 0 PASS . GT:GQ 1/1:0
28+
sequence17 69 . Aa A 0 PASS . GT:GQ 1/1:0
29+
sequence18 33 . Ga G 0 PASS . GT:GQ 1/1:0
30+
sequence18 70 . Aa A 0 PASS . GT:GQ 1/1:0
31+
sequence19 34 . aCAGTGATGTa TGCAGTGATGT 0 PASS . GT:GQ 1/1:0
32+
sequence20 69 . Aa A 0 PASS . GT:GQ 1/1:0
33+
sequence21 25 . at TC 0 PASS . GT:GQ 1/1:0
34+
sequence22 30 . g C 0 PASS . GT:GQ 1/1:0
35+
sequence22 70 . g T 0 PASS . GT:GQ 1/1:0
36+
sequence23 40 . a T 0 PASS . GT:GQ 1/1:0
37+
sequence23 75 . c G 0 PASS . GT:GQ 1/1:0

0 commit comments

Comments
 (0)