I wanted to track more than +/- strand, I wanted to know if an annotation
was "unknown" or perhaps applied to both strands.
Sequence::Sequence()
: seq_start(0),
Sequence::Sequence()
: seq_start(0),
+ seq_count(0),
+ strand(UnknownStrand)
Sequence::Sequence(const char *seq)
: seq_start(0),
seq_count(0),
Sequence::Sequence(const char *seq)
: seq_start(0),
seq_count(0),
header(""),
species("")
{
header(""),
species("")
{
Sequence::Sequence(const std::string& seq)
: seq_start(0),
seq_count(0),
Sequence::Sequence(const std::string& seq)
: seq_start(0),
seq_count(0),
header(""),
species("")
{
header(""),
species("")
{
: seq(o.seq),
seq_start(o.seq_start),
seq_count(o.seq_count),
: seq(o.seq),
seq_start(o.seq_start),
seq_count(o.seq_count),
header(o.header),
species(o.species),
annots(o.annots),
header(o.header),
species(o.species),
annots(o.annots),
seq = s.seq;
seq_start = s.seq_start;
seq_count = s.seq_count;
seq = s.seq;
seq_start = s.seq_start;
seq_count = s.seq_count;
header = s.header;
species = s.species;
annots = s.annots;
header = s.header;
species = s.species;
annots = s.annots;
}
void Sequence::set_filtered_sequence(const std::string &old_seq,
}
void Sequence::set_filtered_sequence(const std::string &old_seq,
- std::string::size_type start,
- std::string::size_type count)
+ size_type start,
+ size_type count,
+ strand_type strand_)
{
char conversionTable[257];
{
char conversionTable[257];
count = old_seq.size() - start;
boost::shared_ptr<seq_string> new_seq(new seq_string);
new_seq->reserve(count);
count = old_seq.size() - start;
boost::shared_ptr<seq_string> new_seq(new seq_string);
new_seq->reserve(count);
seq = new_seq;
seq_start = 0;
seq_count = count;
seq = new_seq;
seq_start = 0;
seq_count = count;
seq.reset();
seq_start = 0;
seq_count = 0;
seq.reset();
seq_start = 0;
seq_count = 0;
+ strand = UnknownStrand;
header.clear();
species.clear();
annots.clear();
header.clear();
species.clear();
annots.clear();
typedef std::string::const_reference const_reference;
typedef std::string::size_type size_type;
static const size_type npos = std::string::npos;
typedef std::string::const_reference const_reference;
typedef std::string::size_type size_type;
static const size_type npos = std::string::npos;
+ enum strand_type { UnknownStrand, PlusStrand, MinusStrand, BothStrand };
// some standard dna alphabets
// Include nl (\012), and cr (\015) to make sequence parsing eol
// some standard dna alphabets
// Include nl (\012), and cr (\015) to make sequence parsing eol
//! set sequence to a (sub)string containing nothing but AGCTN
void set_filtered_sequence(const std::string& seq,
//! set sequence to a (sub)string containing nothing but AGCTN
void set_filtered_sequence(const std::string& seq,
- std::string::size_type start=0,
- std::string::size_type count=0);
+ size_type start=0,
+ size_type count=npos,
+ strand_type strand=UnknownStrand);
//! retrive element at specific position
const_reference at(size_type n) const;
//! retrive element at specific position
const_reference at(size_type n) const;
//! return a subsequence, copying over any appropriate annotation
Sequence subseq(int start=0, int count = std::string::npos) const;
//! return a subsequence, copying over any appropriate annotation
Sequence subseq(int start=0, int count = std::string::npos) const;
- //! return a reverse compliment
+ //! return a reverse compliment (this needs to be improved?)
std::string rev_comp() const;
//! set sequence (filtered)
std::string rev_comp() const;
//! set sequence (filtered)
size_type seq_start;
//! number of basepairs of the shared sequence we represent
size_type seq_count;
size_type seq_start;
//! number of basepairs of the shared sequence we represent
size_type seq_count;
+ //! strand orientation
+ strand_type strand;
//! fasta header
std::string header;
//! species name
//! fasta header
std::string header;
//! species name
ar & BOOST_SERIALIZATION_NVP(seq);
ar & BOOST_SERIALIZATION_NVP(seq_start);
ar & BOOST_SERIALIZATION_NVP(seq_count);
ar & BOOST_SERIALIZATION_NVP(seq);
ar & BOOST_SERIALIZATION_NVP(seq_start);
ar & BOOST_SERIALIZATION_NVP(seq_count);
+ ar & BOOST_SERIALIZATION_NVP(strand);
ar & BOOST_SERIALIZATION_NVP(header);
ar & BOOST_SERIALIZATION_NVP(species);
ar & BOOST_SERIALIZATION_NVP(annots);
ar & BOOST_SERIALIZATION_NVP(header);
ar & BOOST_SERIALIZATION_NVP(species);
ar & BOOST_SERIALIZATION_NVP(annots);