From 43db32700360c2398ad1f32b7b4e8bdfcf9ad238 Mon Sep 17 00:00:00 2001 From: nate Date: Wed, 9 Oct 2019 15:08:06 -0700 Subject: [PATCH] Added work around for mixcr splitting clonotype tables. --- Snakefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Snakefile b/Snakefile index 9a4e968..8a7f551 100644 --- a/Snakefile +++ b/Snakefile @@ -20,7 +20,7 @@ for f in os.listdir( in_dir ): rule all: input: - expand( os.path.join( out_dir, "analyze/{sample}.clonotypes.{chain}.txt" ), out_dir=out_dir, sample=SAMPLES, chain=["TRA", "TRB"] ) + expand( os.path.join( out_dir, "clonotypes/{sample}.clonotypes.txt" ), out_dir=out_dir, sample=SAMPLES ) params: output_file = os.path.join( out_dir, "metadata.csv" ) shell: @@ -32,7 +32,8 @@ rule repertoire_assembly: os.path.join( out_dir, "cleaned/{sample}_R2.fastq.gz" ) output: os.path.join( out_dir, "analyze/{sample}.clonotypes.TRA.txt" ), - os.path.join( out_dir, "analyze/{sample}.clonotypes.TRB.txt" ) + os.path.join( out_dir, "analyze/{sample}.clonotypes.TRB.txt" ), + os.path.join( out_dir, "clonotypes/{sample}.clonotypes.txt" ) run: sample_folder = os.path.join( out_dir, "analyze", wildcards.sample ) # First build the command @@ -50,6 +51,10 @@ rule repertoire_assembly: ) subprocess.call( command, shell=True ) + clonotype_folder = os.path.join( out_dir, "clonotypes", "{}.clonotypes.txt".format( wildcards.sample ) ) + export_command = "mixcr exportClones -c TRA,TRB {}.clna {}".format( sample_folder, clonotype_folder ) + subprocess.call( export_command, shell=True ) + rule remove_contamination: input: expand( os.path.join( out_dir, "umi_collapsed/{sample}_{read}.fastq.gz" ), out_dir=out_dir, sample=SAMPLES, read=["R1", "R2"] )