27 std::tuple<string, string, int64_t> triple;
29 stringstream ssline(locline);
31 assert((name ==
"SPLINT") || (name ==
"SPAN") );
33 vector<string> contigpair(2);
34 size_t pos = splint.find(
"<=>");
35 contigpair[1] = splint.substr(pos+3);
36 contigpair[0] = splint.substr(0, pos);
38 pos = contigpair[0].find(
".");
39 contigpair[0] = contigpair[0].substr(0,pos);
40 pos = contigpair[1].find(
".");
41 contigpair[1] = contigpair[1].substr(0,pos);
43 auto ret =
vertexmap.insert(make_pair(contigpair[0], vertexid));
48 get<0>(triple) = ret.first->first;
49 ret =
vertexmap.insert(make_pair(contigpair[1], vertexid));
50 if (ret.second) ++vertexid;
52 get<1>(triple) = ret.first->first;
55 out << get<0>(triple) <<
"\t" << get<1>(triple) <<
"\t" << get<2>(triple) <<
"\n";
59int main(
int argc,
char* argv[])
63 cout <<
"Usage: ./mer2gr <splint_file> <kmer_file> <span_file" << endl;
70 ofstream out(
"contig_graph.txt");
72 ifstream input1(argv[1]);
73 while(getline(input1,locline))
79 ifstream input2(argv[2]);
80 while(getline(input2,locline))
86 ifstream input3(argv[3]);
87 while(getline(input3,locline))
94 ofstream dictout(
"vertex_dict.txt");
98 max = std::max(max, it->second);
99 dictout << it ->first << endl;
101 cout << (max+1) <<
"\t" << (max+1) <<
"\t" <<
numlines << endl;