Commit 2f357ca8 authored by Blaise Li's avatar Blaise Li
Browse files

Script to extract reads from bam from bed regions.

parent 56cfa04d
__copyright__ = "Copyright (C) 2020 Blaise Li"
__licence__ = "GNU GPLv3"
__version__ = 0.3
__version__ = 0.4
from .libhts import (
aligner2min_mapq,
gtf_2_genes_exon_lengths,
......
#!/usr/bin/env python3
# Copyright (C) 2020 Blaise Li
#
# This program 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.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
"""Extracts the fastq reads from a bam file
corresponding to the annotations provided in a bed file.
"""
from argparse import (
ArgumentParser,
ArgumentDefaultsHelpFormatter)
import sys
from libbamutils import BamFile
def main():
"""Run the command-line script."""
parser = ArgumentParser(
description=__doc__,
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument(
"-b", "--bedfile",
required=True,
help="Input bed file.")
parser.add_argument(
"-a", "--bamfile",
required=True,
help="Input bam file.")
args = parser.parse_args()
bamfile = BamFile(args.bamfile)
for fastq in bamfile.bed_to_fastq(args.bedfile):
print(fastq, end="")
return 0
if __name__ == "__main__":
sys.exit(main())
......@@ -34,9 +34,11 @@ setup(
packages=find_packages(),
scripts=[
"scripts/bam2bigwig.sh", "scripts/sam2indexedbam.sh",
"scripts/bed_bam2fq.py",
"scripts/copypaste_bigwig_regions.py",
"scripts/extract_annot_start.py"],
install_requires=[
"libbamutils @ git+https://gitlab.pasteur.fr/bli/libbamutils.git@66879fb7e917dfa00e13da230310bb3b257766db",
#"libworkflows @ git+https://gitlab+deploy-token-31:isEzpsgbNf2sJMdUDy2g@gitlab.pasteur.fr/bli/libworkflows.git@744dd79b579577cb6e131653260d7990946be3ad#egg=libworkflows-0.1",
#"libworkflows @ git+https://gitlab+deploy-token-31:isEzpsgbNf2sJMdUDy2g@gitlab.pasteur.fr/bli/libworkflows.git#egg=libworkflows-0.1",
#"libworkflows @ git+https://gitlab+deploy-token-31:isEzpsgbNf2sJMdUDy2g@gitlab.pasteur.fr/bli/libworkflows.git",
......
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