Making slices from BAM files: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
(Created page with "<source lang='bash'> BAMFILE=`ls *.bam | sed 's/.bam//'` </source>")
 
No edit summary
Line 1: Line 1:
== create a variable with all your bamfile names ==
<source lang='bash'>
<source lang='bash'>
BAMFILE=`ls *.bam | sed 's/.bam//'`
BAMFILE=`ls *.bam | 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>
</source>

Revision as of 11:43, 7 March 2012

create a variable with all your bamfile names

<source lang='bash'> BAMFILE=`ls *.bam | 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>