Code Monkey home page Code Monkey logo

Comments (4)

nh13 avatar nh13 commented on August 16, 2024

You could also stream the data into the various metrics collection tools. For example, something like samtools view -b <in.bam> <region> | java -jar CollectWgsMetrics.jar I=/dev/stdin .... This would allow you to select only the regions in which you are interested.

If you are up for it, we would be happy to take a look at a pull request for this tool.

from picard.

travc avatar travc commented on August 16, 2024

Fair enough. Streaming is a good approach, though I'm not sure if the reference will also need modifying to get sensible output. That is something I will play with when I get the time and try to adjust/fix if needed.
Thanks for the quick response.

from picard.

travc avatar travc commented on August 16, 2024

Sorry, I don't thin your suggestion (streaming from samtools view) will actually work.
The problem is the header and reference.

To get the proper GENOME_TERRITORY (and serveral other things I suspect), the reference needs to be modified to just include the region/chrom of interest. That isn't difficult (samtools faidx), but does remove the possibility of a single command without intermediate files.

However, a critical problem occurs when picard is looking for regions in the reference base upon the bam file. Samtools doesn't remove entries outside of the selected region from the bam header. I've tried modifying the bam header (removing all chroms but the one of interest), but just can't get it to work. CollectWgsMetrics keeps looking for entries which aren't in the sequence dictionary... I have no idea why, since everything but a single chromosome has been removed from the bam header and alignments as well as the reference.

Anyway, even if I could get this to work (I've put several hours of trying into it already), the complexity required makes it far from a viable option IMO.
It seems like it would be much simpler to just add functionality to the Collect*Metrics commands to enable selecting a region. I imagine that the readers (BAMFileReader and such) already have most of the required functionality, but I'm not familiar enough with the code (nor have the time) to do it myself.

from picard.

travc avatar travc commented on August 16, 2024

I've added the functionality needed (and fixed a minor bug).
Please see my existing pull request, which was originally for a different (very minor) issue.
#87
Specifically, see this diff.
travc@2b039dc

At least a couple of people on BioStars and elsewhere have asked for this functionality, so it would probably be good if it could be merged soon. The changes are rather simple.

from picard.

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.