I did not find these notes to be particularly clear.  I knew that BamFile
allows both file and index to be specified separately.

In the following, ex1.bam is a symbolic link in current working folder, and
ex1.bam.bai is the physical index file.

> X = BamFile("ex1.bam", index="./ex1.bam.bai")
> X
class: BamFile
path: /Users/stvjc/ExternalSoft/Rpacks/Rsamtools/inst/extdata/ex1.bam
index:
/Users/stvjc/ExternalSoft/Rpacks/Rsamtools/inst/extdata/FO.../ex1.bam.bai
isOpen: FALSE
yieldSize: NA
> open(X)
Error in open.BamFile(X) : failed to load BAM index
  file:
/Users/stvjc/ExternalSoft/Rpacks/Rsamtools/inst/extdata/FOO/ex1.bam.bai
In addition: Warning message:
In open.BamFile(X) : [bam_index_load] fail to load BAM index.

I suppose the "dereferencing" refers to the fact that FO... is not present
in the path report on X

I was surprised that the error was thrown.

> sessionInfo()
R Under development (unstable) (2012-10-07 r60889)
Platform: x86_64-apple-darwin10.8.0/x86_64 (64-bit)

locale:
[1]
en_US.US-ASCII/en_US.US-ASCII/en_US.US-ASCII/C/en_US.US-ASCII/en_US.US-ASCII

attached base packages:
[1] stats     graphics  grDevices datasets  utils     tools     methods
[8] base

other attached packages:
[1] Rsamtools_1.10.1     Biostrings_2.26.1    GenomicRanges_1.10.1
[4] IRanges_1.16.2       BiocGenerics_0.4.0   BiocInstaller_1.8.2
[7] weaver_1.24.0        codetools_0.2-8      digest_0.5.2

loaded via a namespace (and not attached):
[1] bitops_1.0-4.1  parallel_2.16.0 stats4_2.16.0   zlibbioc_1.4.0


On Tue, Oct 16, 2012 at 11:00 AM, Cook, Malcolm <MEC@stowers.org> wrote:

> +1
>
> I too have noticed this.  Further, consistently with this, if you use the
> Rsamtools package to create the indices to symlinks pointing to bamfiles,
> the indices are created in the target directory.
>
> I think if there is a code change to address this issue by allowing
> control over whether links are dereferenced, the DEFAULT should be NOT to
> dereference like this.
>
> --Malcolm Cook
>
>
> On 10/15/12 9:24 PM, "Lucas Swanson" <lswanson@bcgsc.ca> wrote:
>
> >Hello,
> >
> >I am attempting to use your Rsamtools Bioconductor package.
> >Unfortunately, I am having a bit of trouble. You see, my BAM files are in
> >a directory to which I do not have write access, and are too large for me
> >to copy to my own directory. So I created symbolic links in my own
> >directory, pointing to the BAM files, and then indexed them in my own
> >directory. However, when I try to use these symbolic links the Rsamtools
> >package dereferences the links, and looks for the indexes in the original
> >directory (to which I do not have write access), rather than in my own
> >directory.
> >
> >Is there any way to prevent Rsamtools from dereferencing symbolic links?
> >(That is, not replacing paths to symbolic links with paths to the target
> >of the link)
> >
> >~Thank you,
> >Lucas Swanson
> >
> >_______________________________________________
> >Bioconductor mailing list
> >Bioconductor@r-project.org
> >https://stat.ethz.ch/mailman/listinfo/bioconductor
> >Search the archives:
> >http://news.gmane.org/gmane.science.biology.informatics.conductor
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

