annotate 2.4/src/Subset_targets.sh @ 18:1163c16cb3c0 draft

Uploaded
author plus91-technologies-pvt-ltd
date Mon, 02 Jun 2014 07:35:53 -0400
parents e3609c8714fb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
1 #!/bin/sh
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
2 #$ -V
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
3 #$ -cwd
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
4 #$ -q 1-day
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
5 #$ -m ae
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
6 #$ -M hart.steven@mayo.edu
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
7 #$ -l h_vmem=1G
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
8 #$ -l h_stack=10M
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
9 BAM=$1
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
10 TARGET_BED=$2
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
11 SAMPLE_NUMBER=$3
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
12
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
13 #cat $HEADER > out.${SAMPLE_NUMBER}.sam
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
14 samtools view -L $TARGET_BED $BAM|
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
15 perl -ane '
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
16 next if ($F[10]=~/#/);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
17 $minSize=1000;
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
18 if( $F[1] & 8 || $F[1] & 4 || $F[8] == 0 || abs($F[8]) > $minSize || $F[5] =~/S/){
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
19 $rName=join("","@",@F[0]);
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
20 print join ("\n",$rName,$F[9],"+",@F[10])."\n";
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
21 };
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
22 ' >> out.${SAMPLE_NUMBER}.fq
e3609c8714fb Uploaded
plus91-technologies-pvt-ltd
parents:
diff changeset
23 echo "Done with $BAM `date`"