Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
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
Mirrors
biopet.biopet
Commits
97fd01f3
Commit
97fd01f3
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Changed to make it compatible for new file structure
parent
f9d9430b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flexiprep/scripts/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/summarize_flexiprep.py
+9
-5
9 additions, 5 deletions
...biopet/pipelines/flexiprep/scripts/summarize_flexiprep.py
with
9 additions
and
5 deletions
flexiprep/scripts/nl/lumc/sasc/biopet/pipelines/flexiprep/scripts/summarize_flexiprep.py
+
9
−
5
View file @
97fd01f3
...
@@ -116,7 +116,7 @@ def clip2dict(sample, samplea, sampleb, lib_type, run_dir):
...
@@ -116,7 +116,7 @@ def clip2dict(sample, samplea, sampleb, lib_type, run_dir):
def
get_sync_stats
(
sample
):
def
get_sync_stats
(
sample
):
stats
=
{}
stats
=
{}
with
open_result
(
sample
+
'
.clipsync.stats
'
)
as
src
:
with
open_result
(
sample
+
'
.clip
.
sync.stats
'
)
as
src
:
sync_txt
=
src
.
read
()
sync_txt
=
src
.
read
()
stats
[
'
num_reads_discarded_1
'
]
=
int
(
re
.
search
(
re_disc_1
,
sync_txt
).
group
(
1
))
stats
[
'
num_reads_discarded_1
'
]
=
int
(
re
.
search
(
re_disc_1
,
sync_txt
).
group
(
1
))
...
@@ -146,15 +146,19 @@ def clip2dict(sample, samplea, sampleb, lib_type, run_dir):
...
@@ -146,15 +146,19 @@ def clip2dict(sample, samplea, sampleb, lib_type, run_dir):
return
clip_stats
return
clip_stats
def
sickle2dict
(
run_name
,
lib_type
,
run_dir
):
def
sickle2dict
(
run_name
,
qc_mode
,
lib_type
,
run_dir
):
trim_stats
=
{}
trim_stats
=
{}
if
qc_mode
==
'
trim
'
:
stat_mark
=
'
.trim.stats
'
else
:
stat_mark
=
'
.clip.sync.trim.stats
'
if
lib_type
==
'
paired
'
:
if
lib_type
==
'
paired
'
:
re_paired_kept
=
re
.
compile
(
r
'
paired records kept: \d+ \((\d+) pairs\)
'
)
re_paired_kept
=
re
.
compile
(
r
'
paired records kept: \d+ \((\d+) pairs\)
'
)
re_disc
=
re
.
compile
(
r
'
single records discarded: \d+ \(from PE1: (\d+), from PE2: (\d+)\)
'
)
re_disc
=
re
.
compile
(
r
'
single records discarded: \d+ \(from PE1: (\d+), from PE2: (\d+)\)
'
)
re_disc_paired
=
re
.
compile
(
r
'
paired records discarded: \d+ \((\d+) pairs\)
'
)
re_disc_paired
=
re
.
compile
(
r
'
paired records discarded: \d+ \((\d+) pairs\)
'
)
with
open
(
os
.
path
.
join
(
run_dir
,
run_name
+
'
.filtersync.stats
'
))
as
src
:
with
open
(
os
.
path
.
join
(
run_dir
,
run_name
+
stat_mark
))
as
src
:
sickle_txt
=
src
.
read
()
sickle_txt
=
src
.
read
()
discarda
=
int
(
re
.
search
(
re_disc
,
sickle_txt
).
group
(
1
))
discarda
=
int
(
re
.
search
(
re_disc
,
sickle_txt
).
group
(
1
))
...
@@ -170,7 +174,7 @@ def sickle2dict(run_name, lib_type, run_dir):
...
@@ -170,7 +174,7 @@ def sickle2dict(run_name, lib_type, run_dir):
else
:
else
:
re_kept
=
re
.
compile
(
r
'
records kept: (\d+)
'
)
re_kept
=
re
.
compile
(
r
'
records kept: (\d+)
'
)
re_disc
=
re
.
compile
(
r
'
records discarded: (\d+)
'
)
re_disc
=
re
.
compile
(
r
'
records discarded: (\d+)
'
)
with
open
(
os
.
path
.
join
(
run_dir
,
run_name
+
'
.filtersync.stats
'
))
as
src
:
with
open
(
os
.
path
.
join
(
run_dir
,
run_name
+
stat_mark
))
as
src
:
sickle_txt
=
src
.
read
()
sickle_txt
=
src
.
read
()
trim_stats
[
'
num_reads_kept
'
]
=
int
(
re
.
search
(
re_kept
,
sickle_txt
).
group
(
1
))
trim_stats
[
'
num_reads_kept
'
]
=
int
(
re
.
search
(
re_kept
,
sickle_txt
).
group
(
1
))
...
@@ -399,7 +403,7 @@ def summarize_flexiprep(run_name, qc_mode, samplea, sampleb, outf, run_dir):
...
@@ -399,7 +403,7 @@ def summarize_flexiprep(run_name, qc_mode, samplea, sampleb, outf, run_dir):
sumd
[
'
stats
'
][
'
clip
'
]
=
clip2dict
(
run_name
,
samplea
,
sampleb
,
lib_type
,
run_dir
)
sumd
[
'
stats
'
][
'
clip
'
]
=
clip2dict
(
run_name
,
samplea
,
sampleb
,
lib_type
,
run_dir
)
if
'
trim
'
in
qc_mode
:
if
'
trim
'
in
qc_mode
:
sumd
[
'
stats
'
][
'
trim
'
]
=
sickle2dict
(
run_name
,
lib_type
,
run_dir
)
sumd
[
'
stats
'
][
'
trim
'
]
=
sickle2dict
(
run_name
,
qc_mode
,
lib_type
,
run_dir
)
dict2json
(
sumd
,
outf
)
dict2json
(
sumd
,
outf
)
...
...
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