Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub
ePeak
Commits
24dd19c4
Commit
24dd19c4
authored
Mar 17, 2022
by
Rachel LEGENDRE
Browse files
add scaling factor from spike-in to bedcov before seacr
parent
0412afdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
workflow/rules/compute_scaling_factor.rules
0 → 100644
View file @
24dd19c4
#########################################################################
# ChIPflow: Standardize and reproducible ChIP-seq analysis from raw #
# data to differential analysis #
# Authors: Rachel Legendre, Maelle Daunesse #
# Copyright (c) 2019-2020 Institut Pasteur (Paris) and CNRS. #
# #
# This file is part of ChIPflow workflow. #
# #
# ChIPflow is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# ChIPflow is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details . #
# #
# You should have received a copy of the GNU General Public License #
# along with ChIPflow (LICENSE). #
# If not, see <https://www.gnu.org/licenses/>. #
#########################################################################
rule compute_scaling_factor:
input:
bam = compute_scaling_factor_input
output:
txt = temp(compute_scaling_factor_output)
run:
import pysam
samfile = pysam.AlignmentFile(input.bam, "rb")
nb_reads = samfile.mapped
try:
S = "{0:.2f}".format(10000 / (samfile.mapped))
except ZeroDivisionError:
S = 1
with open(output.txt, 'w') as file_fp:
file_fp.write(S)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment