jianhong / ATACseqQC

ATAC-seq Quality Control

Home Page:https://jianhong.github.io/ATACseqQC/articles/ATACseqQC.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

splitBam return a asBam error

jupollet opened this issue · comments

Hi,
I have a problem with just one bam file for splitBam step.
My script do splitBam step for each chromosome of each bamfiles in bamfile list.

bamfile <-  filenames <- Sys.glob(paths = "...")
                       
wd="..."

indexBam(bamfile)


outPath <- "splited"
dir.create(outPath)

txs <- transcripts(TxDb.Mmusculus.UCSC.mm10.knownGene)
genome=Mmusculus
seqlev <- c("chr1","chr10","chr11","chr12","chr13","chr14","chr15","chr16","chr17","chr18","chr19","chr2","chr3","chr4","chr5","chr6","chr7","chr8","chr9","chrX","chrY")
which <- as(seqinfo(Mmusculus)[seqlev], "GRanges")


possibleTag <- combn(LETTERS, 2)
possibleTag <- c(paste0(possibleTag[1, ], possibleTag[2, ]),
                 paste0(possibleTag[2, ], possibleTag[1, ]))

possibleTag=possibleTag[possibleTag!="PG"]


for (i in bamfile) {
  

bamTop100 <- scanBam(BamFile(i, yieldSize = 100),
                     param = ScanBamParam(tag=possibleTag))[[1]]$tag
tags <- names(bamTop100)[lengths(bamTop100)==100]


bamfile.labels <- gsub(".bam", "", basename(i))

outPathsample=paste(outPath,bamfile.labels,sep = "//")

dir.create(outPathsample)



readBam <- readBamFile(i, which=which, asMates=TRUE, bigFile=TRUE)


for (chr in seqlev){


chrdir=paste(outPathsample,chr,sep="//")
  
dir.create(chrdir)
print(chr)
objs <- splitBam(i, outPath= chrdir,tags =tags,txs=txs,index = i,seqlev=chr, genome=genome)

}
}

splitBam renvoie cette erreur pourtant le fichier bam de base n'est pas tronquée.

Error in value[[3L]](cond) : 
  'asBam' truncated input file at record 3933292
  SAM file: 'C:\Users\pollep02\AppData\Local\Temp\RtmpeU0Spu\file5dc8594e76c0.sam'

My file is too big to be send with the issue.
Thanks in advance.

Thank you for reporting this issue. I am writing the new export method to replace the export method in rtracklayer.
The issue should be fixed in next building.
Let me know if it still not work in development version 1.15.2 or in release version 1.14.2

Jianhong.

I have 1.14.1 version but i didn't find 1.14.2 and 1.15.2 . I only find 1.15.0 dev version but i can't install it.
Thanks

Hi,
since my first message, I have received more data to analyse and I have the same issue with the same conditions sample.
I have contributed in bioconda to be able to test the 1.14.4 version on cluster and I have the same issue only for this two sample.
The second sample is more small than the first, so i made you a link to download it : https://we.tl/t-0mSOK9JfLn
Thanks

Justine