Skip to content

Commit aec11fc

Browse files
committed
already know first sequence can only have N
1 parent 7af604f commit aec11fc

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/alignment-file.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,20 @@ void get_bases_for_each_snp(char filename[], int snp_locations[], char ** bases_
7979
while ((l = kseq_read(seq)) >= 0)
8080
{
8181
if(sequence_number == 0)
82-
{
83-
length_of_genome_found = seq->seq.l;
84-
}
82+
{
83+
length_of_genome_found = seq->seq.l;
84+
}
8585
for(i = 0; i< number_of_snps; i++)
86-
{
87-
bases_for_snps[i][sequence_number] = toupper(((char *) seq->seq.s)[snp_locations[i]]);
88-
}
86+
{
87+
bases_for_snps[i][sequence_number] = toupper(((char *) seq->seq.s)[snp_locations[i]]);
88+
}
8989

9090
if(seq->seq.l != length_of_genome_found)
91-
{
92-
fprintf(stderr, "Alignment %s contains sequences of unequal length. Expected length is %i but got %i in sequence %s\n\n",filename, (int) length_of_genome_found, (int) seq->seq.l,seq->name.s);
93-
fflush(stderr);
94-
exit(EXIT_FAILURE);
95-
}
96-
91+
{
92+
fprintf(stderr, "Alignment %s contains sequences of unequal length. Expected length is %i but got %i in sequence %s\n\n",filename, (int) length_of_genome_found, (int) seq->seq.l,seq->name.s);
93+
fflush(stderr);
94+
exit(EXIT_FAILURE);
95+
}
9796
sequence_number++;
9897
}
9998

@@ -137,7 +136,7 @@ void detect_snps(char filename[])
137136
first_sequence[i] = toupper(seq->seq.s[i]);
138137
}
139138

140-
if(first_sequence[i] != '>' && !is_unknown(seq->seq.s[i]) && !is_unknown(first_sequence[i]) && first_sequence[i] != toupper(seq->seq.s[i]))
139+
if(first_sequence[i] != '>' && !is_unknown(seq->seq.s[i]) && first_sequence[i] != 'N' && first_sequence[i] != toupper(seq->seq.s[i]))
141140
{
142141
first_sequence[i] = '>';
143142
number_of_snps++;
@@ -173,8 +172,8 @@ void detect_snps(char filename[])
173172
int is_unknown(char base)
174173
{
175174
switch (base) {
176-
case 'n':
177175
case 'N':
176+
case 'n':
178177
case '-':
179178
case '?':
180179
return 1;

0 commit comments

Comments
 (0)