Hi.
Ive been trying to run feaureCounts on my bam files, however I keep getting this error:
ERROR: temporary directory is not writable: '/mnt/data/GROUP-sbiim1/c1818206/fastqs/merged_files/trimmedfiles/trimmedfiles_final/star/sortedbycoord/featurecounts//mnt/data/GROUP-sbiim1/c1818206/fastqs/merged_files/trimmedfiles/trimmedfiles_final/star/sortedbycoord'
Which is odd because I've been working with trimmomatic, star, and picard and I haven't had any issue like this. My script is as follows:
#!/bin/bash
#SBATCH --partition=defq # the requested queue
#SBATCH --nodes=1 # number of nodes to use
#SBATCH --tasks-per-node=1 #
#SBATCH --cpus-per-task=2 #
#SBATCH --mem-per-cpu=10G # in megabytes, unless unit explicitly stated
#SBATCH --time=3:0:0
#SBATCH --error=%J.err # redirect stderr to this file
#SBATCH --output=%J.out # redirect stdout to this file
#SBATCH --mail-type=BEGIN,END,FAIL # email on job start, end, and/or failure
#Load module
module load subread-2.0.0-gcc-8.3.1-l7x34bp
#Shortcuts
workingdir=/mnt/data/GROUP-sbiim1/c1818206/fastqs/merged_files/trimmedfiles/trimmedfiles_final/star/sortedbycoord
refdir=/mnt/scratch/c1818206/fastqs/merged_files/trimmedfiles/trimmedfiles_final/genomeDir
#Make storage directory
mkdir $workingdir/featurecounts
#Loop and run featue counts command
LIST=$workingdir/*Aligned.sortedByCoord.out.bam
for i in $LIST;
do
featureCounts -T 4 -s 0 \
-a $refdir/Mus_musculus.GRCm39.104.gtf \
-o $workingdir/featurecounts/$i.featurecount \
$workingdir/$i
done
Any help would be much appreciated.
main issue is likely not having write permission in that specific directory (I know :) ). Can you post the permission status of that folder? Did you script create that featurecount directory in it?
moreover, in your loop you are writing/reading from a dir that I think is not what you expect. Can you add an
echo $i
in your loop? At first sight $i will also include the directory name again, so likely something will go awol there.Noob question but how would I check the permission status in linux? Yes, it did create the featurecounts directory (nothing in it though).
I've added the echo (see below)
And I got this in my out log file:
Figured it out lol. Permission status is as follows:
Hi all,
I got a similar error: ERROR: temporary directory is not writable: 'Users/Chris/Bash_script/quants'.
My code:
Would anyone please tell me how to fix it? Thank you so much!
You are most likely missing a leading
/
in front of all file paths.needs to be
Thank GenoMax for your suggestion!
I tried to add / like this:
featureCounts -s 2 -a /Users/Chris/Bash_script/hg38/Homo_sapiens.GRCh38.106.gtf -o /Users/Chris/Bash_script/quants/demo_featurecounts.txt /Users/Chris/Bash_script/HISAT2/demo_trimmed.bam
Then I got a different error:
Failed to open the annotation file /Users/Chris/Bash_script/hg38/Homo_sapiens.GRCh38.106.gtf, or its format is incorrect, or it contains no 'exon' features.
Looks like
/Users/Chris/Bash_script/hg38/Homo_sapiens.GRCh38.106.gtf
file path is not correct. Make sure you provide correct path for all files. I assume you have simply downloaded Ensembl GTF file and have not made any changes, so "exon" part is not applicable.You are right. For some reasons, the correct path is:
/Users/Chris/Bash_script/hg38/Homo_sapiens.GRCh38.107.gtf