I only want to exact the sequence of chr1 not all.
using XAM
bamfile="..."
reader=open(BAM.Reader,bamfile)
for record in reader
println(BAM.refname(record))
end
This returns all the chromosomes.I just want chr1.But I dont know how to do.
I tried eachoverlap,but the function need start(1) and end(10000).
reader=open(BAM.Reader,bamfile,index=bamfile*".bai")
for record in eachoverlap(reader,"chr1",1:10000)
println(BAM.refname(record))
end
and i also tried
reader.refseqlens
25-element Vector{Int64}:
248956422
133797422
135086622
133275309
114364328
107043718
101991189
90338345
83257441
80373285
58617616
242193529
64444167
46709983
50818468
198295559
190214555
181538259
170805979
159345973
145138636
138394717
16569
156040895
57227415
for record in eachoverlap(reader,"chr1",1:248956422)
println(BAM.refname(record))
end
It can return all of the chr1. I can only make it using eachoverlap(slow?).Are there any ways to make it faster? Thanks very much.