Making slices from BAM files

From HPCwiki
Revision as of 11:47, 7 March 2012 by Hjmegens (talk | contribs)
Jump to navigation Jump to search

create a variable with all your bamfile names

<source lang='bash'> BAMFILE=`ls $BAMDIR*.bam | sed 's/.\+\///' | sed 's/.bam//'` </source>

check that your variable contains valid information

<source lang='bash'> echo $BAMFILE </source>

make a slice for each bamfile

<source lang='bash'> for i in $BAMFILE;

   do echo $i; 
   samtools view -b /shared/Sus/BAM_files_hjm_newbuild10_2/$i.bam Ssc10_2_8:43212683-43981653 >$i.SSC8_43212683-43981653.bam ; 

done </source>