Skip to content

Commit f3b7e75

Browse files
committed
a little leftover output code cleanup
1 parent 1b4f604 commit f3b7e75

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

core/haplosome.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,7 +3164,6 @@ EidosValue_SP Haplosome_Class::ExecuteMethod_readFromMS(EidosGlobalStringID p_me
31643164
// Get the species of interest from the mutation type; we will check that all target haplosomes belong to it below
31653165
Species &species = mutation_type_ptr->species_;
31663166
Population &pop = species.population_;
3167-
slim_position_t last_position = species.TheChromosome().last_position_;
31683167
bool recording_mutations = species.RecordingTreeSequenceMutations();
31693168
bool nucleotide_based = species.IsNucleotideBased();
31703169
int target_size = p_target->Count();
@@ -3194,6 +3193,8 @@ EidosValue_SP Haplosome_Class::ExecuteMethod_readFromMS(EidosGlobalStringID p_me
31943193
EIDOS_TERMINATION << "ERROR (Haplosome_Class::ExecuteMethod_readFromMS): for readFromMS(), all target haplosomes must be associated with the same chromosome." << EidosTerminate();
31953194
}
31963195

3196+
slim_position_t last_position = chromosome->last_position_;
3197+
31973198
// Parse the whole input file and retain the information from it
31983199
std::ifstream infile(file_path);
31993200

@@ -3452,7 +3453,7 @@ EidosValue_SP Haplosome_Class::ExecuteMethod_readFromVCF(EidosGlobalStringID p_m
34523453

34533454
Community &community = species->community_;
34543455
Population &pop = species->population_;
3455-
slim_position_t last_position = species->TheChromosome().last_position_;
3456+
slim_position_t last_position = chromosome->last_position_;
34563457
bool recording_mutations = species->RecordingTreeSequenceMutations();
34573458
bool nucleotide_based = species->IsNucleotideBased();
34583459
std::string file_path = Eidos_ResolvedPath(Eidos_StripTrailingSlash(filePath_value->StringAtIndex_NOCAST(0, nullptr)));
@@ -3918,7 +3919,7 @@ EidosValue_SP Haplosome_Class::ExecuteMethod_readFromVCF(EidosGlobalStringID p_m
39183919
if (ref_nuc != info_ancestral_nuc)
39193920
EIDOS_TERMINATION << "ERROR (Haplosome_Class::ExecuteMethod_readFromVCF): the REF nucleotide does not match the AA nucleotide." << EidosTerminate();
39203921

3921-
int8_t ancestral = (int8_t)species->TheChromosome().AncestralSequence()->NucleotideAtIndex(mut_position);
3922+
int8_t ancestral = (int8_t)chromosome->AncestralSequence()->NucleotideAtIndex(mut_position);
39223923

39233924
if (ancestral != ref_nuc)
39243925
EIDOS_TERMINATION << "ERROR (Haplosome_Class::ExecuteMethod_readFromVCF): the REF/AA nucleotide does not match the ancestral nucleotide at the same position; a matching ancestral nucleotide sequence must be set prior to calling readFromVCF()." << EidosTerminate();

core/subpopulation.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11094,9 +11094,12 @@ EidosValue_SP Subpopulation::ExecuteMethod_outputXSample(EidosGlobalStringID p_m
1109411094
const std::vector<Chromosome *> &chromosomes = species_.Chromosomes();
1109511095
Chromosome *chromosome;
1109611096

11097+
if (chromosomes.size() == 0)
11098+
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_outputXSample): output cannot be generated from a species with no genetics." << EidosTerminate();
11099+
1109711100
if (chromosome_arg->Type() == EidosValueType::kValueNULL)
1109811101
{
11099-
if (chromosomes.size() != 1)
11102+
if (chromosomes.size() > 1)
1110011103
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_outputXSample): output requires a non-NULL value for chromosome in multi-chromosome models." << EidosTerminate();
1110111104

1110211105
chromosome = chromosomes[0];

0 commit comments

Comments
 (0)