Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding k-mer and q-mer counting. #269

Merged
merged 1 commit into from
Jun 23, 2014

Conversation

fnothaft
Copy link
Member

This adds functions for k-mer and q-mer counting, which is necessary for error correction. Additionally, this adds commands that support counting k/q-mers from the CLI.

q-mers are quality score weighted k-mers, and are described in http://genomebiology.com/2010/11/11/R116/abstract.

@AmplabJenkins
Copy link

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/ADAM-prb/391/

val q = w.map(_._2)

// reduce bases into string, reduce quality scores
(b.map(_.toString).reduce(_ + _), q.reduce(_ * _))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an underflow / floating-point issue here? Is there a reason you're not just doing this computation in log-space? (i.e. omit the toSuccessProbability call above, and then q.reduce(_ + _) here instead?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't an underflow issue when you're looking at short k-mers. If you have a 100-mer with all bases at Q20, your q weight for the q-mer is about 0.35.

Also, underflow isn't such an issue for q-mer counting. The goal is to get an expectation for the count of a k-mer, therefore q weights that underflow wouldn't have contributed much to the expectation anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, a 100-mer would be exceptionally long; current k-mer counting tools are pretty stoked about counting 20-mers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough -- okay, I'll merge as is.

@tdanford
Copy link
Contributor

See my question about log-scale computation, above (which might have some perf implications too, right?)

If you address that and make sure this is rebased off of master, I'd be willing to merge this.

@fnothaft
Copy link
Member Author

@tdanford see my comments inline, I don't think there's a good reason to move to log scale.

@tdanford
Copy link
Contributor

When you rebase, then, I will merge.

@Argument(required = true, metaVar = "KMER_LENGTH", usage = "Length of k-mers", index = 2)
var kmerLength: Int = 0
@Args4jOption(required = false, name = "-countQmers", usage = "Counts q-mers instead of k-mers.")
var qmersNotKmers: Boolean = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming this countQmers is more clear.

@tdanford
Copy link
Contributor

Okay, if you make the changes suggested by Matt and rebase off of master, then I will hit the 'merge' button :-D

@fnothaft
Copy link
Member Author

@massie @tdanford Fixed all comments, and rebased on top of master.

@AmplabJenkins
Copy link

All automated tests passed.
Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/ADAM-prb/15/

carlyeks added a commit that referenced this pull request Jun 23, 2014
Adding k-mer and q-mer counting.
@carlyeks carlyeks merged commit d2a990d into bigdatagenomics:master Jun 23, 2014
@carlyeks
Copy link
Member

Thanks, @fnothaft!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants