Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 38 additions and 68 deletions.
  1. +37 −59 src/crass/NodeManager.cpp
  2. +1 −9 src/crass/NodeManager.h
View
96 src/crass/NodeManager.cpp
@@ -991,23 +991,6 @@ void NodeManager::clearContigs(void)
NM_NextContigID = 0;
}
-void NodeManager::findAllForwardAttachedNodes(NodeVector * nodes)
-{
- //-----
- // make nodevectors of all of the nodes, split between cap, cross, path and other
- //
- nodes->clear();
-
- NodeListIterator all_node_iter = NM_Nodes.begin();
- while (all_node_iter != NM_Nodes.end())
- {
- if((all_node_iter->second)->isAttached()&& (all_node_iter->second)->isForward())
- {
- nodes->push_back(all_node_iter->second);
- }
- all_node_iter++;
- }
-}
int NodeManager::buildSpacerGraph(void)
{
@@ -1391,6 +1374,39 @@ void NodeManager::setContigIDForSpacers(SpacerInstanceVector * currentContigNode
}
}
+void NodeManager::assignReadsToContigs(std::map<std::string, int>& readToContigMap, bool showDetached)
+{
+ SpacerListIterator spacer_iter = NM_Spacers.begin();
+ while(spacer_iter != NM_Spacers.end())
+ {
+ SpacerInstance * SI = spacer_iter->second;
+ int CID = SI->getContigID();
+
+ // get the crisprnodes for these guys
+ CrisprNode * Cleader = SI->getLeader();
+ CrisprNode * Clast = SI->getLast();
+
+ if(showDetached || ((SI->getLeader())->isAttached() && (SI->getLast())->isAttached()))
+ {
+ std::vector<std::string> headers = Cleader->getReadHeaders(&NM_StringCheck);
+ std::vector<std::string>::iterator h_iter = headers.begin();
+ while(h_iter != headers.end())
+ {
+ readToContigMap[*h_iter] = CID;
+ h_iter++;
+ }
+
+ headers = Clast->getReadHeaders(&NM_StringCheck);
+ h_iter = headers.begin();
+ while(h_iter != headers.end())
+ {
+ readToContigMap[*h_iter] = CID;
+ h_iter++;
+ }
+ }
+ spacer_iter++;
+ }
+}
// Printing / IO
void NodeManager::dumpReads(std::string readsFileName, bool showDetached, bool split)
@@ -1399,40 +1415,13 @@ void NodeManager::dumpReads(std::string readsFileName, bool showDetached, bool s
// dump reads to this file
//
std::map<std::string, int> read_2_contig_map;
+
+ assignReadsToContigs(read_2_contig_map, showDetached);
+
std::ofstream reads_file;
reads_file.open(readsFileName.c_str());
if (reads_file.good())
{
- SpacerListIterator spacer_iter = NM_Spacers.begin();
- while(spacer_iter != NM_Spacers.end())
- {
- SpacerInstance * SI = spacer_iter->second;
- int CID = SI->getContigID();
-
- // get the crisprnodes for these guys
- CrisprNode * Cleader = SI->getLeader();
- CrisprNode * Clast = SI->getLast();
-
- if(showDetached || ((SI->getLeader())->isAttached() && (SI->getLast())->isAttached()))
- {
- std::vector<std::string> headers = Cleader->getReadHeaders(&NM_StringCheck);
- std::vector<std::string>::iterator h_iter = headers.begin();
- while(h_iter != headers.end())
- {
- read_2_contig_map[*h_iter] = CID;
- h_iter++;
- }
-
- headers = Clast->getReadHeaders(&NM_StringCheck);
- h_iter = headers.begin();
- while(h_iter != headers.end())
- {
- read_2_contig_map[*h_iter] = CID;
- h_iter++;
- }
- }
- spacer_iter++;
- }
// now we can print all the reads to file
ReadListIterator read_iter = NM_ReadList.begin();
@@ -1722,7 +1711,7 @@ void NodeManager::setSpacerColourLimits(void)
{
max_coverage = coverage;
}
- else if(coverage < min_coverage)
+ if(coverage < min_coverage)
{
min_coverage = coverage;
}
@@ -1901,17 +1890,6 @@ std::string NodeManager::getSpacerGraphLabel(SpacerInstance * spacer, bool longD
return se.str();
}
-void NodeManager::printAllSpacers(void)
-{
- SpacerListIterator sp_iter = NM_Spacers.begin();
-
- // first we build up the contents of the walking queue
- while(sp_iter != NM_Spacers.end())
- {
- (sp_iter->second)->printContents();
- sp_iter++;
- }
-}
void NodeManager::printSpacerKey(std::ostream &dataOut, int numSteps, std::string groupNumber)
{
View
10 src/crass/NodeManager.h
@@ -156,13 +156,9 @@ class NodeManager {
int cleanSpacerGraph(void);
void removeSpacerBubbles(void);
int splitIntoContigs(void);
- void findAllForwardAttachedNodes(NodeVector * nodes);
int buildSpacerGraph(void);
void clearContigs(void);
- void contigiseForwardSpacers(std::queue<SpacerInstance *> * walkingQueue, SpacerInstance * SI);
- bool getForwardSpacer(SpacerInstance ** retSpacer, SpacerInstance * SI);
- bool getPrevSpacer(SpacerInstance ** retSpacer, SpacerInstance * SI);
-
+ void assignReadsToContigs(std::map<std::string, int>& readToContigMap, bool showDetached);
// Making purdy colours
void setDebugColourLimits(void);
void setSpacerColourLimits(void);
@@ -183,10 +179,6 @@ class NodeManager {
void addSpacersToDOM(crispr::XML * xmlDoc, xercesc::DOMElement * parentNode, bool showDetached);
void addFlankersToDOM(crispr::XML * xmlDoc, xercesc::DOMElement * parentNode, bool showDetached);
void printAssemblyToDOM(crispr::XML * xmlDoc, xercesc::DOMElement * parentNode, bool showDetached);
-
-
- // Spacer dictionaries
- void printAllSpacers(void);
// Flankers
void generateFlankers(bool showDetached=false);

No commit comments for this range

Something went wrong with that request. Please try again.