Usefull small commands scripts etc

From mn/bio/cees-bioinf
Jump to: navigation, search

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/

cd path/to/folder/with/bam/files
module load samtools
make -f /projects/cees/scripts/makefiles/
To run this in parallel, add the '-j' flag and the number of threads to start:
make -j 5 -f /projects/cees/scripts/makefiles/
  • For each .bam file, a corresponding .bam.bai file
  • 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