Comments (3)
if you give it the path ""mpg.snv.vcf.gz" and ""mpg.snv.vcf.gz.tbi" exists it will work.
from cyvcf2.
This is what I use:
import cyvcf2
import numpy as np
snv5A = ('5_A.mpg.snv.vcf.gz.tbi')
vcf = cyvcf2.VCF ('snv5A')
sample_counts = np. zeros (len (vcf . samples ), dtype = float )
for variant in vcf(" chr22 :36265140 -36267531 "):
if variant . is_indel : continue
if variant . QUAL < 10: continue
depths = variant . format ("AD") # get all depths .
sample_counts [( depths [:, 1] > 10) & ( variant. gt_types == vcf .HET )] += 1
zippedsnv5A = zip ( vcf . samples , sample_counts)
print ( zippedsnv5A )
from cyvcf2.
to open the vcf you need:
snv5A = '5_A.mpg.snv.vcf.gz'
vcf = cyvcf2.VCF(snv5A)
note that you don't want to quote snv5A
or it will look for a file of that name.
from cyvcf2.
Related Issues (20)
- Bug: Set_samples function somehow removed all FORMAT fields HOT 2
- Floating point imprecision HOT 8
- Dealing with missing values in INFO column HOT 2
- Processing BED? HOT 2
- Any method available to split vcf files into individual sample vcf files
- Importing 64bit integers in FORMAT? HOT 4
- Add setter for POS HOT 1
- Crash with single GT allele value - UnicodeDecodeError: 'ascii' codec can't decode byte 0x81 in position 1: ordinal not in range(128) HOT 2
- Could you bump a new version to the pip HOT 1
- Provide access to index stats HOT 6
- Suggest not to remove htslib/config.status at setup.py
- No macOS arm64 wheels available for 0.30.26 and 0.30.27 HOT 1
- Adding new variant record
- Multiallelic VCF with annotation in INFO field doesn't query all available infromation HOT 3
- ##INFO fields being dropped HOT 6
- Skip the warnings? HOT 2
- Missing values for multi-allelic variants result in large negative numbers in `.format("AD")`, not all the same HOT 1
- MacOS ARM wheels broken? HOT 12
- Error importing cyvcf2 with numpy 2.0.0 HOT 10
- record.FILTER vs. record.FILTERS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyvcf2.