Skip to content

Commit 5105dda

Browse files
committed
Added GTC to VCF converter.
1 parent 6be5cd2 commit 5105dda

File tree

4 files changed

+414
-6
lines changed

4 files changed

+414
-6
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ INSTALL_INC=$(PREFIX)/include
4141
INSTALL_LIB=$(PREFIX)/lib
4242
INSTALL_BIN=$(PREFIX)/bin
4343

44-
EXECUTABLES=gtc g2i gtc_process sim simtools normalize_manifest
44+
EXECUTABLES=gtc g2i g2v gtc_process sim simtools normalize_manifest
4545
INCLUDES=Sim.h Gtc.h Manifest.h win2unix.h
4646
LIBS=libsimtools.so libsimtools.a
4747
PERL_MODULES=Gtc.pm Sim.pm
@@ -120,6 +120,9 @@ simtools: simtools.o commands.o libsimtools.a
120120
g2i: g2i.o libsimtools.a
121121
$(CXX) $< $(LDFLAGS) -o $@ -lm -Wl,-Bstatic -lsimtools -Wl,-Bdynamic
122122

123+
g2v: g2v.o libsimtools.a
124+
$(CXX) $< $(LDFLAGS) -o $@ -pthread -lm -Wl,-Bstatic -lsimtools -Wl,-Bdynamic
125+
123126
gtc_process: gtc_process.o libsimtools.a
124127
$(CXX) $< $(LDFLAGS) -o $@ -lm -Wl,-Bstatic -lsimtools -Wl,-Bdynamic
125128

Manifest.cpp

+17-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
//
3333

34+
#include <algorithm>
3435
#include <iostream>
3536
#include <fstream>
3637
#include <map>
@@ -765,8 +766,6 @@ void Manifest::write(string outPath) {
765766

766767
}
767768

768-
769-
770769
///////////////////////////////////////////////
771770
//
772771
// void Manifest::order_by_position()
@@ -812,12 +811,24 @@ void Manifest::order_by_position() {
812811
snps.push_back(s);
813812
}
814813

815-
816814
populate_hashmap();
817-
818815
}
819816

820-
817+
///////////////////////////////////////////////
818+
//
819+
// void Manifest::order_by_locus()
820+
//
821+
// Re-order the vector of snpClass objects such that
822+
// they are stored in the order first of lexically sorted
823+
// chromosome name and then chromosomal position.
824+
//
825+
// Must be called after Manifest::open().
826+
//
827+
///////////////////////////////////////////////
828+
void Manifest::order_by_locus() {
829+
sort(snps.begin(), snps.end());
830+
return;
831+
}
821832

822833
///////////////////////////////////////////////
823834
//
@@ -945,6 +956,7 @@ int Manifest::get_map_value (map<string, int>& mymap, const char* const treasure
945956
}
946957

947958

959+
948960
///////////////////////////////////////////////
949961
//
950962
// string snpClass::toString()

Manifest.h

+11
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ class snpClass {
8080

8181
bool converted; // has SNP been converted from original to ILMN top strand?
8282
// converted=true changes output of toString(), but not the iStrand and cStrand variables (which represent the original values)
83+
84+
bool operator<(snpClass other) const {
85+
if (chromosome.compare(other.chromosome)) {
86+
return (chromosome.compare(other.chromosome) < 0);
87+
}
88+
if (position != other.position) {
89+
return (position < other.position);
90+
}
91+
return (name.compare(other.name) < 0);
92+
}
8393
};
8494

8595

@@ -100,6 +110,7 @@ class Manifest {
100110
void open (string filename, string chromosome, bool wide = false);
101111

102112
void order_by_position();
113+
void order_by_locus();
103114

104115
string filename;
105116

0 commit comments

Comments
 (0)