Out Of Disk Space With Picard Tools ?
2
8
Entering edit mode
9.1 years ago
Gabriel R. ★ 2.8k

Hi, I am trying to run the following command:

java -Xmx2g -jar SortSam.jar SORT_ORDER=coordinate INPUT=input.bam OUTPUT=output.sort

But I keep getting: Exception in thread "main" net.sf.samtools.util.RuntimeIOException: java.io.IOException: No space left on device Despite the fact that I have ample space to write.

Has anyone had similar trouble ?

picard tool • 21k views
5
Entering edit mode

perhaps it is using the temporary directory that is located on a different, smaller partition,

34
Entering edit mode
9.1 years ago
John St. John ★ 1.2k

That sounds like an issue with your system's TMP directory filling up. Why not make a folder called tmp in your current directory (mkdir tmp) where you are doing your work and then run picard like this:

java -Xmx2g -Djava.io.tmpdir=pwd/tmp -jar SortSam.jar SORT_ORDER=coordinate INPUT=input.bam OUTPUT=output.sort TMP_DIR=pwd/tmp


It is possible that this part:

TMP_DIR=pwd/tmp


would be sufficient, but setting -Djava.io.tmpdir=bla should work for java programs in general.

0
Entering edit mode

Worked ! Many thanks !

0
Entering edit mode

Thanks.. worked for me as well.

0
Entering edit mode

that solved the no-space issue, but now I am getting this: Exception in thread "main" net.sf.samtools.util.RuntimeIOException: java.io.FileNotFoundException: /Picard/picard-tools-1.72/pwd/tmp/sortingcollection.4875296484959495534.tmp (Too many open files) Anyone had similar issue?

1
Entering edit mode

Add the parameter named MAX_FILE_HANDLES_FOR_READ_ENDS_MAP, I set it to 1000 and it helped :-) with the explanation here

0
Entering edit mode

You have to go to /etc/security/limits.conf and put it like this:

#<domain>      <type>  <item>         <value>
#
*               hard    nofile            65536
*               soft    nofile            65536


then you can have 65536 open files at the same time with your user. You will need root rights.

0
Entering edit mode

Didn't work for me. I run picard via GATK 4.0.11.

I made a tmp folder in my GATK directory and used the command:

./gatk SortSam -I=/home/xxxxx/Desktop/folder/input.sam -O=/home/xxxxx/Desktop/folder/sortedsample.bam -SO=coordinate TMP_DIR=pwd/tmp


Got the error:

Invalid argument 'TMP_DIR=tmp'.

0
Entering edit mode

TMP_DIR is not a part of the command, it's an environmental variable

0
Entering edit mode

gatk has its own rules for the parameter names, the picard variables are passed with same name but you need to add -- before the parameter name. Although its is not mentioned in their help/usage text you can use '--TMP_DIR /some/path' to set the tmp directory manually...

1
Entering edit mode
2.4 years ago

The problem is, as others said with a probable low space in the default temporary directory. I changed my directory to a custom one. Worked perfectly for me using this code:

./gatk --java-options "-Djava.io.tmpdir=/custom file path" SortSam -I=samplealn.sam -O=sortedsamplealn.bam -SO=coordinate --TMP_DIR=/custom file path