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

added getCigar method to record #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wilsonGen
Copy link

added getCigar method to CramRecord,

for example :
record.getCigar() // "50S100M"

@cmdcolin
Copy link
Contributor

nice work! it may be worth adding some testing to make sure this matches samtools decoding. we have our own "read features to cigar string" in jbrowse that uses code created by @jkbonfield that has some corner case handling that i'm not sure actually come up in practice(?)

code here https://github.com/GMOD/jbrowse-components/blob/main/plugins/alignments/src/CramAdapter/util.ts#L132-L251

@wilsonGen
Copy link
Author

thank you for reviewing!
Sorry, actually this is the first time I create a pull request, how should I add the testing?

@cmdcolin
Copy link
Contributor

in the absense of 'synthesizing' read features from thin air, one way to test is to use samtools on a small test file (we have some test files in test/data/ folder) to create a list of CIGAR strings, and then run cram-js to generate CIGAR strings on the same file, and check that they match up

@cmdcolin
Copy link
Contributor

just wanted to check back to see if you were interested in adding tests for this?

@wilsonGen
Copy link
Author

Yes, I am interested, sorry for holding it so long.
Just want to ask, should I create a test script or should I just run it and compare the results myself?

@rbuels
Copy link
Contributor

rbuels commented Jun 30, 2023 via email

@wilsonGen
Copy link
Author

Thank you! I will try to add the test next week!

@wilsonGen
Copy link
Author

Just improved the getCigar() so that it handles hard clip as well,
also added automated test code for getCigar(), to make sure it matches the cigar from samtools.
Thank you all for reviewing my code and suggesting ways to ensure correct result, I have learnt a lot!

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.

3 participants