run picard on all bam files in directory
1
0
Entering edit mode
9.2 years ago
bioguy24 ▴ 230

I am trying to run a bash loop on all bam files in a directory and having a bit of trouble. The bash so far as well as the individual picard command is below. Thank you :).

Bash loop so far

for f in /home/cmccabe/Desktop/NGS/pool_I_090215/*.bam ; do
  bname=`basename $f`
  pref=${bname%%.bam}
  java \
    -jar /home/cmccabe/Desktop/NGS/picard-tools-1.139/picard.jar \
    CalculateHsMetrics \
    BI=/home/cmccabe/Desktop/NGS/bed/sam_sorted_unix_5column_xgen_probes.bed \
    TI=/home/cmccabe/Desktop/NGS/bed/sam_sorted_unix_5column_xgen_targets.bed \
    I=/$f \
    O=/home/cmccabe/Desktop/NGS/pool_I_090215/${pref}_all_IDT.CalculateHSmetrics
done

If the bam files were run individually here is the command

java \
  -jar /home/cmccabe/Desktop/NGS/picard-tools-1.139/picard.jar \
  CalculateHsMetrics \
  BI=/home/cmccabe/Desktop/NGS/bed/sam_sorted_unix_5column_xgen_probes.bed \
  TI=/home/cmccabe/Desktop/NGS/bed/sam_sorted_unix_5column_xgen_targets.bed \
  I=/home/cmccabe/Desktop/NGS/pool_II_090115/IonXpress_015_150901_newheader.bam \
  O=/home/cmccabe/Desktop/NGS/pool_II_090115/IonXpress_015_150901_all_IDT.CalculateHSmetrics
bam ngs picard • 3.3k views
ADD COMMENT
0
Entering edit mode

What is the problem? What is the question?

ADD REPLY
0
Entering edit mode

What error message are you getting?

ADD REPLY
0
Entering edit mode

Are you sharing this as a useful tip, bioguy24?

ADD REPLY
0
Entering edit mode
9.2 years ago
Dan D 7.4k

Some of the problems I see:

  • You're specifying parameters in an abbreviated fashion. TI should be TARGET_INTERVALS, for example.
  • The tool doesn't use BED format for the intervals files. It uses its own interval list format.
  • The output for each sample is being written to the same output file. That means you'll be overwriting it each time.

You should at minimum clearly state a question/problem and provide any error output that you obtain from the tool.

ADD COMMENT

Login before adding your answer.

Traffic: 1719 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6