Bam file from STAR
1
0
Entering edit mode
20 months ago
Chris ▴ 260

Hi bioinformaticians,

I run STAR with this command but I don't see the Bam file output, just a Sam file in the home directory. Would anyone please tell me why? Thank you so much!

STAR --runThreadN 8 \  
--runMode alignReads \  
--genomeDir /home/doan/hg38/hg38_index \  
--readFilesIn /home/doan/data/demo_trimmed.fastq \  
--outSAMtype BAM Unsorted

Update. The size of this sam file is 0.

STAR • 893 views
ADD COMMENT
2
Entering edit mode
20 months ago
Trivas ★ 1.7k

Is it in your working directory? I've always included the flag --outFileNamePrefix to control where the file is written.

ADD COMMENT
2
Entering edit mode

I would also suggest to add --outBAMcompression 5 so the BAM is actually compressed and not an uncompressed and big waste of disk space. It is worth going through the star manual to see what options it has. As nice as alignment performance is star feels a bit like a little child in the sense that you have to tell it every little detail towards things that should be standard. It does not compress BAM files automatically, it is unable to autodetect gzip-compressed fastq files so you have to tell it to use zcat explicitely. Things like that.

ADD REPLY
0
Entering edit mode

My working directory is also a home directory and I got 3 output files: Aligned.out.sam, Log.out, Log.progress.out. I added --outBAMcompression 5 but still 3 files. STAR is run from a script and then submit to a server.

ADD REPLY
1
Entering edit mode

Sounds odd. Are you missing a \ or something before that --outSAMtype BAM Unsorted line? Please share the exact script. This option is widely used and works if invoked properly.

ADD REPLY
0
Entering edit mode

I added STAR command to the end of this script which was written by a server manager.

#!/usr/bin/env bash

######################################################

#$ -cwd

#$ -e ./
#$ -o ./

#$ -S /bin/bash

#$ -N test

##  #$ -l mem_free=33G

##  #$ -l h_vmem=50G

##  #$ -pe smp 4

## #$ -m beas -M user@vcu.edu


######################################################

PROGRAM=

SLEEPTIME=20

START=$(date +%s)
NSTART=$(date +%s.%N)

echo "hostname: "
/bin/hostname

echo "id: "
/usr/bin/id

echo "memory usage: "
/usr/bin/free

echo Running on hosts $NHOSTS
echo NSLOTS is $NSLOTS
echo "Machines:"
cat $TMPDIR/machines
echo Time is $(date)
echo Directory is $(pwd)
echo Path is $PATH
echo Ld Library Path is $LD_LIBRARY_PATH

echo "ulimit: "
ulimit -a

echo "java version: "
java -version 2>&1
echo "javac version: "
javac -version 2>&1

sleep ${SLEEPTIME}

# $1 are all the parameters passed above

#STAR --runThreadN 8 \
#--runMode genomeGenerate \
#--genomeDir /home/doanc2/hg38/hg38_index \
#--genomeFastaFiles /home/doanc2/hg38/Homo_sapiens.GRCh38.dna_sm.primary_assembly.fa \
#--sjdbGTFfile /home/doanc2/hg38/Homo_sapiens.GRCh38.107.gtf \
#--sjdbOverhang 99

source /global/STAR-2.7.10a/enable_star.sh

STAR --runThreadN 8 \  
--runMode alignReads \  
--genomeDir /home/doanc2/hg38/hg38_index \  
--readFilesIn /home/doanc2/data/demo_trimmed.fastq \  
--outSAMtype BAM Unsorted \  
--outBAMcompression 5    

END=$(date +%s)
NEND=$(date +%s.%N)

let TOTAL="${END} - ${START}"
DIFF=$(echo "${NEND} - ${NSTART}" | bc)

echo "Script took ${TOTAL} seconds"  
echo "Script tool ${DIFF} Nanoseconds"
ADD REPLY

Login before adding your answer.

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