Friday, July 17, 2009

Quick bash script (check zero sized file) for reference

This is a quick bash script I wrote. Pasting it here for reference. It reads a bunch of ipar intensity files processes them with swift, and calibrates them with the swift calibrator. It checks if the file is zero sized (that's because I was updating a set of files some of which had failed). The:

   if [ ! -s /scratch/user/"$lane"_"$tile".fastq.pf.calibrated ]

That checks that a file /is/ zero sized. And only runs swift if it is.

sourcedir=/ADIRECTORY

for lane in {1..8}
do

for tile in {1..100}
do
if [ ! -s /scratch/user/"$lane"_"$tile".fastq.pf.calibrated ]
then
nice cp "$sourcedir"/s_"$lane"_*0"$tile"_int.txt.p.gz /scratch/user/input.gz
nice gzip -d /scratch/user/input.gz
nice ./ipar2gapipelineint /scratch/user/input "$sourcedir"/s_"$lane"_*0"$tile"_pos.txt /scratch/user/gaint
nice ./swift --purity_threshold 0.56 --intfile /scratch/user/gaint --ref ./phi.fa --optical_duplicates_distance 6 --optical_duplicates_mismatches 8 --fastq /scratch/user/"$lane"_"$tile".fastq --phasing_window 10 --phasing_iterations 3 --align_every 50
nice ./QualityCalibration/quality_remap --in /scratch/user/"$lane"_"$tile".fastq.pf --mapfile ./QualityCalibration/firecrest_1_3_2_fixedtable --out /scratch/nava/"$lane"_"$tile".fastq.pf.calibrated
rm /scratch/user/input
rm /scratch/user/gaint
rm /scratch/user/*.fastq.pf
rm /scratch/user/*.fastq.nonpf
fi
done
done

No comments: