seems to work, thanks!
• 0 views
•
link
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);
it->first();
Sequence seq = it->item();
seq.setComment("DUMMYCOMMENT");
return seq;
}
But the returned Sequence is corrupted - pointers, I guess?
Thanks for your help
Hi,
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(); it.next())
{
std::cout << "[" << it->getDataSize() << "] " << it->getComment() << std::endl;
it->setComment("DUMMYCOMMENT");
std::cout << it->toString() << std::endl;
}
}
int main (int argc, char* argv[]){
if(argc != 2)
{
printf("%s filename\n",argv[0]);
exit(1);
}
// We get the file name from the user arguments
const char* filename = argv[1] ;
str2seq(filename);
}
seems to work, thanks!
Log in to answer this question.