vcf_selectsamples {WhopGenome} | R Documentation |
Set (vcf_selectsamples) or query (vcf_getselectedsamples) which individuals are included in the returned results, or get a list of selectable individuals.
vcf_selectsamples( vcffh, sampleslist ) vcf_getselectedsamples( vcffh ) vcf_getsamples( vcffh )
vcffh |
VCFhandle type as returned by vcf_open |
sampleslist |
A vector containing the identifiers of the individuals |
When reading variants from VCF files, it is possible to restrict the returned results to a certain subset of the available individuals (samples), e.g. members of a population or people with a certain trait. With vcf_selectsamples the currently selected subset of individuals can be set for a given VCF file. vcf_getselectedsamples returns the list of currently selected individuals and vcf_getsamples returns a list of all available identifiers in the file.
As with most other VCF functions, it is possible to call directly into the library to avoid some overhead. Use .Call("VCF_getSampleNames", vcffh ) , .Call("VCF_getSelectedSamples", vcffh ) or .Call("VCF_selectSamples", vcffh, sampleslist ), respectively. Note the different names!
A vector of strings representing the sample names selected or present in the VCF file.
Ulrich Wittelsbuerger
vcf_open
## ## Example: ## vcffile <- vcf_open( system.file( "extdata" , "ex.vcf.gz" , package="WhopGenome" ) ) allsamplenames <- vcf_getsamples( vcffile ) vcf_selectsamples( vcffile , allsamplenames )