Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vihgo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gad-public
vihgo
Commits
525abefc
Commit
525abefc
authored
Jan 22, 2021
by
Yannis Duffourd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding new method to write the full consensus sequence
parent
a04b957e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
2 deletions
+74
-2
Vihgo.cpp
cpp/Vihgo.cpp
+74
-2
No files found.
cpp/Vihgo.cpp
View file @
525abefc
...
...
@@ -31,7 +31,7 @@ Vihgo::Vihgo() {
Vihgo
::
Vihgo
(
string
iBF
,
string
gF
,
string
rtF
,
string
intF
,
string
protF
,
string
refF
,
string
outF
,
string
cResF
,
string
csF
,
string
iRCB
,
int
dT
,
int
nT
,
int
lL
,
double
rT
,
double
pvT
,
bool
countStop
)
{
int
dT
,
int
nT
,
int
lL
,
double
rT
,
double
pvT
,
bool
countStop
,
bool
fullCS
)
{
this
->
inputBamFile
=
iBF
;
this
->
geneFile
=
gF
;
this
->
integraseFile
=
intF
;
...
...
@@ -48,6 +48,7 @@ Vihgo::Vihgo(string iBF, string gF, string rtF, string intF, string protF,
this
->
ratioThreshold
=
rT
;
this
->
pvalueThreshold
=
pvT
;
this
->
countStop
=
countStop
;
this
->
fullCS
=
fullCS
;
this
->
codonTable
.
insert
(
pair
<
string
,
string
>
(
"TTT"
,
"F"
));
this
->
codonTable
.
insert
(
pair
<
string
,
string
>
(
"TTC"
,
"F"
));
...
...
@@ -130,7 +131,14 @@ int Vihgo::mainLoop() {
this
->
displayData
(
"control"
);
this
->
displayData
(
"sample"
);
this
->
writeCodonFile
(
"sample"
);
this
->
writeConsensus
();
if
(
this
->
fullCS
){
this
->
writeFullConsensus
();
}
else
{
this
->
writeConsensus
();
}
this
->
variantCalling
();
return
0
;
...
...
@@ -1727,6 +1735,70 @@ void Vihgo::writeConsensus() {
csStream
.
close
();
}
// Method to compute and write the full consensus sequence
void
Vihgo
::
writeFullConsensus
()
{
cerr
<<
"Writing full consensus sequence ... "
<<
endl
;
ofstream
csStream
;
csStream
.
open
((
this
->
getConsensusFile
()).
c_str
(),
ios
::
out
);
map
<
string
,
map
<
int
,
map
<
string
,
int
>>>::
iterator
myIterA
;
map
<
int
,
map
<
string
,
int
>>::
iterator
myIterB
;
map
<
string
,
int
>::
iterator
myIterC
;
map
<
string
,
map
<
int
,
string
>>::
iterator
myIterE
;
map
<
int
,
string
>::
iterator
myIterF
;
for
(
myIterE
=
this
->
protCodon
.
begin
();
myIterE
!=
this
->
protCodon
.
end
();
myIterE
++
)
{
string
prot
=
myIterE
->
first
;
string
chrom
=
getChrFromProt
(
prot
);
if
(
!
(
this
->
sampleData
.
count
(
chrom
)
>
0
))
{
continue
;
}
csStream
<<
">"
<<
prot
<<
endl
;
for
(
myIterF
=
(
myIterE
->
second
).
begin
();
myIterF
!=
(
myIterE
->
second
).
end
();
myIterF
++
)
{
int
aaPosition
=
myIterF
->
first
;
int
gPosition
;
map
<
int
,
int
>
tmpMap
=
this
->
refProtCorresp
[
prot
];
map
<
int
,
int
>::
iterator
myIterG
;
for
(
myIterG
=
tmpMap
.
begin
();
myIterG
!=
tmpMap
.
end
();
myIterG
++
)
{
if
(
myIterG
->
second
==
aaPosition
)
{
gPosition
=
myIterG
->
first
;
break
;
}
}
// cerr << "ppos : " << aaPosition << " ; genomic position is : " <<
// gPosition << endl;
// determine most frequent codon
string
codon
=
"NNN"
;
int
count
=
0
;
if
(
this
->
sampleData
[
chrom
].
count
(
gPosition
)
>
0
)
{
map
<
string
,
int
>
tmpMapCodon
;
tmpMapCodon
=
this
->
sampleData
[
chrom
][
gPosition
];
map
<
string
,
int
>::
iterator
myIterH
;
for
(
myIterH
=
tmpMapCodon
.
begin
();
myIterH
!=
tmpMapCodon
.
end
();
myIterH
++
)
{
if
(
myIterH
->
second
>
count
)
{
codon
=
myIterH
->
first
;
count
=
myIterH
->
second
;
}
}
}
csStream
<<
codon
;
}
csStream
<<
endl
;
}
csStream
.
close
();
}
// method to get the chromosome in which the prot is included
string
Vihgo
::
getChrFromProt
(
string
incProt
)
{
return
this
->
genes
[
incProt
][
"chrom"
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment