annotate htsc_create_count_table.py @ 0:94a987a7da69 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
author bgruening
date Tue, 11 Oct 2022 16:09:23 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
1 #!/usr/bin/env python3
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
2
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
3 import argparse
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
4 import os
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
5 import subprocess
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
6
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
7 import pysam
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
8
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
9 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
10
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
11 Install deseq-clip
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
12 ==================
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
13
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
14 conda install -c bioconda pysam
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
15 conda install -c bioconda htseq
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
16 pip install htseq-clip
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
17
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
18 Or directly by:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
19 conda install -c bioconda htseq-clip
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
20
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
21
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
22 Test call
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
23 =========
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
24
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
25 python htsc_create_count_table.py --data-id Rbp --win-bed test-data/windows.exp.bed --out test_create_count_table_out --exp-bams test-data/Rbp_exp_rep1.Synechocystis_pSYSM.bam test-data/Rbp_exp_rep2.Synechocystis_pSYSM.bam --ctr-bams test-data/Rbp_ctrl_rep1.Synechocystis_pSYSM.bam --no-zipper
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
26
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
27 Compare:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
28 diff test-data/Rbp_count_matrix.exp.txt test_create_count_table_out/count_matrix.txt
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
29 diff test-data/sample_info.exp.txt test_create_count_table_out/sample_info.txt
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
30
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
31 This corresponds to:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
32 htseq-clip extract -i test-data/Rbp_exp_rep1.Synechocystis_pSYSM.bam -o test_create_count_table_out/Rbp_exp_rep1.Synechocystis_pSYSM.bed -e 1 -s m -g 0 -q 10 -c 4 -m 0 -x 500 -l 10000
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
33 htseq-clip extract -i test-data/Rbp_exp_rep2.Synechocystis_pSYSM.bam -o test_create_count_table_out/Rbp_exp_rep2.Synechocystis_pSYSM.bed -e 1 -s m -g 0 -q 10 -c 4 -m 0 -x 500 -l 10000
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
34 htseq-clip extract -i test-data/Rbp_ctrl_rep1.Synechocystis_pSYSM.bam -o test_create_count_table_out/Rbp_ctrl_rep1.Synechocystis_pSYSM.bed -e 1 -s m -g 0 -q 10 -c 4 -m 0 -x 500 -l 10000
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
35 htseq-clip count -i test_create_count_table_out/Rbp_exp_rep1.Synechocystis_pSYSM.bed -a test-data/windows.exp.bed -o test_create_count_table_out/counts_Rbp/Rbp_exp_rep1.Synechocystis_pSYSM.csv
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
36 htseq-clip count -i test_create_count_table_out/Rbp_exp_rep2.Synechocystis_pSYSM.bed -a test-data/windows.exp.bed -o test_create_count_table_out/counts_Rbp/Rbp_exp_rep2.Synechocystis_pSYSM.csv
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
37 htseq-clip count -i test_create_count_table_out/Rbp_ctrl_rep1.Synechocystis_pSYSM.bed -a test-data/windows.exp.bed -o test_create_count_table_out/counts_Rbp/Rbp_ctrl_rep1.Synechocystis_pSYSM.csv
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
38 htseq-clip createMatrix -i test_create_count_table_out/counts_Rbp -o test_create_count_table_out/Rbp_count_matrix.txt -b Rbp
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
39
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
40
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
41 To get BAM content for single chromosome:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
42 samtools view -b -h bam_all/Rbp3_uv_rep1.bam Synechocystis_pSYSM > test-data/Rbp_exp_rep1.Synechocystis_pSYSM.bam
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
43
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
44 More tests:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
45 python htsc_create_count_table.py --hce-f test-data/chr_names.txt --data-id Rbp --win-bed test-data/windows.exp.bed --out test_create_count_table_out --exp-bams test-data/Rbp_exp_rep1.Synechocystis_pSYSM.bam test-data/Rbp_exp_rep2.Synechocystis_pSYSM.bam --ctr-bams test-data/Rbp_ctrl_rep1.Synechocystis_pSYSM.bam --no-zipper
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
46
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
47 DEWSeq input files:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
48 test_create_count_table_out/Rbp_count_matrix.txt
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
49 test_create_count_table_out/sample_info.txt
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
50
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
51 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
52
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
53
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
54 ################################################################################
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
55
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
56 def setup_argument_parser():
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
57 """Setup argparse parser."""
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
58 help_description = """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
59 Use htseq-clip to extract crosslink sites from BAM files, and count
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
60 overlaps with window regions. Finally create an R count matrix, e.g. as
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
61 input for DEWSeq.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
62 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
63 # Define argument parser.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
64 p = argparse.ArgumentParser(add_help=False,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
65 prog="htsc_create_count_table.py",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
66 description=help_description,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
67 formatter_class=argparse.MetavarTypeHelpFormatter)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
68
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
69 # Required arguments.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
70 p.add_argument("-h", "--help",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
71 action="help",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
72 help="Print help message")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
73 p.add_argument("--win-bed",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
74 dest="in_win_bed",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
75 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
76 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
77 required=True,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
78 help="Sliding windows BED annotation file created with htseq-clip createSlidingWindows (also accepts .bed.gz)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
79 p.add_argument("--exp-bams",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
80 dest="exp_bam_list",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
81 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
82 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
83 nargs='+',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
84 required=True,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
85 help="List of IP BAM files (--exp-bams ip_rep1.bam ip_rep2.bam .. )")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
86 p.add_argument("--ctr-bams",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
87 dest="ctr_bam_list",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
88 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
89 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
90 nargs='+',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
91 required=True,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
92 help="List of control (SM input) BAM files (--ctr-bams smi_rep1.bam smi_rep2.bam .. )")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
93 p.add_argument("--out",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
94 dest="out_folder",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
95 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
96 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
97 required=True,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
98 help="Results output folder")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
99 # htseq-clip extract.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
100 p.add_argument("--hce-e",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
101 dest="hce_e",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
102 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
103 default=1,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
104 choices=[1, 2],
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
105 help="htseq-clip extract -e parameter. This selects read/mate to extract crosslink sites from (default: 1)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
106 p.add_argument("--hce-s",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
107 dest="hce_s",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
108 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
109 default="m",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
110 help="htseq-clip extract -s parameter. Choose crosslink site (s: start, m: middle, e: end ... ) (default: m)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
111 p.add_argument("--hce-g",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
112 dest="hce_g",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
113 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
114 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
115 default=0,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
116 help="htseq-clip extract -g parameter. Number of nucleotides to offset for crosslink sites (default: 0)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
117 p.add_argument("--hce-q",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
118 dest="hce_q",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
119 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
120 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
121 default=10,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
122 help="htseq-clip extract -q parameter. Minimum alignment quality for filtering (default: 10)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
123 p.add_argument("--hce-primary",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
124 dest="hce_primary",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
125 default=False,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
126 action="store_true",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
127 help="htseq-clip extract --primary parameter. Flag to use only primary positions of multimapping reads (default: False)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
128 p.add_argument("--hce-c",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
129 dest="hce_c",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
130 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
131 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
132 default=1,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
133 help="htseq-clip extract -c parameter. Number of threads/cores to use (default: 1)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
134 p.add_argument("--hce-m",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
135 dest="hce_m",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
136 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
137 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
138 default=0,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
139 help="htseq-clip extract -m parameter. Minimum read length for filtering (default: 0)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
140 p.add_argument("--hce-x",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
141 dest="hce_x",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
142 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
143 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
144 default=500,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
145 help="htseq-clip extract -x parameter. Maximum read length for filtering (default: 500)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
146 p.add_argument("--hce-l",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
147 dest="hce_l",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
148 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
149 metavar='int',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
150 default=10000,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
151 help="htseq-clip extract -l parameter. Maximum read interval length (default: 10000)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
152 p.add_argument("--hce-f",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
153 dest="hce_f",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
154 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
155 help="htseq-clip extract -f parameter. Extract crosslink sites only from chromosomes given in this file (one chromosome ID per line)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
156 # htseq-clip count.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
157 p.add_argument("--hcc-unstranded",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
158 dest="hcc_unstranded",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
159 default=False,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
160 action="store_true",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
161 help="htseq-clip count --unstranded parameter. Use this flag for non strand specific crosslink site counting (default: strand-specific counting)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
162 # More.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
163 p.add_argument("--data-id",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
164 dest="dataset_id",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
165 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
166 default="RBP",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
167 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
168 help="Dataset ID used as prefix for naming datasets (default: RBP)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
169 p.add_argument("--filter-bed",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
170 dest="filter_bed",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
171 type=str,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
172 metavar='str',
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
173 help="Provide BED file to filter out BAM reads overlapping with --filter-bed regions")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
174 p.add_argument("--filter-mode",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
175 dest="filter_mode",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
176 type=int,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
177 default=1,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
178 choices=[1, 2],
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
179 help="Filter mode for --filter-bed file. 1: keep BAM reads not overlapping with --filter-bed regions. 2: Keep only BAM reads overlapping with --filter-bed (default: 1)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
180 p.add_argument("--no-zipper",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
181 dest="no_zipper",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
182 default=False,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
183 action="store_true",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
184 help="Do not gzip output files (default: False)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
185 p.add_argument("--keep-imf",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
186 dest="keep_imf",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
187 default=False,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
188 action="store_true",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
189 help="Keep intermediate files (filtered BAM, BED, CSV) (default: False)")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
190 return p
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
191
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
192
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
193 ################################################################################
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
194
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
195 def file_make_symbolic_link(file, file_link,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
196 force_overwrite=True):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
197 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
198 Create a symbolic file link file_link (ln -s) of file.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
199
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
200 force_overwrite:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
201 Overwrites existing file link.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
202
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
203 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
204 assert os.path.exists(file), "file does not exist"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
205 # Get absolute path needed for symlink to work.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
206 file_abs_path = os.path.abspath(file)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
207
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
208 check_cmd = "ln -s "
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
209 if force_overwrite:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
210 check_cmd += "-f "
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
211 check_cmd = check_cmd + file_abs_path + " " + file_link
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
212 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
213 error = False
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
214 if output:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
215 error = True
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
216 assert error is False, "ln has problems with your input:\n%s\n%s" % (check_cmd, output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
217
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
218
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
219 ################################################################################
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
220
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
221 def bam_remove_overlap_region_reads(in_bed, in_bam, out_bam,
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
222 params="",
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
223 sort_bed=False):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
224
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
225 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
226 Remove BAM reads from in_bam, based on overlap with in_bed BED regions.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
227 I.e. only BAM reads not overlapping with in_bed regions are stored in
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
228 out_bam.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
229
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
230 Using intersectBed instead of samtools view -L, which allows -s for strand
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
231 specific filtering.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
232
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
233 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
234 assert os.path.exists(in_bed), "in_bed does not exist"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
235 assert os.path.exists(in_bam), "in_bam does not exist"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
236
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
237 if sort_bed:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
238 check_cmd = "sort -k1,1 -k2,2n " + in_bed + " | " + "intersectBed -abam " + in_bam + " -b stdin " + params + " -sorted > " + out_bam
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
239 else:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
240 check_cmd = "intersectBed -abam " + in_bam + " -b " + in_bed + " " + params + " > " + out_bam
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
241 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
242 error = False
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
243 if output:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
244 error = True
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
245 assert error is False, "intersectBed has problems with your input:\n%s\n%s" % (check_cmd, output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
246
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
247
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
248 ################################################################################
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
249
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
250 if __name__ == '__main__':
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
251
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
252 parser = setup_argument_parser()
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
253 args = parser.parse_args()
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
254
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
255 assert os.path.exists(args.in_win_bed), "--win-bed file \"%s\" not found" % (args.in_win_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
256
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
257 for bam_file in args.exp_bam_list:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
258 assert os.path.exists(bam_file), "--exp-bams BAM file \"%s\" not found" % (bam_file)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
259
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
260 for bam_file in args.ctr_bam_list:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
261 assert os.path.exists(bam_file), "--ctr-bams BAM file \"%s\" not found" % (bam_file)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
262
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
263 # assert len(args.exp_bam_list) > 1, "# --exp-bams needs to be > 1"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
264
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
265 if args.filter_bed:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
266 assert os.path.exists(args.filter_bed), "--filter-bed file \"%s\" not found" % (args.filter_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
267
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
268 hce_s_dic = {"s": 1, "i": 1, "d": 1, "m": 1, "e": 1}
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
269 assert args.hce_s in hce_s_dic, "invalid --hce-s given (choose between {s,i,d,m,e})"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
270
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
271 # Crop dataset ID.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
272 data_id = args.dataset_id
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
273 if len(args.dataset_id) > 20:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
274 data_id = args.dataset_id[:20]
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
275 # Remove spaces.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
276 data_id = data_id.replace(" ", "_")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
277
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
278 # Output folders.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
279 if not os.path.exists(args.out_folder):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
280 os.makedirs(args.out_folder)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
281 counts_folder = args.out_folder + "/counts_%s" % (data_id)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
282 if not os.path.exists(counts_folder):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
283 os.makedirs(counts_folder)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
284
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
285 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
286 Create BAM index files.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
287
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
288 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
289 print("# experiment BAMs: %i" % (len(args.exp_bam_list)))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
290 print("# control BAMs: %i" % (len(args.ctr_bam_list)))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
291
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
292 exp_bams = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
293 control_bams = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
294 exp_ids = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
295 control_ids = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
296 params = "-s -v"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
297 if args.filter_mode == 2:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
298 params = "-s -u"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
299 intermediate_files = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
300
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
301 print("Create BAM index files ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
302 for i, bam_file in enumerate(args.exp_bam_list):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
303
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
304 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
305
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
306 out_bam = args.out_folder + "/%s_exp_rep%i.bam" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
307
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
308 if args.filter_bed:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
309 print("Filter %s by --filter-bed ... " % (bam_file))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
310 bam_remove_overlap_region_reads(args.filter_bed, bam_file, out_bam, params=params)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
311 intermediate_files.append(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
312 else:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
313 # out_bam = bam_file
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
314 file_make_symbolic_link(bam_file, out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
315 # shutil.move(bam_file, out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
316
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
317 pysam.index(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
318 exp_bams.append(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
319 exp_ids.append("%s_exp_rep%i" % (data_id, idx))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
320
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
321 for i, bam_file in enumerate(args.ctr_bam_list):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
322
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
323 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
324
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
325 out_bam = args.out_folder + "/%s_ctrl_rep%i.bam" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
326
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
327 if args.filter_bed:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
328 print("Filter %s by --filter-bed ... " % (bam_file))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
329 bam_remove_overlap_region_reads(args.filter_bed, bam_file, out_bam, params=params)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
330 intermediate_files.append(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
331 else:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
332 # out_bam = bam_file
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
333 file_make_symbolic_link(bam_file, out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
334 # shutil.move(bam_file, out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
335
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
336 pysam.index(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
337 control_bams.append(out_bam)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
338 control_ids.append("%s_ctrl_rep%i" % (data_id, idx))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
339
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
340 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
341 htseq-clip extract crosslink sites.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
342
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
343 htseq-clip extract -i bam/Rbp3_total_rep1.bam -e 1 -s m -o sites/Rbp3_total_rep1.bed
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
344
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
345 hce_e : -e [1,2] %i
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
346 hce_s : -s %s
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
347 -s {s,i,d,m,e}, --site {s,i,d,m,e}
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
348 Crosslink site choices, must be one of: s, i, d, m, e
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
349 s: start site
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
350 i: insertion site
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
351 d: deletion site
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
352 m: middle site
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
353 e: end site (default: e).
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
354 hce_g : -g offset nt %i
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
355 hce_q : -q 10
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
356 hce_primary : --primary
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
357 hce_c : -c 4
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
358 hce_m : -m 0
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
359 hce_x : -x 500
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
360 hce_l : -l 10000
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
361 hce_f : -f chr_id file
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
362
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
363 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
364
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
365 print("Extract crosslink sites from BAM files ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
366
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
367 extract_params = " -e %i -s %s -g %i -q %i -c %i -m %i -x %i -l %i" % (args.hce_e, args.hce_s, args.hce_g, args.hce_q, args.hce_c, args.hce_m, args.hce_x, args.hce_l)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
368 if args.hce_primary:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
369 extract_params += " --primary "
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
370 if args.hce_f:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
371 assert os.path.exists(args.hce_f), "--hce-f file \"%s\" not found" % (args.hce_f)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
372 extract_params += " -f %s " % (args.hce_f)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
373
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
374 # Experiment BAMs.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
375 exp_beds = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
376 for i, bam_file in enumerate(exp_bams):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
377
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
378 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
379
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
380 out_bed = args.out_folder + "/%s_exp_rep%i.bed" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
381
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
382 check_cmd = "htseq-clip extract -i " + bam_file + " -o " + out_bed + extract_params
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
383 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
384
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
385 print(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
386 print(output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
387
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
388 assert os.path.exists(out_bed), "htseq-clip extract -o file \"%s\" not found" % (out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
389 exp_beds.append(out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
390 intermediate_files.append(out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
391
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
392 # Control BAMs.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
393 control_beds = []
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
394 for i, bam_file in enumerate(control_bams):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
395
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
396 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
397
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
398 out_bed = args.out_folder + "/%s_ctrl_rep%i.bed" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
399
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
400 check_cmd = "htseq-clip extract -i " + bam_file + " -o " + out_bed + extract_params
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
401 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
402
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
403 print(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
404 print(output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
405
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
406 assert os.path.exists(out_bed), "htseq-clip extract -o file \"%s\" not found" % (out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
407 control_beds.append(out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
408 intermediate_files.append(out_bed)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
409
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
410 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
411 Count crosslink sites in sliding windows.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
412
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
413 htseq-clip count -i sites/Rbp3_total_rep1.bed -a annotation/Rbp3_uv_total_w75s10.txt -o counts/Rbp3_total_rep1.csv
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
414
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
415 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
416
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
417 print("Count reads overlapping with windows ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
418
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
419 count_params = ""
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
420 if args.hcc_unstranded:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
421 count_params += " --unstranded"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
422 # Experiment BAMs.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
423 for i, bed_file in enumerate(exp_beds):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
424
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
425 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
426
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
427 out_csv = counts_folder + "/%s_exp_rep%i.csv.gz" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
428 if args.no_zipper:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
429 out_csv = counts_folder + "/%s_exp_rep%i.csv" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
430
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
431 check_cmd = "htseq-clip count -i " + bed_file + " -a " + args.in_win_bed + " -o " + out_csv + count_params
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
432 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
433
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
434 print(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
435 print(output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
436
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
437 assert os.path.exists(out_csv), "htseq-clip count -o file \"%s\" not found" % (out_csv)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
438 intermediate_files.append(out_csv)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
439
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
440 # Control BAMs.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
441 for i, bed_file in enumerate(control_beds):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
442
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
443 idx = i + 1
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
444
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
445 out_csv = counts_folder + "/%s_ctrl_rep%i.csv.gz" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
446 if args.no_zipper:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
447 out_csv = counts_folder + "/%s_ctrl_rep%i.csv" % (data_id, idx)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
448
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
449 check_cmd = "htseq-clip count -i " + bed_file + " -a " + args.in_win_bed + " -o " + out_csv + count_params
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
450 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
451
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
452 print(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
453 print(output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
454
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
455 assert os.path.exists(out_csv), "htseq-clip count -o file \"%s\" not found" % (out_csv)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
456 intermediate_files.append(out_csv)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
457
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
458 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
459 Create an R friendly matrix file.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
460
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
461 htseq-clip createMatrix -i counts/ -b Rbp3 -o counts/Rbp3_uv_total_w75s10_counts.txt.gz
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
462
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
463 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
464
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
465 print("Create R-friendly count matrix file ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
466
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
467 # out_matrix = args.out_folder + "/%s_count_matrix.txt.gz" %(data_id)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
468 out_matrix = args.out_folder + "/count_matrix.txt.gz"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
469 if args.no_zipper:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
470 # out_matrix = args.out_folder + "/%s_count_matrix.txt" %(data_id)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
471 out_matrix = args.out_folder + "/count_matrix.txt"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
472
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
473 check_cmd = "htseq-clip createMatrix -i " + counts_folder + " -b " + data_id + " -o " + out_matrix
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
474 output = subprocess.getoutput(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
475
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
476 print(check_cmd)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
477 print(output)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
478
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
479 assert os.path.exists(out_matrix), "htseq-clip createMatrix -o file \"%s\" not found" % (out_matrix)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
480
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
481 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
482 Create sample info file for DEWSeq.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
483
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
484 Sample Info file format:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
485 Sample name Sample type
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
486 Rbp3_uv_rep1 IP
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
487 Rbp3_uv_rep2 IP
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
488 Rbp3_uv_rep3 IP
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
489 Rbp3_total_rep1 SMI
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
490 Rbp3_total_rep2 SMI
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
491 Rbp3_total_rep3 SMI
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
492
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
493 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
494
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
495 print("Write sample info file ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
496 sample_info_file = args.out_folder + "/sample_info.txt"
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
497 OUTTAB = open(sample_info_file, "w")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
498 OUTTAB.write("Sample name\tSample type\n")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
499 for sid in exp_ids:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
500 OUTTAB.write("%s\tIP\n" % (sid))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
501 for sid in control_ids:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
502 OUTTAB.write("%s\tSMI\n" % (sid))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
503 OUTTAB.close()
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
504
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
505 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
506 Delete intermediate files.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
507
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
508 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
509 if not args.keep_imf:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
510 print("Delete intermediate files ... ")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
511 for imf in intermediate_files:
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
512 if os.path.exists(imf):
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
513 os.remove(imf)
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
514
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
515 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
516 Report.
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
517
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
518 """
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
519
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
520 print("")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
521 print("OUTPUT FILES")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
522 print("============")
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
523
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
524 print("Count matrix file (DEWSeq input file):\n%s" % (out_matrix))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
525 print("Sample info file (DEWSeq input file):\n%s" % (sample_info_file))
94a987a7da69 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/htseq-clip commit 4879439f0df3386b97d8507c5991051fbdda053a
bgruening
parents:
diff changeset
526 print("")