Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chipseq_analysis
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Astrocyte
Workflows
BICF
chipseq_analysis
Commits
9b65c0bd
Commit
9b65c0bd
authored
7 years ago
by
Venkat Malladi
Browse files
Options
Downloads
Patches
Plain Diff
Add header to pbc file.
parent
2948ddca
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workflow/scripts/map_qc.py
+17
-2
17 additions, 2 deletions
workflow/scripts/map_qc.py
with
17 additions
and
2 deletions
workflow/scripts/map_qc.py
+
17
−
2
View file @
9b65c0bd
...
...
@@ -10,6 +10,7 @@ import shlex
import
logging
from
multiprocessing
import
cpu_count
import
utils
import
pandas
as
pd
EPILOG
=
'''
For more details:
...
...
@@ -205,7 +206,8 @@ def dedup_mapped(bam, bam_basename, paired):
def
compute_complexity
(
bam
,
paired
,
bam_basename
):
'''
Calculate library complexity .
'''
pbc_file_qc_filename
=
bam_basename
+
"
filt.nodup.pbc.qc
"
pbc_file_qc_filename
=
bam_basename
+
"
.filt.nodup.pbc.qc
"
tmp_pbc_file_qc_filename
=
"
tmp.%s
"
%
(
pbc_file_qc_filename
)
# Sort by name
# convert to bedPE and obtain fragment coordinates
...
...
@@ -220,6 +222,13 @@ def compute_complexity(bam, paired, bam_basename):
# NRF=Distinct/Total [tab]
# PBC1=OnePair/Distinct [tab]
# PBC2=OnePair/TwoPair
pbc_headers
=
[
'
TotalReadPairs
'
,
'
DistinctReadPairs
'
,
'
OneReadPair
'
,
'
TwoReadPairs
'
,
'
NRF
'
,
'
PBC1
'
,
'
PBC2
'
]
if
paired
:
steps
=
[
...
...
@@ -236,10 +245,16 @@ def compute_complexity(bam, paired, bam_basename):
"
uniq -c
"
,
r
"""
awk
'
BEGIN{mt=0;m0=0;m1=0;m2=0} ($1==1){m1=m1+1} ($1==2){m2=m2+1} {m0=m0+1} {mt=mt+$1} END{printf
"
%d\t%d\t%d\t%d\t%f\t%f\t%f\n
"
,mt,m0,m1,m2,m0/mt,m1/m0,m1/m2}
'"""
])
out
,
err
=
utils
.
run_pipe
(
steps
,
pbc_file_qc_filename
)
out
,
err
=
utils
.
run_pipe
(
steps
,
tmp_
pbc_file_qc_filename
)
if
err
:
logger
.
error
(
"
PBC file error: %s
"
%
(
err
))
# Add headers
pbc_file
=
pd
.
read_csv
(
tmp_pbc_file_qc_filename
,
sep
=
'
\t
'
,
header
=
None
,
names
=
pbc_headers
)
pbc_file
.
to_csv
(
pbc_file_qc_filename
,
header
=
True
,
sep
=
'
\t
'
,
index
=
False
)
os
.
remove
(
tmp_pbc_file_qc_filename
)
def
main
():
args
=
get_args
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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