diff scripts/createBamFromResults.sh @ 9:695d28139f3e

toolshed8
author biomonika <biomonika@psu.edu>
date Tue, 09 Sep 2014 14:31:02 -0400
parents 1955f03f092e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/createBamFromResults.sh	Tue Sep 09 14:31:02 2014 -0400
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e;
+#example usage: ./createBamFromResults list_of_sequences bam_file outfile reference
+#creates small bam files containg only sex-linked genes and their corresponding reads
+
+list_of_sequences=$1;
+bam_file=$2;
+outfile=$3;
+reference=$4
+
+samtools view -h -o out.sam $bam_file;
+grep -f $list_of_sequences out.sam >igv;
+cat igv | sort -r >$outfile; 
+samtools view -bS $outfile | samtools sort - ${outfile%????};
+
+rm -f igv out.sam;
\ No newline at end of file