User:Lindenb/Notebook/UMR915/20100614

=converting, indexing, sorting BAM= gunzip -c bwa_xxxx.sam.gz | samtools view -b -t /GENOTYPAGE/data/pubdb/ucsc/hg18/chromosomes/hg18.fa.fai - > jeter.bam samtools sort jeter.bam jeter.sorted.bam ## hum should NOT use jeter.sorted.bam but jeter.sorted because '.bam' was added at the end cp jeter.sorted.bam.bam jeter2.sorted.bam.bam #just for testing 'merge' samtools merge merged.bam jeter.sorted.bam.bam jeter2.sorted.bam.bam ls -lah merged.bam jeter.sorted.bam.bam jeter2.sorted.bam.bam -rw-r--r-- 1 lindenb users 4,2G jun 14 10:48 jeter2.sorted.bam.bam -rw-r--r-- 1 lindenb users 4,2G jun 14 10:42 jeter.sorted.bam.bam -rw-r--r-- 1 lindenb users 4,8G jun 14 11:10 merged.bam

uh ??? size merged not the same...

samtools index merged.bam samtools view merged.bam chrXX | grep XX | head -n 2 ILXXXXX1	99	chrXX	1440634	23	54M	=	14430863	283	XXXX	IGGDIBII>IIIIDIIIIIFIEEGIIGIIIIIGEG>I?DFIDDEIAICFDI@B>	XT:A:U	NM:i:0	SM:i:23	AM:i:0	X0:i:1	X1:i:1	XM:i:0	XO:i:0	XG:i:0	MD:Z:54	XA:Z:chr14,-18862314,54M,1; ILXXXXX2	99	chrXX	1440634	23	54M	=	14430863	283	XXXX	IGGDIBII>IIIIDIIIIIFIEEGIIGIIIIIGEG>I?DFIDDEIAICFDI@B>	XT:A:U	NM:i:0	SM:i:23	AM:i:0	X0:i:1	X1:i:1	XM:i:0	XO:i:0	XG:i:0	MD:Z:54	XA:Z:chr14,-18862314,54M,1;

=script used was=

HG18=/GENOTYPAGE/data/pubdb/ucsc/hg18/chromosomes/hg18.fa for SAM in  bwa_*.sam.gz  do        echo ${SAM} BAM=`echo ${SAM}| sed 's/\.sam\.gz$/\.bam/'` SORTED=`echo ${SAM}| sed 's/\.sam\.gz$/\.sorted/'` gunzip -c ${SAM} | samtools view -b -t ${HG18}.fai - > ${BAM} samtools sort ${BAM} ${SORTED} samtools index ${SORTED}.bam done