Bioconductor GenomicFeatures and Intel Compilers

At work we run R on an HPC cluster, and have built it with the Intel compiler suite, Math Kernel library etc. to achieve best performance. Following through the great rnaseqGene tutorial workflow for RNA Seq differential expression analysis I hit a roadblock.

The GenomicFeatures package makes use of S4Vectors. In S4Vectors there's a method to produce an SVN format timestamp, used to mark the creation time of TranscriptDB objects by GenomicFeatures. When built with an intel compiler the code will just return -1, and you'll never successfully get the TranscriptDB you need.

Eventually found some notes on this. The return of -1 instead of a valid timestamp is due to the intel compiler not supporting the timezone functionality in the code:

https://support.bioconductor.org/p/54740/

Thinking about this, a simple workaround is to avoid the timezone code and return a UTC timestamp. This isn't frienly, but technically correct and will allow things to proceed. rather than -1.

The following change in str-utils.c of the S4Vectors package will do the trick and let you use TranscriptDB objects despite the Intel compiler:

static int get_svn_time(time_t t, char *out, size_t out_size)
{
	struct tm result;
	int utc_offset, n;

	static const char
	  *wday2str[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
	  *mon2str[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
			"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
	  *svn_format = "%d-%02d-%02d %02d:%02d:%02d %+03d00 (%s, %02d %s %d)";
#if defined(__INTEL_COMPILER)
	result = *gmtime(&t);
	utc_offset = 0;
#else /* defined(__INTEL_COMPILER) */
	//localtime_r() not available on Windows+MinGW
	//localtime_r(&t, &result);
	result = *localtime(&t);
#if defined(__APPLE__) || defined(__FreeBSD__)
	//'struct tm' has no member named 'tm_gmtoff' on Windows+MinGW
	utc_offset = result.tm_gmtoff / 3600;
#else /* defined(__APPLE__) || defined(__FreeBSD__) */
	tzset();
	//timezone is not portable (is a function, not a long, on OS X Tiger)
	utc_offset = - (timezone / 3600);
	if (result.tm_isdst > 0)
		utc_offset++;
#endif /* defined(__INTEL_COMPILER) */
...

Comments

Comments powered by Disqus