Commit 24dd19c4 authored by Rachel  LEGENDRE's avatar Rachel LEGENDRE
Browse files

add scaling factor from spike-in to bedcov before seacr

parent 0412afdc
#########################################################################
# 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment