Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pwwang committed Oct 20, 2019
0 parents commit 4808b75
Show file tree
Hide file tree
Showing 27 changed files with 1,488 additions and 0 deletions.
142 changes: 142 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# vscode
.vscode/

# poetry
poetry.lock

# backup file
*.bak

# End of https://www.gitignore.io/api/python

examples/*.R
examples/*.txt
133 changes: 133 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
TARGETS := examples/Number_of_variants_on_each_chromosome.col.png \
examples/Number_of_variants_on_each_chromosome_(modified).col.png \
examples/Number_of_variants_on_each_chromosome_(first_5).col.png \
examples/Number_of_substitutions_of_SNPs.col.png \
examples/Number_of_substitutions_of_SNPs_(passed).col.png \
examples/Allele_frequency_on_each_chromosome.violin.png \
examples/Allele_frequency_on_each_chromosome.boxplot.png \
examples/Allele_frequency_on_chromosome_1_2.density.png \
examples/Overall_allele_frequency_distribution.histogram.png \
examples/Overall_allele_frequency_distribution_(0.05-0.95).histogram.png \
examples/Distribution_of_allele_frequency_on_chromosome_1.histogram.png \
examples/Types_of_variants_on_each_chromosome.col.png \
examples/Types_of_variants_on_each_chromosome_1.pie.png \
examples/Types_of_variants_on_whole_genome.pie.png \
examples/Allele_frequency_vs_depth_(sample_1).scatter.png \
examples/Mutant_genotypes_on_each_chromosome_(sample_1).col.png \
examples/Allele_frequency_vs_depth_(sample_1).scatter.png \
examples/Depths_between_sample_1_and_2.scatter.png


DEPENDS := examples/sample.vcf examples/config.toml vcfstats/__init__.py \
vcfstats/formula.py vcfstats/macros.py vcfstats/one.py

VCFSTATS := vcfstats --vcf examples/sample.vcf \
--outdir examples/ \
--config examples/config.toml

FILETOTITLE = $(subst _, ,$(notdir $(basename $(basename $(1)))))
FIGTYPE = $(patsubst .%,%,$(suffix $(basename $(notdir $(1)))))
LOGGER = $(info $(empty))$(info \# Working on '$(call FILETOTITLE,$(1))' ...)\
$(info ===================================================================================)

.PHONY: all clean

all: $(TARGETS)

examples/Types_of_variants_on_whole_genome.col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \


examples/Number_of_variants_on_each_chromosome.col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1) ~ CONTIG'

examples/Number_of_variants_on_each_chromosome_(modified).col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1) ~ CONTIG' \
--ggs 'scale_x_discrete(name ="Chromosome", limits=c("1","2","3","4","5","6","7","8","9","10","X")) + ylab("# Variants")'

examples/Number_of_substitutions_of_SNPs.col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, VARTYPE[snp]) ~ SUBST[A>T,A>G,A>C,T>A,T>G,T>C,G>A,G>T,G>C,C>A,C>T,C>G]' \

examples/Number_of_substitutions_of_SNPs_(passed).col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, VARTYPE[snp]) ~ SUBST[A>T,A>G,A>C,T>A,T>G,T>C,G>A,G>T,G>C,C>A,C>T,C>G]' \
--passed

examples/Number_of_variants_on_each_chromosome_(first_5).col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1) ~ CONTIG[1-5]'

examples/Allele_frequency_on_each_chromosome.violin.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF ~ CONTIG' \
--ggs 'theme_dark()'

examples/Allele_frequency_on_each_chromosome.boxplot.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF ~ CONTIG'

examples/Allele_frequency_on_chromosome_1_2.density.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF ~ CONTIG[1,2]' \
--figtype density

examples/Overall_allele_frequency_distribution.histogram.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF ~ 1'

examples/Overall_allele_frequency_distribution_(0.05-0.95).histogram.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF[0.05, 0.95] ~ 1'

examples/Distribution_of_allele_frequency_on_chromosome_1.histogram.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'AAF ~ CHROM[1]'

examples/Types_of_variants_on_each_chromosome.col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, group=VARTYPE) ~ CHROM'

examples/Types_of_variants_on_each_chromosome_1.pie.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, group=VARTYPE) ~ CHROM[1]' \
--figtype pie

examples/Types_of_variants_on_whole_genome.pie.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, group=VARTYPE) ~ 1'

examples/Allele_frequency_vs_depth_(sample_1).scatter.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'MEAN(AFs{0}) ~ MEAN(DEPTHs{0}, group=CHROM)'

examples/Mutant_genotypes_on_each_chromosome_(sample_1).col.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'COUNT(1, group=GTTYPEs[HET,HOM_ALT]{0}) ~ CHROM'

examples/Depths_between_sample_1_and_2.scatter.png: $(DEPENDS)
@$(call LOGGER,$@)
$(VCFSTATS) --title '$(call FILETOTITLE,$@)' --figtype $(call FIGTYPE,$@) \
--formula 'DEPTHs{0} ~ DEPTHs{1}'

clean:
rm -f examples/*.txt examples/*.R examples/*.png
Loading

0 comments on commit 4808b75

Please sign in to comment.