Ubuntu 14.04 by default has a limit of 1024 open files, controlled by the value of the ulimit variable, and the CreateIntervals function will fail at the samtools merge step if there are more than 1024 bam files to be merged. Adding a few lines of code can avoid this problem by auto-adjusting the ulimit variable for the current terminal session.
Line 133-135 of the dDocent script evaluate the number of individuals and create the NumInd variable; one way to deal with the limit on open files is to test for $NumInd > 1000 and reset the ulimit value if necessary:
Increase limit on number of open files if $NumInd > 1000 (default limit is 1024 on Ubuntu)
if [ "$NumInd" -gt 1000 ]; then
NewLimit=$(($NumInd + 100))
ulimit -n $NewLimit
fi
Ubuntu 14.04 by default has a limit of 1024 open files, controlled by the value of the ulimit variable, and the CreateIntervals function will fail at the samtools merge step if there are more than 1024 bam files to be merged. Adding a few lines of code can avoid this problem by auto-adjusting the ulimit variable for the current terminal session. Line 133-135 of the dDocent script evaluate the number of individuals and create the NumInd variable; one way to deal with the limit on open files is to test for $NumInd > 1000 and reset the ulimit value if necessary:
Increase limit on number of open files if $NumInd > 1000 (default limit is 1024 on Ubuntu)
if [ "$NumInd" -gt 1000 ]; then NewLimit=$(($NumInd + 100)) ulimit -n $NewLimit fi