This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to save the output of VARSCAN results in different vcf names?

Hi,

I'm trying Varscan2 for the first time. However, I'm wondering how can I save the outcome of Varscan in different output vcf files as per the name of BAM files.

#!/bin/bash

#SBATCH --clusters=Cluster           # Select which system(s) to use    
#SBATCH --partition=parti            # Partition (job queue)    
#SBATCH --job-name=SamVarscan_var    # Assign an short name to your job  
#SBATCH --cpus-per-task=1            # Cores per task (>1 if multithread tasks)   
#SBATCH --mem=50000                  # Real memory (RAM) required (MB)
#SBATCH --time=12:00:00              # Total run time limit (HH:MM:SS)
#SBATCH --output=SamVarscan.%N.%j.out     # STDOUT output file

fids="DNA1 DNA2 DNA3 DNA4"

#Directories
 DATADIR="/projects/foran/SDLab/DK/SumayyaDat/cfDNA/Work/BAM_file/latest_BAM"
 REF="/scratch/dk1187/Rdata/RefHu/btindx/GRCh38_chr.fa"
 VARSCAN="/home/dk1187/.conda/envs/VarScan2_env/bin/varscan"

 for fid in $fids
 do 
 time srun samtools mpileup -f $REF ${DATADIR}/${fid}_aln.sort.rmdup2.bam | $VARSCAN pileup2snp --output-vcf 1 --vcf-sample-list $fids ${DATADIR}/${fid}_varscan.vcf
 done;

I'm expecting that output will separately saved at DATADIR by the name DNA1_varscan.vcf , DNA2_varscan.vcf so on. But, the output data is stored at the SamVarscan.%N.%j.out file. How can I overcome this issue.

Thanks.

snv slurm output varscan

Why are you using srun from within an sbatch file? Just run samtools mpileup ... - unless you really need the time, in which case, add the time. Skip the srun, it doesn't make any sense.

1 answer

Sorry for asking such a silly question. By adding > this issue is resolved.

Log in to answer this question.