Skip to content

Commit

Permalink
mfa tag desc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Ondov committed Jul 30, 2014
1 parent 345e241 commit e8ee733
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
20 changes: 15 additions & 5 deletions src/harvest/LcbList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void LcbList::initFromMfa(const char * file, ReferenceList * referenceList, Trac
vector<string> seqs;
const bool oldTags = phylogenyTree->getRoot();
string refTag;
string refDesc;
int * trackIndecesNew;

if ( oldTags )
Expand All @@ -60,12 +61,21 @@ void LcbList::initFromMfa(const char * file, ReferenceList * referenceList, Trac
if ( in.peek() == '>' )
{
in.getline(line, (1 << 20) - 1);
string tag(strtok(line + 1, " "));
string desc(strtok(0, "\n"));
string tag(strtok(line + 1, " \n"));

if ( seqs.size() == 0 )
{
refTag = line + 1;
const char * desc = strtok(0, "\n");

if ( desc )
{
refDesc = desc;
}
}

if ( seqs.size() == 0 )
{
refTag = tag;
}

TrackList::Track * track;
Expand Down Expand Up @@ -111,7 +121,7 @@ void LcbList::initFromMfa(const char * file, ReferenceList * referenceList, Trac
ungap(ref);

referenceList->clear();
referenceList->addReference(refTag, ref);
referenceList->addReference(refTag, refDesc, ref);

initWithSingleLcb(*referenceList, *trackList);

Expand Down Expand Up @@ -432,7 +442,7 @@ void LcbList::initFromXmfa(const char * file, ReferenceList * referenceList, Tra

if ( createReference )
{
referenceList->addReference(trackList->getTrack(0).file, ref);
referenceList->addReference(trackList->getTrack(0).file, "", ref);
}

sort(lcbs.begin(), lcbs.end(), lcbLessThan);
Expand Down
3 changes: 2 additions & 1 deletion src/harvest/ReferenceList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

using namespace::std;

void ReferenceList::addReference(string name, string sequence)
void ReferenceList::addReference(string name, string desc, string sequence)
{
references.resize(references.size() + 1);
references[references.size() - 1].name = name;
references[references.size() - 1].description = desc;
references[references.size() - 1].sequence = sequence;
}

Expand Down
2 changes: 1 addition & 1 deletion src/harvest/ReferenceList.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ReferenceList
std::string gi;
};

void addReference(std::string name, std::string sequence);
void addReference(std::string name, std::string desc, std::string sequence);
void clear();
int getPositionFromConcatenated(int sequence, long int position) const;
const Reference & getReference(int index) const;
Expand Down

0 comments on commit e8ee733

Please sign in to comment.