Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output of only count of constant sites #84

Merged
merged 4 commits into from
Oct 22, 2019

Conversation

pvanheus
Copy link
Contributor

I was discussing with some colleagues computing the count of constant sites in an alignment (for input to the -fconst option of IQ-TREE) when @tseemann suggested adding a routine to snp-sites. This PR adds that routine using the -C flag. The version number is not changed in this patch but feel free to merge the code if you think it is useful.

@pvanheus
Copy link
Contributor Author

I did not add a test for this code because I do not quite understand how the testing system works.

gzFile fp;
int base_counts[] = {0, 0, 0, 0};
/* array below allows quick mapping of A, C, T and G characters to indices in base_counts array */
int char_to_base_count_index[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be const int ?

}

if (output_constant_site_counts)
printf("%d,%d,%d,%d\n", base_counts[0], base_counts[1], base_counts[2], base_counts[3]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming these in A C G T order?

@andrewjpage andrewjpage merged commit 5a6bbb1 into sanger-pathogens:master Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants