Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RMI2 pipelines
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
RMI2
RMI2 pipelines
Commits
7008f297
Commit
7008f297
authored
Nov 17, 2020
by
elabaron
Browse files
Options
Downloads
Patches
Plain Diff
RNAseq.nf : fix coverage normalization (as I did before for RibosomeProfiling.nf)
parent
872db5c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/RNAseq.nf
+94
-40
94 additions, 40 deletions
src/RNAseq.nf
with
94 additions
and
40 deletions
src/RNAseq.nf
+
94
−
40
View file @
7008f297
...
...
@@ -462,7 +462,7 @@ rnaseqc ${gtf} ${bam[0]} -s ${file_id} ./ \
/* HISAT2 POST_GENOMIC */
/////////////////////////
process
hisat2_post
G
enom
ic
{
process
hisat2_post
g
enom
e
{
tag
"$file_id"
publishDir
"${params.output}/05_post_genome_hisat2/"
,
mode:
'copy'
...
...
@@ -569,51 +569,105 @@ process fastqc_postgenome {
/* Coverage */
//////////////
process
coverage_postgenome
{
if
(
params
.
do_postgenome
){
HISAT_ALIGNED_COV
.
join
(
POSTGENOME_ALIGNED_COV
)
.
into
{
COVERAGE_MERGED_VALUES
;
COVERAGE_MERGED_BAM
}
process
calc_scalingFactor_with_postgenome
{
tag
"$file_id"
publishDir
"${params.output}/07_coverage/"
,
mode:
'copy'
input:
set
file_id
,
file
(
bam
)
from
HISAT_ALIGNED_COV
set
file_id_2
,
file
(
post_genome
)
from
POSTGENOME_ALIGNED_COV
set
file_id
,
file
(
genome
),
file
(
post_genome
)
from
COVERAGE_MERGED_VALUES
output:
file
"*.bigwig"
into
COVERAGE_OUTPUT
when:
params
.
do_postgenome
set
file_id
,
env
(
genome
),
env
(
postgenome
),
env
(
factor
)
into
COVERAGE_MERGED_FACTOR
shell:
'''
genome=$(samtools view !{
bam
[0]} | awk '{print $1}' | sort | uniq | wc -l)
genome=$(samtools view !{
genome
[0]} | awk '{print $1}' | sort | uniq | wc -l)
postgenome=$(samtools view !{post_genome[0]} | awk '{print $1}' | sort | uniq | wc -l)
total=$(($genome + $postgenome))
factor=$(awk -v c=$total 'BEGIN {print 1000000/c}')
bamCoverage -p !{task.cpus} --binSize 1 -b !{bam[0]} -o !{file_id}_genome.bigwig
bamCoverage -p !{task.cpus} --binSize 1 -b !{post_genome[0]} -o !{file_id}_postgenome.bigwig
'''
}
process
coverage
{
COVERAGE_MERGED_FACTOR
.
join
(
COVERAGE_MERGED_BAM
)
.
set
{
COVERAGE_MERGED_BIGWIG
}
process
coverage_with_postgenome
{
tag
"$file_id"
publishDir
"${params.output}/07_coverage/"
,
mode:
'copy'
input:
set
file_id
,
file
(
bam
)
from
HISAT_ALIGNED_COV_2
set
file_id
,
val
(
genome
),
val
(
postgenome
),
val
(
factor
),
file
(
genome_bam
),
file
(
post_genome_bam
)
from
COVERAGE_MERGED_BIGWIG
output:
file
"*.bigwig"
into
COVERAGE_OUTPUT_2
file
"*.bigwig"
into
COVERAGE_OUTPUT
file
"*.txt"
into
COVERAGE_LOG
shell:
'''
total=$((!{genome} + !{postgenome}))
echo "genome aligment : !{genome} counts" >> !{file_id}.txt
echo "postgenome aligment : !{postgenome} counts" >> !{file_id}.txt
echo "total counts : $total" >> !{file_id}.txt
echo "scaling factor : !{factor}" >> !{file_id}.txt
if [ !{genome} -gt 0 ]
then
bamCoverage -p !{task.cpus} --binSize 1 --scaleFactor !{factor} -b !{genome_bam[0]} -o !{file_id}_genome.bigwig
fi
if [ !{postgenome} -gt 0 ]
then
bamCoverage -p !{task.cpus} --binSize 1 --scaleFactor !{factor} -b !{post_genome_bam[0]} -o !{file_id}_postgenome.bigwig
fi
'''
}
}
else
{
HISAT_ALIGNED_COV
.
into
{
COVERAGE_MERGED_VALUES
;
COVERAGE_MERGED_BAM
}
process
calc_scalingFactor
{
tag
"$file_id"
input:
set
file_id
,
file
(
genome
)
from
COVERAGE_MERGED_VALUES
output:
set
file_id
,
env
(
genome
),
env
(
factor
)
into
COVERAGE_MERGED_FACTOR
when:
params
.
do_postgenome
==
false
shell:
'''
genome=$(samtools view !{
bam
[0]} | awk '{print $1} | sort | uniq | wc -l)
genome=$(samtools view !{
genome
[0]} | awk '{print $1}
'
| sort | uniq | wc -l)
factor=$(awk -v c=$genome 'BEGIN {print 1000000/c}')
bamCoverage -p !{task.cpus} --binSize 1 -b !{bam[0]} -o !{file_id}.bigwig
'''
}
COVERAGE_MERGED_FACTOR
.
join
(
COVERAGE_MERGED_BAM
)
.
set
{
COVERAGE_MERGED_BIGWIG
}
process
coverage
{
tag
"$file_id"
publishDir
"${params.output}/07_coverage/"
,
mode:
'copy'
input:
set
file_id
,
val
(
genome
),
val
(
factor
),
file
(
genome_bam
)
from
COVERAGE_MERGED_BIGWIG
output:
file
"*.bigwig"
into
COVERAGE_OUTPUT
file
"*.txt"
into
COVERAGE_LOG
shell:
'''
echo "genome aligment : !{genome} counts" >> !{file_id}.txt
echo "scaling factor : !{factor}" >> !{file_id}.txt
if [ !{genome} -gt 0 ]
then
bamCoverage -p !{task.cpus} --binSize 1 --scaleFactor !{factor} -b !{genome_bam[0]} -o !{file_id}_genome.bigwig
fi
'''
}
}
/////////////
/* MultiQC */
...
...
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