How to get the output on multiple files into one file in sbatch script?
0
0
Entering edit mode
3.5 years ago
newbie ▴ 120

Hi,

I have 120 sorted.bam files. I would like to check the strandedness of each sample. Whether unstranded or stranded. All 120 sorted.bams are in this directory /data/bams

For that, I kept all the sample names in the samples.txt file. And I started using a shell sbatch script like below:

#!/bin/bash
#SBATCH --job-name=strandspecify_Job
#SBATCH --cpus-per-task=8
#SBATCH --mem-per-cpu=1G
#SBATCH --time=0:30:00
#SBATCH --qos=30min
#SBATCH --output=outputs/Inferstrand_%j_%a.out # Standard output
#SBATCH --error=outputs/Inferstrand_%j_%a.err # Standard error
#SBATCH --array=1-120%5

LBID=$(head -$SLURM_ARRAY_TASK_ID /data/samples.txt | tail -1)
Path=/data/bams

ml load RSeQC/2.6.4-goolf-1.7.20-Python-2.7.11-R-3.2.4
python infer_experiment.py -r gencode.v27.annotation.bed -i $Path/${LBID}.sorted.bam

All the Standard output files have information only about a Fraction of reads like below:

Fraction of reads failed to determine: 0.0658
Fraction of reads explained by "1++,1--,2+-,2-+": 0.4677
Fraction of reads explained by "1+-,1-+,2++,2--": 0.4665

But nowhere it is mentioned the output is from which samples? Is there a way to write all the outputs into one file with the sample name in it to know which output is from which sample?

RNA-Seq strand rseqc sbtach slurm • 2.2k views
ADD COMMENT
2
Entering edit mode

Why don't you add:

echo "Processing file ${LBID}"

Just before the call to infer_experiment.py?

ADD REPLY
0
Entering edit mode

Why not using a for loop to call each bam file? You could get the filename into a variable and you could echo first the filename than the output

ADD REPLY
0
Entering edit mode

Can you please show me how to do that?

ADD REPLY
1
Entering edit mode

add an echo before calling your python code:

ml load RSeQC/2.6.4-goolf-1.7.20-Python-2.7.11-R-3.2.4
echo ${LBID}.sorted.bam
python infer_experiment.py -r gencode.v27.annotation.bed -i $Path/${LBID}.sorted.bam
ADD REPLY
0
Entering edit mode

Thanks a lot...it looks fine now.

ADD REPLY

Login before adding your answer.

Traffic: 3173 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