I'm trying to download a dataset in the BAM Format from GEO/SRA, that I can use for analysis in RStudio.
I tried using this method: where i downloaded .sra and converted it to .bam
prefetch GSM269238
sam-dump C:\Users\Desktop\sratoolkit.2.10.8-win64\bin\ncbi\SRA\sra\GSM2692389.sra --output-file GSM2692389.bam
However, in RStudio this didn't work, and returned an error, saying it couldn't read the bam file This is my R Code; I'm using RSamTools
> bamfiles <- list.files("directory redacted due to privacy", ".bam")
> file.exists(bamfiles)
[1] TRUE
>
>
> #---> Define bam files for count step on Rsamtools
>
> library("Rsamtools")
> bamfiles <- BamFileList(bamfiles, yieldSize=2000000)
> seqinfo(bamfiles)
Error in value[[3L]](cond) :
failed to open BamFile: SAM/BAM header missing or empty
file: 'GSM2692389.bam'
Does anyone know how to help me download the SRA data into readable .bam files? Any help or guidance would be much appreciated as I'm really trying to meet a deadline with this.