Skip to content

Commit

Permalink
print genome stats instead of sequence stats
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhickey committed Oct 17, 2012
1 parent 218a9e5 commit 323ee01
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion maf/impl/halMafScanner.cpp
Expand Up @@ -143,7 +143,7 @@ void MafScanner::updateMask()
}
}

std::string MafScanner::genomeName(const std::string fullName) const
std::string MafScanner::genomeName(const std::string fullName)
{
assert(fullName.find('.') != string::npos);
return fullName.substr(0, fullName.find('.'));
Expand Down
30 changes: 17 additions & 13 deletions maf/impl/maf2hal.cpp
Expand Up @@ -112,25 +112,29 @@ int main(int argc, char** argv)

MafScanDimensions dScan;
dScan.scan(mafPath, targetSet);


string prevGenome, curGenome;
hal_size_t segmentCount = 0;
hal_size_t setCount = 0;
hal_size_t sequenceCount = 0;
const MafScanDimensions::DimMap& dimMap = dScan.getDimensions();
for (MafScanDimensions::DimMap::const_iterator i = dimMap.begin();
i != dimMap.end(); ++i)
{
cout << i->first << ": " << i->second->_length << ", "
<< i->second->_startMap.size()
<< " " << i->second->_numSegments << " ";
if (i->second->_startMap.size() < 20)
curGenome = MafScanner::genomeName(i->first);
if (prevGenome.empty() == false && curGenome != prevGenome)
{
MafScanDimensions::StartMap::const_iterator smIt;
for (smIt = i->second->_startMap.begin();
smIt != i->second->_startMap.end();
++smIt)
{
cout << smIt->first << ",";
}
cout << prevGenome << ": " << segmentCount << " segments, "
<< setCount << " set entries, " << sequenceCount << " sequences"
<< endl;
segmentCount = 0;
setCount = 0;
sequenceCount = 0;
}
cout << "\n";
segmentCount += i->second->_numSegments;
setCount += i->second->_startMap.size();
sequenceCount++;
prevGenome = curGenome;
}
cout << "Total Number of blocks in maf: " << dScan.getNumBlocks() << "\n";

Expand Down
3 changes: 2 additions & 1 deletion maf/inc/halMafScanner.h
Expand Up @@ -28,6 +28,7 @@ class MafScanner
virtual void scan(const std::string& mafPath,
const std::set<std::string>& targetSet);
hal_size_t getNumBlocks() const { return _numBlocks; }
static std::string genomeName(const std::string fullName);

struct Row {
std::string _sequenceName;
Expand All @@ -46,7 +47,7 @@ class MafScanner
virtual void end() = 0;
void nextLine();
void updateMask();
std::string genomeName(const std::string fullName) const;


std::ifstream _mafFile;
std::set<std::string> _targets;
Expand Down

0 comments on commit 323ee01

Please sign in to comment.