annotate scripts/createBamFromResults.sh @ 20:ea52ef8d7f3a
added perl dependency since galaxy A seems working and added samtools sort
| author |
biomonika <biomonika@psu.edu> |
| date |
Thu, 11 Sep 2014 19:17:11 -0400 |
| parents |
1955f03f092e |
| children |
|
| rev |
line source |
|
0
|
1 #!/bin/bash
|
|
|
2 set -e;
|
|
|
3 #example usage: ./createBamFromResults list_of_sequences bam_file outfile reference
|
|
|
4 #creates small bam files containg only sex-linked genes and their corresponding reads
|
|
|
5
|
|
|
6 list_of_sequences=$1;
|
|
|
7 bam_file=$2;
|
|
|
8 outfile=$3;
|
|
|
9 reference=$4
|
|
|
10
|
|
|
11 samtools view -h -o out.sam $bam_file;
|
|
|
12 grep -f $list_of_sequences out.sam >igv;
|
|
|
13 cat igv | sort -r >$outfile;
|
|
|
14 samtools view -bS $outfile | samtools sort - ${outfile%????};
|
|
|
15
|
|
|
16 rm -f igv out.sam; |