Hello Everyone,

Till now I have been writing simple scripts to do my work. Now I want to
automate my task.
I have no idea about submitting array jobs
So here is the explanation of what I want to do and then you can help me
how to design the script.

In a directory I have these 4 fastq files

A-122-3.XX.lane_1_P1_I24.sacCer3.sequence.fastq

A-122-3.XX.lane_1_P2_I24.sacCer3.sequence.fastq

A-2-3.XX.lane_1_P1_I47.sacCer3.sequence.fastq

A-2-3.XX.lane_1_P2_I47.sacCer3.sequence.fastq

I made this script to align my fastq files with yeast genome and it worked
perfectly fine


#!/bin/bash

for f in *_P1*

do

LB="${f%%.*}";

SM="${f%%.*}";

PU="${f%%.lane_*}";

PU="${PU#*.}";

NUM="${f%%_P*}";

NUM="${NUM##*_}";

 ID="$LB-$PU-$NUM";

 PART1="${f%%_P*}";

PART2="${f##*_P1_}";

 qsub -l mf=30G -l num_proc=12 -cwd -V -j y -b y -N $LB
"/apps1/bwa/bwa-0.7.5a/bwa mem -t 12 -R
'@RG\tID:$ID\tPL:illumina\tPU:$PU\tLB:$LB\tSM:$SM' -v 1 -a -M
/cork/vgupta12/S.cerevisiae/indexes/bwa/sacCer3.fa "${PART1}_P1_${PART2}"
"${PART1}_P2_${PART2}" > ${LB}.sam"

 done


Now the result I have is 2 .sam files namely A-122-3.sam and A-2-3.sam


This is what I want to do in the same script

*Convert all the sam files into bam files. Here is the command for one sam
file*

*samtools view -bS test.sam | samtools sort - test*

*Then make index files for all bam files. Command for one index bam file is*

*samtools index test.bam ##output is test.bam.bai*


I have further downstream analysis , but as of now I would like to get my
above script plus the commands I just mentioned above(highlighted part)
into one script only.


Any help would be appreciated.


Thanks for all the help so far


Regards
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to