Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions SINGER/SINGER/Sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Sampler::naive_read_vcf_haploid(string prefix, double start_pos, double end
ifstream file(vcf_file);
string line;
int num_individuals = 0;
int prev_pos = -1;
long long prev_pos = -1;
vector<Node_ptr> nodes = {};
int valid_mutation = 0;
int removed_mutation = 0;
Expand All @@ -84,23 +84,23 @@ void Sampler::naive_read_vcf_haploid(string prefix, double start_pos, double end
}
istringstream iss(line);
string chrom, id, ref, alt, qual, filter, info, format, genotype;
int pos;
long long pos;
iss >> chrom >> pos >> id >> ref >> alt >> qual >> filter >> info >> format;

if (pos < start_pos) {continue;}
if (pos > end_pos) {break;}
if (pos == prev_pos) {continue;} // skip multi-allelic sites
if (ref.size() > 1 or alt.size() > 1) {
removed_mutation += 1;
continue;
} // skip multi-allelic sites or structural variant

streampos old_pos = file.tellg();
string next_line;
if (getline(file, next_line)) {
istringstream next_iss(next_line);
string next_chrom;
int next_pos;
long long next_pos;
next_iss >> next_chrom >> next_pos;
if (next_pos == pos) {
removed_mutation += 1;
Expand Down Expand Up @@ -137,7 +137,7 @@ void Sampler::naive_read_vcf(string prefix, double start_pos, double end_pos) {
ifstream file(vcf_file);
string line;
int num_individuals = 0;
int prev_pos = -1;
long long prev_pos = -1;
vector<Node_ptr> nodes = {};
int valid_mutation = 0;
int removed_mutation = 0;
Expand All @@ -164,23 +164,23 @@ void Sampler::naive_read_vcf(string prefix, double start_pos, double end_pos) {
}
istringstream iss(line);
string chrom, id, ref, alt, qual, filter, info, format, genotype;
int pos;
long long pos;
iss >> chrom >> pos >> id >> ref >> alt >> qual >> filter >> info >> format;

if (pos < start_pos) {continue;}
if (pos > end_pos) {break;}
if (pos == prev_pos) {continue;} // skip multi-allelic sites
if (ref.size() > 1 or alt.size() > 1) {
removed_mutation += 1;
continue;
} // skip multi-allelic sites or structural variant

streampos old_pos = file.tellg();
string next_line;
if (getline(file, next_line)) {
istringstream next_iss(next_line);
string next_chrom;
int next_pos;
long long next_pos;
next_iss >> next_chrom >> next_pos;
if (next_pos == pos) {
removed_mutation += 1;
Expand Down Expand Up @@ -251,15 +251,15 @@ void Sampler::guide_read_vcf(string prefix, double start, double end) {
cerr << "VCF file not found: " + vcf_file << endl;
}
vcf_stream.seekg(byte_offset, ios::beg);
int prev_pos = -1;
long long prev_pos = -1;
vector<Node_ptr> nodes = {};
int valid_mutation = 0;
int removed_mutation = 0;
vector<double> genotypes = {};
while (getline(vcf_stream, line)) {
istringstream iss(line);
string chrom, id, ref, alt, qual, filter, info, format, genotype;
int pos;
long long pos;
iss >> chrom >> pos >> id >> ref >> alt >> qual >> filter >> info >> format;
if (pos == prev_pos) {continue;} // skip multi-allelic sites
if (pos >= end) {break;} // variant out of scope
Expand All @@ -272,7 +272,7 @@ void Sampler::guide_read_vcf(string prefix, double start, double end) {
if (getline(vcf_stream, next_line)) {
istringstream next_iss(next_line);
string next_chrom;
int next_pos;
long long next_pos;
next_iss >> next_chrom >> next_pos;
if (next_pos == pos) {
removed_mutation += 1;
Expand Down
2 changes: 1 addition & 1 deletion SINGER/SINGER/singer_master
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def main():
if (args.resume):
resume_rate_singer(args.Ne, args.m, args.m*args.ratio, args.start, args.end, args.vcf, args.output, args.n, args.thin, args.polar, args.seed)
else:
run_rate_singer(args.Ne, args.m, args.m*args.ratio, args.start, args.end, args.vcf, args.output, args.n, args.thin, args.polar, arggs.ploidy, args.seed)
run_rate_singer(args.Ne, args.m, args.m*args.ratio, args.start, args.end, args.vcf, args.output, args.n, args.thin, args.polar, args.ploidy, args.seed)
return

if args.mut_map and not args.m:
Expand Down