> class(bam)[1]
[1] "BamDataFile"
> getPathname(bam)
[1] NA
> print(bam)
Error in Rsamtools::BamFile(pathname, index = character(0L)) :
'file' must be character(1) and not NA
> traceback()
16: stop("'file' must be character(1) and not NA")
15: Rsamtools::BamFile(pathname, index = character(0L))
14: readHeader.BamDataFile(this, ...)
13: readHeader(this, ...)
12: getHeader.BamDataFile(this, ...)
11: getHeader(this, ...)
10: getPrograms.BamDataFile(this, ...)
9: getPrograms(this, ...)
8: getProgramString.BamDataFile(this)
7: getProgramString(this)
6: sprintf("Generated by: %s", getProgramString(this))
5: as.character.BamDataFile(x)
4: as.character(x)
3: print(as.character(x))
2: print.Object(x)
1: print(x)
This boils down to:
> getHeader(bam)
Error in Rsamtools::BamFile(pathname, index = character(0L)) :
'file' must be character(1) and not NA
> readHeader(bam)
Error in Rsamtools::BamFile(pathname, index = character(0L)) :
'file' must be character(1) and not NA
As a start, readHeader() should not try to read a non-existing file. At least it should throw an error that the file does not exist, e.g.
> Arguments$getReadablePathname(getPathname(bam))
[2015-05-28 17:31:27] Exception: No such file/directory because argument 'file' is NA.
This boils down to:
As a start,
readHeader()
should not try to read a non-existing file. At least it should throw an error that the file does not exist, e.g.