diff --git a/snakemake/prepare_annotation/dag.png b/snakemake/prepare_annotation/dag.png deleted file mode 100644 index 2bd5f04eaaf11d89e3c5bb55dd5bfd49f74cebea..0000000000000000000000000000000000000000 Binary files a/snakemake/prepare_annotation/dag.png and /dev/null differ diff --git a/snakemake/process_data/Snakefile b/snakemake/process_data/Snakefile index 1e96622c64a10de1e7116accfe555d4d525ca663..6805b3e3f2880b35375aa77601e414ffa08a1562 100644 --- a/snakemake/process_data/Snakefile +++ b/snakemake/process_data/Snakefile @@ -1,7 +1,7 @@ configfile: "config.yaml" #from snakemake.utils import listfiles -localrules: create_output_and_log_directories, remove_multimappers, read_length_histogram, finish +localrules: create_output_and_log_directories, remove_multimappers, read_length_histogram, count_reads, sfinish ################################################################################# ### Finish rule @@ -9,7 +9,8 @@ localrules: create_output_and_log_directories, remove_multimappers, read_length_ rule finish: input: - sam = expand(os.path.join(config["output_dir"], "{sample}/read_length/read_length_histogram.pdf"), sample=config["sample"]) + pdf = expand(os.path.join(config["output_dir"], "{sample}/read_length/read_length_histogram.pdf"), sample=config["sample"]), + counts = expand(os.path.join(config["output_dir"], "{sample}/counts.tsv"), sample=config["sample"]) ################################################################################# ### Create output and log directories @@ -246,3 +247,22 @@ rule read_length_histogram: "(python scripts/plot_read_lengths.py \ --sam {input.sam} \ --outdir {params.dir}) & > {log}" + +################################################################################ +### Count reads +################################################################################ + +rule count_reads: + input: + sam = os.path.join(config["output_dir"], "{sample}/transcripts.mapped.unique.sam"), + transcript_id_gene_id_CDS = config["transcript_id_gene_id_CDS"] + output: + counts = os.path.join(config["output_dir"], "{sample}/counts.tsv") + threads: 1 + singularity: + "docker://perl:5.24-slim" + shell: + "(perl scripts/xp-count-reads-ribseq.pl \ + {input.sam} \ + {input.transcript_id_gene_id_CDS} \ + > {output.counts})" diff --git a/snakemake/process_data/config.yaml b/snakemake/process_data/config.yaml index fb70bb03e05d73ba69ffcb1d0b554f2303782a17..c2b5488d5f1a79ada0e7b9d41ce32dca7571e0d5 100644 --- a/snakemake/process_data/config.yaml +++ b/snakemake/process_data/config.yaml @@ -6,6 +6,7 @@ other_RNAs_index: "../prepare_annotation/results/other_RNAs_sequence.idx" transcripts_sequence: "../prepare_annotation/results/longest_pc_transcript_per_gene.fa" transcripts_index: "../prepare_annotation/results/longest_pc_transcript_per_gene.idx" + transcript_id_gene_id_CDS: "../prepare_annotation/results/transcript_id_gene_id_CDS.tsv" ############################################################################## ### Output and log directory ##############################################################################