Question: GATB - create or manipulate data of Sequence
gravatar for wfd
2.1 years ago by
wfd0 wrote:

Hi there,

For my recent GATB project I'd like to either create a Sequence object [with comment(id and such), possibly quality and a given string] or manipulate the sequence string of an existing Sequence. However, while there are setters for quality and comment, I do not know how to set the data itself. Is there a way to do it?

I tried creating a sequence using a dummy bank with just one sequence like this;

 Sequence str2seq(string str){
      IBank *dummyBank = new BankStrings(str.c_str(), NULL);
      LOCAL (dummyBank);
      Iterator<Sequence> *it = dummyBank->iterator();
      LOCAL (it);
      Sequence seq = it->item();
      return seq;

But the returned Sequence is corrupted - pointers, I guess?

Thanks for your help

gatb • 647 views
ADD COMMENTlink modified 2.1 years ago by pierre.peterlongo840 • written 2.1 years ago by wfd0
gravatar for pierre.peterlongo
2.1 years ago by
pierre.peterlongo840 wrote:


From the GATB documentation, you will find many snipets examples.

You code could be

  #include <gatb/gatb_core.hpp>

 Sequence str2seq(std::string str){

    BankFasta dummyBank (str);
    BankFasta::Iterator it (dummyBank);
    for (it.first(); !it.isDone();

        std::cout << "[" << it->getDataSize() << "] " << it->getComment()  << std::endl;

        std::cout << it->toString() << std::endl;

 int main (int argc, char* argv[]){
    if(argc != 2)
        printf("%s filename\n",argv[0]);

    // We get the file name from the user arguments
    const char* filename = argv[1] ;


ADD COMMENTlink modified 2.1 years ago • written 2.1 years ago by pierre.peterlongo840

seems to work, thanks!

ADD REPLYlink modified 2.1 years ago • written 2.1 years ago by wfd0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1276 users visited in the last hour