@@ -222,7 +222,7 @@ class BamRecord {
222
222
void init ();
223
223
224
224
/* * Check if a read is empty (not initialized)
225
- * @value true if read was not initialized with any values
225
+ * @return true if read was not initialized with any values
226
226
*/
227
227
bool isEmpty () const { return !b; }
228
228
@@ -427,13 +427,24 @@ class BamRecord {
427
427
/* * Set the query name */
428
428
void SetQname (const std::string& n);
429
429
430
- // Set the quality scores
430
+ /* * Set the quality scores
431
+ * @param n String of quality scores or empty string
432
+ * @param offset Offset parameter for encoding (eg 33)
433
+ * @exception Throws an invalid_argument if n is non-empty
434
+ * and different length than sequence
435
+ */
431
436
void SetQualities (const std::string& n, int offset);
432
437
433
- /* * Set the sequence name */
438
+ /* * Set the sequence name
439
+ * @param seq Sequence in upper-case (ACTGN) letters.
440
+ */
434
441
void SetSequence (const std::string& seq);
435
442
436
- /* * Set the cigar field explicitly */
443
+ /* * Set the cigar field explicitly
444
+ * @param c Cigar operation to set
445
+ * @note Will not check if the cigar ops are consistent with
446
+ * the length of the sequence.
447
+ */
437
448
void SetCigar (const Cigar& c);
438
449
439
450
/* * Print a SAM-lite record for this alignment */
@@ -515,10 +526,7 @@ class BamRecord {
515
526
uint32_t * c = bam_get_cigar (b);
516
527
Cigar cig;
517
528
for (int k = b->core .n_cigar - 1 ; k >= 0 ; --k)
518
- // cig.add(CigarField(c[k]));
519
529
cig.add (CigarField (c[k]));
520
- // cig.push_back(CigarField(c[k]));
521
- // cig.add(CigarField("MIDSSHP=XB"[c[k]&BAM_CIGAR_MASK], bam_cigar_oplen(c[k])));
522
530
return cig;
523
531
}
524
532
@@ -527,14 +535,19 @@ class BamRecord {
527
535
*/
528
536
void ClearSeqQualAndTags ();
529
537
530
- /* * Get the sequence of this read as a string */
531
- /* inline */ std::string Sequence () const ;
538
+ /* * Retrieve the sequence of this read as a string (ACTGN) */
539
+ std::string Sequence () const ;
532
540
533
- /* * Return the mean phred score
541
+ /* * Return the mean quality score
534
542
*/
535
543
double MeanPhred () const ;
536
544
537
- /* * Do a smith waterman alignment
545
+ /* * Performa a Smith-Waterman alignment between two strings
546
+ * @param name Name of the query sequence to align
547
+ * @param seq Sequence (ACTGN) of the query string
548
+ * @param ref Sequence (ACTGN) of the reference string
549
+ * @param gr Location of the reference string. The alignment record after Smith-Waterman alignment
550
+ * will be relative to this location.
538
551
*/
539
552
BamRecord (const std::string& name, const std::string& seq, const std::string& ref, const GenomicRegion * gr);
540
553
@@ -651,20 +664,26 @@ class BamRecord {
651
664
std::string GetZTag (const std::string& tag) const ;
652
665
653
666
/* * Get a vector of type int from a Z tag delimited by "^"
667
+ * Smart-tags allow one to store vectors of strings, ints or doubles in the alignment tags, and
668
+ * do not require an additional data structure on top of bseq1_t.
654
669
* @param tag Name of the tag eg "AL"
655
670
* @return A vector of ints, retrieved from the x delimited Z tag
656
671
* @exception Throws an invalid_argument if cannot convert delimited field val to int
657
672
*/
658
673
std::vector<int > GetSmartIntTag (const std::string& tag) const ;
659
674
660
675
/* * Get a vector of type double from a Z tag delimited by "x"
676
+ * Smart-tags allow one to store vectors of string, ints or doubles in the alignment tags, and
677
+ * do not require an additional data structure on top of bseq1_t.
661
678
* @param tag Name of the tag eg "AL"
662
679
* @return A vector of double elems, retrieved from the "^" delimited Z tag
663
680
* @exception Throws an invalid_argument if cannot convert delimited field val to double
664
681
*/
665
682
std::vector<double > GetSmartDoubleTag (const std::string& tag) const ;
666
683
667
684
/* * Get a vector of strings from a Z tag delimited by "^"
685
+ * Smart-tags allow one to store vectors of strings, ints or doubles in the alignment tags, and
686
+ * do not require an additional data structure on top of bseq1_t.
668
687
* @param tag Name of the tag eg "CN"
669
688
* @return A vector of strngs, retrieved from the x delimited Z tag
670
689
*/
@@ -681,7 +700,6 @@ class BamRecord {
681
700
return bam_aux2i (p);
682
701
}
683
702
684
-
685
703
/* * Add a string (Z) tag
686
704
* @param tag Name of the tag. eg "XP"
687
705
* @param val Value for the tag
@@ -722,6 +740,9 @@ class BamRecord {
722
740
723
741
/* * Return a human readable chromosome name assuming chr is indexed
724
742
* from 0 (eg id 0 return "1")
743
+ * @note This is a quick convienence function, and is not robust to non-numbered
744
+ * chromosomes (eg chrX becomes 23). For accurate string representation of
745
+ * any chromosomes, use the full ChrName with BamHeader input.
725
746
*/
726
747
inline std::string ChrName () const {
727
748
std::stringstream ss;
@@ -732,9 +753,7 @@ class BamRecord {
732
753
}
733
754
734
755
/* * Retrieve the human readable chromosome name.
735
- *
736
- * Note that this requires that the header not be empty. If
737
- * it is empty, assumes this ia chr1 based reference
756
+ * @param h Dictionary for chr name lookup. If it is empty, assumes this is chr1 based reference.
738
757
* @exception Throws an out_of_range exception if chr id is not in dictionary
739
758
* @return Empty string if chr id < 0, otherwise chromosome name from dictionary.
740
759
*/
@@ -812,11 +831,11 @@ class BamRecord {
812
831
813
832
};
814
833
815
- typedef std::vector<BamRecord> BamRecordVector;
834
+ typedef std::vector<BamRecord> BamRecordVector; // /< Store a vector of alignment records
816
835
817
- typedef std::vector<BamRecordVector> BamRecordClusterVector;
836
+ typedef std::vector<BamRecordVector> BamRecordClusterVector; // /< Store a vector of alignment vectors
818
837
819
- /* * @brief Sort methods for reads
838
+ /* * @brief Sort methods for alignment records
820
839
*/
821
840
namespace BamRecordSort {
822
841
@@ -829,7 +848,7 @@ class BamRecord {
829
848
}
830
849
};
831
850
832
- /* * @brief Sort by read- mate position
851
+ /* * @brief Sort by mate position
833
852
*/
834
853
struct ByMatePosition
835
854
{
0 commit comments