Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sscocaller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioCellGen-public
sscocaller
Commits
c17d69da
Commit
c17d69da
authored
3 years ago
by
Ruqian Lyu
Browse files
Options
Downloads
Patches
Plain Diff
add bulk sample support
parent
d755de85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#6674
failed
3 years ago
Stage: buildStatic
Stage: testStatic
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sscocaller.nim
+14
-11
14 additions, 11 deletions
src/sscocaller.nim
with
14 additions
and
11 deletions
src/sscocaller.nim
+
14
−
11
View file @
c17d69da
...
...
@@ -76,14 +76,19 @@ proc countAllele(rec:Variant, ibam:Bam, maxTotalReads:int,
rec_alt
=
rec
.
ALT
[
0
][
0
]
for
aln
in
ibam
.
query
(
chrom
=
chrom
,
start
=
rec
.
POS
.
cint
-
1
,
stop
=
rec
.
POS
.
cint
):
var
cbt
=
tag
[
string
]
(
aln
,
"CB"
)
var
currentCB
:
string
if
cbt
.
isNone
:
# echo "no cb "
continue
if
not
bulkBam
:
continue
else
:
currentCB
=
"bulk"
else
:
currentCB
=
cbt
.
get
if
aln
.
flag
.
unmapped
or
aln
.
mapping_quality
.
cint
<
mapq
or
aln
.
flag
.
dup
:
continue
## skip unmapped, duplicated, mapq low reads or aln.flag.secondary or aln.flag.supplementary
## if not aln.flag.proper_pair: continue
if
not
barcodeTable
.
hasKey
(
cbt
.
get
):
if
not
barcodeTable
.
hasKey
(
currentCB
):
continue
var
off
=
aln
.
start
.
int
...
...
@@ -110,21 +115,21 @@ proc countAllele(rec:Variant, ibam:Bam, maxTotalReads:int,
if
aln
.
base_quality_at
(
qoff
-
over
-
1
).
cint
<
minbsq
:
continue
total_reads
+=
1
if
alleleCountTable
.
hasKey
(
c
bt
.
get
):
if
alleleCountTable
.
hasKey
(
c
urrentCB
):
if
aln
.
base_at
(
qoff
-
over
-
1
)
==
rec
.
REF
[
0
]
:
alleleCountTable
[
c
bt
.
get
]
.
inc_count_cref
alleleCountTable
[
c
urrentCB
]
.
inc_count_cref
continue
if
aln
.
base_at
(
qoff
-
over
-
1
)
==
rec_alt
:
alleleCountTable
[
c
bt
.
get
]
.
inc_count_calt
alleleCountTable
[
c
urrentCB
]
.
inc_count_calt
continue
else
:
var
new_snp
=
allele_expr
(
cref
:
0
,
calt
:
0
)
alleleCountTable
[
c
bt
.
get
]
=
new_snp
alleleCountTable
[
c
urrentCB
]
=
new_snp
if
aln
.
base_at
(
qoff
-
over
-
1
)
==
rec
.
REF
[
0
]
:
alleleCountTable
[
c
bt
.
get
]
.
inc_count_cref
alleleCountTable
[
c
urrentCB
]
.
inc_count_cref
continue
if
aln
.
base_at
(
qoff
-
over
-
1
)
==
rec_alt
:
alleleCountTable
[
c
bt
.
get
]
.
inc_count_calt
alleleCountTable
[
c
urrentCB
]
.
inc_count_calt
continue
if
total_reads
>
maxTotalReads
or
total_reads
<
minTotalReads
:
return
initTable
[
string
,
allele_expr
]
()
...
...
@@ -179,7 +184,6 @@ proc sscocaller(threads:int, vcff:string, barcodeFile:string,
outFileSNPanno
=
openFileStream
(
out_dir
&
chrom
&
"_snpAnnot.txt"
,
fmWrite
)
outFileTotalCountMtx
=
openFileStream
(
out_dir
&
chrom
&
"_totalCount.mtx"
,
fmWrite
)
outFileAltCountMtx
=
openFileStream
(
out_dir
&
chrom
&
"_altCount.mtx"
,
fmWrite
)
# outHeaderMtx = openFileStream(out_dir & chrom & "_header.mtx", fmWrite)
outFileVStateMtx
=
openFileStream
(
out_dir
&
chrom
&
"_vi.mtx"
,
fmWrite
)
viSegmentInfo
=
openFileStream
(
out_dir
&
chrom
&
"_viSegInfo.txt"
,
fmWrite
)
#echo strm.readLine()
...
...
@@ -217,7 +221,6 @@ proc sscocaller(threads:int, vcff:string, barcodeFile:string,
# ac.tostring(acs)
## mindp, maxdp, they are values per cell
if
(
ac
.
cref
+
ac
.
calt
)
<=
mindp
or
(
ac
.
cref
+
ac
.
calt
)
>=
maxdp
:
continue
var
ithSperm
=
barcodeTable
[
bc
]
## write to mtx Ref count
outFileTotalCountMtx
.
writeLine
(
$
snpIndex
&
" "
&
$
(
ithSperm
+
1
)
&
" "
&
$
(
ac
.
cRef
+
ac
.
cAlt
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment