Question: No BAM option in readAligned from the ShortRead package
gravatar for jfgout
9 months ago by
jfgout10 wrote:

Hi everyone,


I'm trying to load a BAM file into R for further analysis with NucleR. Following the recommendations from the NucleR package documentation, I tried using the 'readAligned' function from package 'ShortRead' to read my BAM file. Only problem is, this function does not seem to be capable of reading BAM files.

If I try:

aln <- readAligned(".", "mini.bam", type="BAM")

I end up with this error:

Error: UserArgumentMismatch
  arugment 'type' had value 'BAM' allowable values: 'SolexaExport'
    'SolexaAlign' 'SolexaPrealign' 'SolexaRealign' 'SolexaResult'
    'MAQMap' 'MAQMapShort' 'MAQMapview' 'Bowtie' 'SOAP'


What surprises me, is that I see many example online of people using type="BAM" with this function. Including people positing about some other problems on this site (see for example:

It's almost as if I was using an old version of the function or something like that. However, I'm using version 1.36 of the 'ShortRead' package, which seems to be the most recent one (R version is 3.4.3, I'm on a Linux station). What I don't understand is that there is no mention of a "BAM" option in the documentation for ShortRead 1.36. So, what is this function that other people use with the type="BAM" option? I'm completely lost...

Note that I have the same problem with ShortRead v 1.32.1 and R 3.3.1

Thanks for your help!



ADD COMMENTlink modified 9 months ago by Dario Strbenac1.4k • written 9 months ago by jfgout10
gravatar for Dario Strbenac
9 months ago by
Dario Strbenac1.4k
Dario Strbenac1.4k wrote:

You should avoid using nucleR for your data analysis. The package depends on RangedData which has been "... has been discouraged in favour of GRanges or GRangesList objects since BioC 2.12, that is, since 2014.". Moreover, RangedData will be deprecated in April and probably removed entirely from IRanges in October. If the developers haven't found time in the past four years to make their package compatible with Bioconductor, then I doubt that nucleR will remain in Bioconductor for much longer, making it hard for journal readers to reproduce your results.

ADD COMMENTlink written 9 months ago by Dario Strbenac1.4k

Thank you for this information. Any recommendation on which package I should use to (easily) call nucleosome scores from aligned reads (bam files)?



ADD REPLYlink written 9 months ago by jfgout10

I don't have a recommendation.

ADD REPLYlink written 9 months ago by Dario Strbenac1.4k
gravatar for Mike Smith
9 months ago by
Mike Smith3.1k
EMBL Heidelberg / de.NBI
Mike Smith3.1k wrote:

The readAligned function for BAM files was deprecated quite a while ago.  You should take a look at the GenomicAlignments package - there's a vignette on reading BAM files at An Introduction to the GenomicAlignments Package

ADD COMMENTlink written 9 months ago by Mike Smith3.1k

Thanks a lot for your answer. The problem is that I need to get an object of class "AlignedRead" (or "RangedData" with a strand attribute) to feed to the functions from the nucleR package.

I'll try to find a way to convert the 'GAlignments' object returned by readGAlignments into AlignedRead or RangedData. Or maybe I'll just try to install an old version of ShortRead.

Thanks again for your help.

ADD REPLYlink written 9 months ago by jfgout10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 275 users visited in the last hour