Closed cauliyang closed 6 months ago
sam::record::Cigar
wasn't actually meant to be user-constructed, but I can see it potentially being used as a non-allocating parser. The visiblity of sam::record::Cigar::new
is now increased to be public, e.g., Cigar::new(b"8M13N")
. This is added noodles 0.64.0 / noodles-bam 0.53.0.
The libs I use now:
As an aside, I recommend using the noodles meta-crate when adding it as a dependency, i.e.,
noodles = { version = "0.64.0", features = ["bam", "bgzf", "core", "csi", "fasta", "fastq", "sam"] }
Appreciate your great help! Yep, I agree with you. Usually, we do not construt Cigar but the feature is helpful in a testing environment. I will follow your suggestions to add the dependency. Have a good day!
@zaeleus thanks for all your work on this crate. What are the chances we can do the same and add noodles::sam::alignment::record_buf::Cigar
with signature
pub fn new(src: Vec<u8>) -> Self { ... }
And also expose a function
pub fn as_bytes(&self) -> &[u8] { ... }
To both ...::record_buf:::Cigar
and ...::record::Cigar
?
It would be useful generally, and specifically for someone like me who wants to extract the CIGAR string and update the MC
tag in BAM/SAM records.
If you'd take a PR I can submit one 😄
now the lib includes two kinds of
Cigar
Struct. but it seems like none of them can be constructed from bytes.This cigar
pub struct Cigar<'a>(&'a [u8]);
provides a new method but it is not a public function. https://github.com/zaeleus/noodles/blob/af84e95376b2b757951aca734f27e2f4c98c38bf/noodles-sam/src/record/cigar.rs#L10Could we export the
new
method orparse_cigar
? so that we can construct aCigar
from bytes like this :If needed. I can open a new pr.
The libs I use now:
Thanks for your great help!