Difference between revisions of "Usefull small commands scripts etc"

From mn/bio/cees-bioinf
Jump to: navigation, search
(Created page with "<div> ==== Quick command to index a bunch of bam files ==== <div><u><span style="font-size: 12px;">Use case:</span></u></div></div> *you have a set of bam files, some (or all)...")
 
 
Line 1: Line 1:
 
<div>
 
<div>
 
==== Quick command to index a bunch of bam files ====
 
==== Quick command to index a bunch of bam files ====
<div><u><span style="font-size: 12px;">Use case:</span></u></div></div>
+
<div><u><span style="font-size: 12px;">Use case:</span></u></div>
 
*you have a set of bam files, some (or all) of which are not yet indexed
 
*you have a set of bam files, some (or all) of which are not yet indexed
 
*you want to run 'samtools index' on those that are not yet indexed
 
*you want to run 'samtools index' on those that are not yet indexed
Line 7: Line 7:
 
<div><br/></div><div><u>Solution:</u> use the makefile I created for this: /projects/cees/scripts/makefiles/index_all_bams.mk</div><div><br/></div><div><u>Usage:</u></div><pre>cd path/to/folder/with/bam/files
 
<div><br/></div><div><u>Solution:</u> use the makefile I created for this: /projects/cees/scripts/makefiles/index_all_bams.mk</div><div><br/></div><div><u>Usage:</u></div><pre>cd path/to/folder/with/bam/files
 
module load samtools
 
module load samtools
make -f /projects/cees/scripts/makefiles/index_all_bams.mk</pre><div><span style="font-size: 12px;">To run this in parallel, add the '-j' flag and the number of threads to start:</span></div><pre>make -j 5 -f /projects/cees/scripts/makefiles/index_all_bams.mk</pre><div><u>Author:</u> Lex Nederbragt</div>
+
make -f /projects/cees/scripts/makefiles/index_all_bams.mk</pre><div><span style="font-size: 12px;">To run this in parallel, add the '-j' flag and the number of threads to start:</span></div><pre>make -j 5 -f /projects/cees/scripts/makefiles/index_all_bams.mk</pre><div><u>Output:</u></div>
 +
*For each .bam file, a corresponding .bam.bai file
 +
<div><u>Notes:</u><br/></div>
 +
*if any .bam file present in the folder already has a corresponding .bam.bai file, his bam file will not be indexed
 +
<div><u></u><br/></div><div><u>Author:</u> Lex Nederbragt</div>

Latest revision as of 09:57, 9 December 2014

Quick command to index a bunch of bam files

Use case:
  • you have a set of bam files, some (or all) of which are not yet indexed
  • you want to run 'samtools index' on those that are not yet indexed
  • (optional) you would like to run this in parallel

Solution: use the makefile I created for this: /projects/cees/scripts/makefiles/index_all_bams.mk

Usage:
cd path/to/folder/with/bam/files
module load samtools
make -f /projects/cees/scripts/makefiles/index_all_bams.mk
To run this in parallel, add the '-j' flag and the number of threads to start:
make -j 5 -f /projects/cees/scripts/makefiles/index_all_bams.mk
Output:
  • For each .bam file, a corresponding .bam.bai file
Notes:
  • if any .bam file present in the folder already has a corresponding .bam.bai file, his bam file will not be indexed

Author: Lex Nederbragt