From b11ab87b516219f23a9ca6a79750da18ab458bf7 Mon Sep 17 00:00:00 2001
From: burri0000 <dominik.burri@unibas.ch>
Date: Fri, 24 Jan 2020 12:13:10 +0100
Subject: [PATCH] test STAR and ALFA with chr21.bam

---
 snakemake/Snakefile | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/snakemake/Snakefile b/snakemake/Snakefile
index 84f043b..e9eee45 100644
--- a/snakemake/Snakefile
+++ b/snakemake/Snakefile
@@ -204,16 +204,52 @@ rule run_alfa_bg_stranded:
 			-o {output}
 		"""
 
+rule star_rpm_unstranded:
+	''' Create unstranded bedgraph coverage with STARs RPM normalisation '''
+	input: 
+		bam = "/scicore/home/zavolan/burri0000/test_alfa/sample/chr21.bam"
+	output:
+		"/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/STAR_Signal.UniqueMultiple.str1.out.bg"
+	params:
+		out_dir = "/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/",
+		filenameprefix = "/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/STAR_"
+	singularity:
+		"docker://zavolab/star:2.6.0a"
+	threads: 4
+	log: "logs/star_rpm.log"
+	shell:
+		"""
+		(mkdir -p {params.out_dir}; \
+		chmod -R 777 {params.out_dir}; \
+		STAR \
+		--runMode inputAlignmentsFromBAM \
+		--runThreadN {threads} \
+		--inputBAMfile {input.bam} \
+		--outWigType "bedGraph" \
+		--outWigStrand "Unstranded" \
+		--outWigNorm "RPM" \
+		--outFileNamePrefix {params.filenameprefix}) &> {log}
+		"""
+
 rule run_alfa_bg_unstranded:
 	''' Run ALFA from unstranded bedgraph files '''
 	input:
-		"/scicore/home/zavolan/burri0000/test_alfa/sample/star_rpm/STAR_Signal.UniqueMultiple.str1.out.bg",
-		"/scicore/home/zavolan/burri0000/test_alfa/sample/star_rpm/STAR_Signal.UniqueMultiple.str2.out.bg"
+		"/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/STAR_Signal.UniqueMultiple.str1.out.bg"
 	output:
+		"/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/ALFA_plots.Biotypes.pdf",
+		"/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/star_rpm/ALFA_plots.Categories.pdf"
 	params:
-		genome_index = "sorted_genes"
+		out_dir = "star_rpm",
+		in_file = "STAR_Signal.UniqueMultiple.str1.out.bg",
+		genome_index = "/scicore/home/zavolan/burri0000/rnaseqpipeline/snakemake/alfa_index/sorted_genes",
+		name = "test_chr21"
+	singularity: 
+		"docker://zavolab/alfa:1.1.1"
+	log: "../logs/alfa_bg_unstranded.log"
 	shell:
 		""" 
+		cd {params.out_dir}; \
 		alfa -g {params.genome_index} \
-			-bedgraph {input} \
+			--bedgraph {params.in_file} {params.name} \
+			&> {log}
 		"""
\ No newline at end of file
-- 
GitLab