18 #include "SamReferenceInfo.h"
21 : myReferenceContigs(),
36 int32_t referenceSequenceLength)
38 myReferenceHash.Add(referenceSequenceName,
39 myReferenceContigs.Length());
40 myReferenceContigs.Push(referenceSequenceName);
41 myReferenceLengths.Push(referenceSequenceLength);
48 if (referenceName ==
"*")
51 int id = myReferenceHash.Find(referenceName);
54 return myReferenceHash.Integer(
id);
62 id = myReferenceContigs.Length();
63 myReferenceContigs.Push(referenceName);
64 myReferenceLengths.Push(0);
65 myReferenceHash.Add(referenceName,
id);
74 String referenceNameString = referenceName;
84 if ((
id < 0) || (
id >= myReferenceContigs.Length()))
89 return myReferenceContigs[id];
96 return(myReferenceLengths.Length());
104 return(myReferenceContigs[index].c_str());
116 return(myReferenceLengths[index]);
125 myReferenceContigs.Clear();
126 myReferenceHash.Clear();
127 myReferenceLengths.Clear();
135 myReferenceContigs = newInfo.myReferenceContigs;
136 myReferenceHash = newInfo.myReferenceHash;
137 myReferenceLengths = newInfo.myReferenceLengths;
146 return((myReferenceContigs == rhs.myReferenceContigs) &&
147 (myReferenceLengths == rhs.myReferenceLengths));
Class for tracking the reference information mapping between the reference ids and the reference name...
void clear()
Reset this reference info.
int getReferenceID(const String &referenceName, bool addID=false)
Get the reference ID for the specified name, if addID is set to true, a reference id will be created ...
int32_t getNumEntries() const
Get the number of entries contained here.
SamReferenceInfo & operator=(const SamReferenceInfo &rhs)
Copy the reference information.
static const int NO_REF_ID
Constant for the value returned if a reference id does not exist for a queried reference name.
SamReferenceInfo()
Constructor.
const char * getReferenceName(int index) const
Return the reference name at the specified index, returning "" if the index is out of bounds.
const String & getReferenceLabel(int id) const
Get the reference name for the specified id, if the id is not found, return "*".
void add(const char *referenceSequenceName, int32_t referenceSequenceLength)
Add reference sequence name and reference sequence length.
~SamReferenceInfo()
Destructor.
int32_t getReferenceLength(int index) const
Return the reference length at the specified index, returning 0 if the index is out of bounds.