Giter Site home page Giter Site logo

Comments (2)

CiaranOMara avatar CiaranOMara commented on June 1, 2024

The functions you are requesting already exist. You can compose with functions from Julia's Base and Standard Library.

filepath = "data.bam"
reader = open(BAM.Reader, filepath, index=filepath * ".bai")

# get mapped and unmaped read numbers for every reference
mapped = Iterators.filter(BAM.ismapped, reader) |> collect
unmapped = Iterators.filter(!BAM.ismapped, reader) |> collect

# get all reference names
reader.refseqnames

# check if one reference name was in bam files
in("chr1", reader.refseqnames)

from xam.jl.

panxiaoguang avatar panxiaoguang commented on June 1, 2024

Thank you very much! But I still have some questions?
I readed the document of XAM on juliahub, I did't see any method about reader on API reference sectors, only have SAM API and BAM API.

another question is for calculating the mapped numbers, I noticed you you still use the method for BAM_record to calculate the read number ,maybe it will iterater all record(reads). I think it will use many times to do this work. In fact, the number of reads per reference has been calculated in advance and stored in the index file.
So, maybe we can use

idx = BAM.BAI("data.bam.bai")
map(x->x[3].n_mapped,idx.index.data)

But in this way, we can't know the corresponding reference, we can only use the order of reference_id to guess. If some refs have no read, an error will be reported.

from xam.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.