jdoughertyii / pyvcf Goto Github PK
View Code? Open in Web Editor NEWA Variant Call Format reader for Python.
License: MIT License
A Variant Call Format reader for Python.
License: MIT License
I see the --local-script command line argument, and how in vcf_filter.py's main method the classes defined in that local file are added as filters --- but I do not know enough modern :} python to know what to do with
see :doc:FILTERS
for full description.
A sample local filter file would be a big help.
Thanks -- and kudos for the fine tool!
I have a script that 'melts' a VCF file (melt is a ggplot term) from wide format to tab separated wide format - useful for grepping or loading into non-vcf aware applications.
see https://github.com/jamescasbon/PyVCF/blob/master/vcf_melt where I ported it over to use PyVCF.
Perhaps you can include it with PyVCF? add a scripts=['vcf_melt'] to setup.py to get it to install
"A Variant Cell Format reader for Python." should be "A Variant Call Format reader for Python."
Hi!
This is causing me problems:
alt = self._mapper(str, row[4].split(','))
@ line 396
There are times when one would want to put multicharacter strings in the ALT column but this:
<DEL:HOM>
Becomes this:
<,D,E,L,:,H,O,M,>
Thanks!
Hi,
The following code crashes with the error at the bottom:
Python 3.4.1 (default, Nov 11 2014, 09:06:26)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import vcf
vcf_reader = vcf.Reader(filename='bar.vcf.gz',compress=True)
cr = vcf_reader.fetch(chrom='17')
cr
<vcf.parser.Reader object at 0x2ac5ddbd12b0>
x=next(cr)
Traceback (most recent call last):
File "", line 1, in
File "/usr//local/lib/python3.4/site-packages/vcf/parser.py", line 537, in next
line = next(self.reader)
File "pysam/ctabix.pyx", line 543, in pysam.ctabix.TabixIterator.next (pysam/ctabix.c:5906)
File "pysam/ctabix.pyx", line 69, in pysam.ctabix._charptr_to_str (pysam/ctabix.c:2311)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5708: ordinal not in range(128)
It crashed at the record (line) in the vcf file (bar.vcf.gz) that contains several annotations as follows:
17 19559848 rs72547564 G A 0 . GENEINFO=ALDH3A2:224;OriginalChr=chr17;OriginalStart=19656535;RS=72547564;RSPOS=19656535;SAO=1;SSR=0;VC=SNV;VP=0x050260000a05000002110100;WGT=1;dbSNPBuildID=130;ASP;LSD;NSM;OM;PM;REF;S3D;ANN=A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000339618|protein_coding|4/11|c.641G>A|p.Cys214Tyr|862/3828|641/1527|214/508||,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000176643|protein_coding|4/10|c.641G>A|p.Cys214Tyr|1087/3928|641/1458|214/485||,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000581518|protein_coding|4/12|c.641G>A|p.Cys214Tyr|890/2785|641/1527|214/508||,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000395575|protein_coding|5/11|c.641G>A|p.Cys214Tyr|799/3640|641/1458|214/485||,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000579855|protein_coding|5/11|c.641G>A|p.Cys214Tyr|740/3583|641/1458|214/485||,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000571537|protein_coding|1/3|c.134G>A|p.Cys45Tyr|134/607|134/489|45/162||WARNING_TRANSCRIPT_NO_START_CODON,A|missense_variant|MODERATE|ALDH3A2|ENSG00000072210|transcript|ENST00000578696|protein_coding|1/4|c.47G>A|p.Cys16Tyr|48/400|47/399|16/132||WARNING_TRANSCRIPT_NO_START_CODON,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|8/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|3/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|2/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|7/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|5/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|9/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|4/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|6/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000581518|protein_coding|1/12|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|9/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|4/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|3/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|8/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|6/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|10/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|5/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|2/11|c.641G>A||||||,A|sequence_feature|LOW|ALDH3A2|ENSG00000072210|topological_domain:Cytoplasmic|ENST00000579855|protein_coding|7/11|c.641G>A||||||,A|3_prime_UTR_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000472059|nonsense_mediated_decay|5/11|n._199G>A|||||1177|,A|upstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000574078|processed_transcript||n.-1G>A|||||3038|,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000446398|protein_coding||c._665G>A|||||143|WARNING_TRANSCRIPT_NO_STOP_CODON,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000467473|retained_intron||n._651G>A|||||3880|,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000580550|protein_coding||c._540G>A|||||3935|WARNING_TRANSCRIPT_INCOMPLETE,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000584332|protein_coding||c._573G>A|||||165|WARNING_TRANSCRIPT_INCOMPLETE,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000578614|nonsense_mediated_decay||n._359G>A|||||76|,A|downstream_gene_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000579403|retained_intron||n._582G>A|||||3838|,A|non_coding_exon_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000582991|nonsense_mediated_decay|4/10|n.641G>A||||||,A|non_coding_exon_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000472059|nonsense_mediated_decay|5/11|n._199G>A||||||,A|non_coding_exon_variant|MODIFIER|ALDH3A2|ENSG00000072210|transcript|ENST00000476965|retained_intron|1/7|n.391G>A||||||;dbNSFP_GERP++_RS=5.84;dbNSFP_MutationTaster_pred=D;dbNSFP_GERP++_RS_rankscore=0.93424;dbNSFP_phastCons46way_placental_rankscore=0.4774;dbNSFP_MutationTaster_score=1;dbNSFP_phastCons100way_vertebrate=1;dbNSFP_MetaSVM_pred=D;dbNSFP_VEST3_rankscore=0.99865;dbNSFP_fold-degenerate=0;dbNSFP_LRT_pred=D;dbNSFP_LRT_score=0;dbNSFP_SiPhy_29way_logOdds=19.1316;dbNSFP_phyloP100way_vertebrate=9.757;dbNSFP_cds_strand=+;dbNSFP_VEST3_score=0.996;dbNSFP_MetaSVM_score=0.6006;dbNSFP_MetaLR_pred=D;dbNSFP_phyloP100way_vertebrate_rankscore=0.98924;dbNSFP_rs_dbSNP141=rs72547564;dbNSFP_SIFT_pred=D,D,D;dbNSFP_clinvar_trait=Sjögren-Larsson_syndrome;dbNSFP_SiPhy_29way_pi=0.0:0.0:1.0:0.0;dbNSFP_LRT_converted_rankscore=0.85682;dbNSFP_aapos_FATHMM=ENSP00000176643:C214Y,ENSP00000378942:C214Y,ENSP00000345774:C214Y;dbNSFP_aapos=214;dbNSFP_SLR_test_statistic=-18.6067;dbNSFP_aapos_SIFT=ENSP00000176643:C214Y;dbNSFP_Reliability_index=10;dbNSFP_pos(1-coor)=19559848;dbNSFP_Ensembl_transcriptid=ENST00000176643,ENST00000395575,ENST00000339618;dbNSFP_MetaLR_rankscore=0.90604;dbNSFP_clinvar_rs=rs72547564;dbNSFP_Polyphen2_HVAR_score=1,0.997;dbNSFP_ref=G;dbNSFP_Polyphen2_HDIV_rankscore=0.89917;dbNSFP_Polyphen2_HVAR_rankscore=0.9711;dbNSFP_phyloP46way_placental_rankscore=0.95229;dbNSFP_phastCons46way_primate_rankscore=0.84299;dbNSFP_Ensembl_geneid=ENSG00000072210;dbNSFP_FATHMM_score=-0.96,-0.96,-0.96;dbNSFP_SiPhy_29way_logOdds_rankscore=0.9341;dbNSFP_FATHMM_pred=T,T,T;dbNSFP_MutationAssessor_score=3.55;dbNSFP_phyloP46way_primate_rankscore=0.77884;dbNSFP_phastCons100way_vertebrate_rankscore=0.71417;dbNSFP_LRT_Omega=0;dbNSFP_GERP++_NR=5.84;dbNSFP_PROVEAN_pred=D,D,D;dbNSFP_FATHMM_rankscore=0.75704;dbNSFP_Interpro_domain=Aldehydedehydrogenasedomain(1),Aldehydedehydrogenase,N-terminal(1),Aldehyde/histidinoldehydrogenase(1),;dbNSFP_MutationAssessor_pred=H;dbNSFP_PROVEAN_score=-10.53,-10.53,-10.53;dbNSFP_aaref=C;dbNSFP_MetaSVM_rankscore=0.92498;dbNSFP_hg18_pos(1-coor)=19500440;dbNSFP_genename=ALDH3A2;dbNSFP_phastCons46way_placental=0.991;dbNSFP_SIFT_converted_rankscore=0.90636;dbNSFP_MutationAssessor_rankscore=0.94542;dbNSFP_MetaLR_score=0.7054;dbNSFP_chr=17;dbNSFP_clinvar_clnsig=5;dbNSFP_Uniprot_acc=P51648,P51648-2;dbNSFP_codonpos=2;dbNSFP_Polyphen2_HDIV_score=1,1;dbNSFP_aaalt=Y;dbNSFP_refcodon=TGT;dbNSFP_alt=A;dbNSFP_Uniprot_aapos=214,214;dbNSFP_SIFT_score=0,0,0;dbNSFP_MutationTaster_converted_rankscore=0.70825;dbNSFP_hg38_pos=19656535;dbNSFP_Uniprot_id=AL3A2_HUMAN,.;dbNSFP_PROVEAN_converted_rankscore=0.99041;dbNSFP_phastCons46way_primate=0.994;dbNSFP_Ancestral_allele=G;dbNSFP_Polyphen2_HDIV_pred=D,D;dbNSFP_phyloP46way_primate=0.563;dbNSFP_phyloP46way_placental=2.769;dbNSFP_Polyphen2_HVAR_pred=D,D;dbSNP142=rs72547564;regulomeDB=2c;GERP=5.38;chainSelf=26.3
Can we get a setup.py and a pypi listing so that we can install from pip/easy_install and not have to manipulate python path?
A minimal setup.py that works:
from setuptools import setup
setup(
name='PyVCF',
py_modules=['vcf'],
)
You will need to add a bit more to list on pypi, but then see:
http://packages.python.org/an_example_pypi_project/setuptools.html#registering-your-project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.