Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chipseq_analysis
Manage
Activity
Members
Labels
Plan
Issues
19
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
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
BICF
Astrocyte
chipseq_analysis
Commits
477530aa
There was an error fetching the commit references. Please try again later.
Commit
477530aa
authored
7 years ago
by
Venkat Malladi
Browse files
Options
Downloads
Patches
Plain Diff
Fix syntax issues and libaries.
parent
ae9e6c75
1 merge request
!12
Resolve "Pool and Pseudoreplication"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
workflow/main.nf
+2
-2
2 additions, 2 deletions
workflow/main.nf
workflow/scripts/pool_and_psuedoreplicate.py
+7
-7
7 additions, 7 deletions
workflow/scripts/pool_and_psuedoreplicate.py
workflow/scripts/utils.py
+6
-6
6 additions, 6 deletions
workflow/scripts/utils.py
with
15 additions
and
15 deletions
workflow/main.nf
+
2
−
2
View file @
477530aa
...
...
@@ -297,12 +297,12 @@ process poolAndPsuedoReads {
if (pairedEnd) {
"""
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -
t
$experimentObjs -p -c cutoffRatio
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -
d
$experimentObjs -p -c cutoffRatio
"""
}
else {
"""
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -
t
$experimentObjs -c cutoffRatio
python3 $baseDir/scripts/pool_and_psuedoreplicate.py -
d
$experimentObjs -c cutoffRatio
"""
}
...
...
This diff is collapsed.
Click to expand it.
workflow/scripts/pool_and_psuedoreplicate.py
+
7
−
7
View file @
477530aa
...
...
@@ -82,9 +82,9 @@ def pool(tag_files, outfile, paired):
'''
Pool files together.
'''
if
paired
:
file_extension
=
'
bedpe.gz
'
file_extension
=
'
.
bedpe.gz
'
else
:
file_extension
=
'
bedse.gz
'
file_extension
=
'
.
bedse.gz
'
pooled_filename
=
outfile
+
file_extension
...
...
@@ -98,7 +98,7 @@ def pool(tag_files, outfile, paired):
def
self_psuedoreplication
(
tag_file
,
prefix
,
paired
):
'''
Make
n number of
self-psuedoreplicates
equivlent to reps
.
'''
'''
Make
2
self-psuedoreplicates.
'''
# Get total number of reads
no_lines
=
utils
.
count_lines
(
tag_file
)
...
...
@@ -124,7 +124,7 @@ def self_psuedoreplication(tag_file, prefix, paired):
# Convert read pairs to reads into standard tagAlign file
for
i
,
index
in
enumerate
(
list
(
range
(
0
,
reps
))
):
for
i
,
index
in
enumerate
(
[
0
,
1
]
):
steps
=
[
'
cat %s
'
%
(
splits_prefix
+
index
)]
if
paired
:
steps
.
extend
([
r
"""
awk
'
BEGIN{OFS=
"
\t
"
}{printf
"
%s\t%s\t%s\tN\t1000\t%s\n%s\t%s\t%s\tN\t1000\t%s\n
"
,$1,$2,$3,$9,$4,$5,$6,$10}
'"""
])
...
...
@@ -139,7 +139,7 @@ def main():
args
=
get_args
()
paired
=
args
.
paired
design
=
args
.
design
cutoff_ratio
=
args
.
cutoff
_ratio
cutoff_ratio
=
args
.
cutoff
# Create a file handler
handler
=
logging
.
FileHandler
(
'
experiment_generation.log
'
)
...
...
@@ -149,7 +149,7 @@ def main():
design_df
=
pd
.
read_csv
(
design
,
sep
=
'
\t
'
)
# Get current directory to build paths
cwd
=
os
.
getwd
()
cwd
=
os
.
get
c
wd
()
# Check Number of replicates and replicates
no_reps
=
check_replicates
(
design_df
)
...
...
@@ -217,7 +217,7 @@ def main():
# Make self psuedoreplicates equivalent to number of replicates
pseudoreplicates_dict
=
{}
for
rep
,
tag_file
in
zip
(
design_df
[
'
replicate
'
],
design_df
[
'
tag_align
'
]):
replicate_prefix
=
experiment_id
+
'
_
'
+
rep
replicate_prefix
=
experiment_id
+
'
_
'
+
str
(
rep
)
pr_dict
=
self_psuedoreplication
(
tag_file
,
replicate_prefix
,
paired
)
pseudoreplicates_dict
[
rep
]
=
pr_dict
...
...
This diff is collapsed.
Click to expand it.
workflow/scripts/utils.py
+
6
−
6
View file @
477530aa
...
...
@@ -56,19 +56,19 @@ def strip_extensions(filename, extensions):
def
count_lines
(
filename
):
from
magic
import
from_file
import
mimetypes
compressed_mimetypes
=
[
"
application/x-
compress
"
,
"
application/x-
bzip2
"
,
"
application/x-
gzip
"
"
compress
"
,
"
bzip2
"
,
"
gzip
"
]
mime_type
=
from_
file
(
f
name
,
mime
=
True
)
mime_type
=
mimetypes
.
guess_type
(
filename
)[
1
]
if
mime_type
in
compressed_mimetypes
:
catcommand
=
'
gzip -dc
'
else
:
catcommand
=
'
cat
'
out
,
err
=
run_pipe
([
'
%s %s
'
%
(
catcommand
,
fname
),
'
%s %s
'
%
(
catcommand
,
f
ile
name
),
'
wc -l
'
])
return
int
(
out
)
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