htsget: Retrieve reads (BAM files) or variants (VCF files)

Description Usage Arguments Value Examples

Description

Retrieve reads (BAM files) or variants (VCF files)

Usage

1
2
3
4
5
htsget_reads(granges, sample_id, url, fields = NULL, destination)

BAMfields()

htsget_variants(granges, sample_id, url, destination)

Arguments

granges

GRanges() instance with genomic coordinates for retrieval. Coordinates follow Bioconductor standards (1-based, closed intervals) and are translated to GA4GH coordinates (0-based, half-open intervals).

sample_id

character(1) sample identifier

url

character(1) data resource url, excluding endpoint and sample information.

fields

character() of BAM fields to be included; default (NULL) includes all fields.

destination

character(1) file for output; must not exist.

Value

htsget_reads() return the path to a BAM file containing the requested information.

BAMfields() returns a data.frame describing available fields.

htsget_variants() returns a character(1) path to a VCF file containing requested information.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
gr <- GenomicRanges::GRanges("chr12:111766922-111817529")
sample_id <- "platinum/NA12878"
url <- "https://htsnexus.rnd.dnanex.us/v1"
fl <- tempfile(fileext=".bam")
bam <- htsget_reads(gr, sample_id, url, destination = fl)
Rsamtools::countBam(bam)

BAMfields()
fl <- tempfile(fileext=".bam")
fields <- c("RNAME", "POS", "CIGAR")
bam <- htsget_reads(gr, sample_id, url, fields, destination = fl)
names(Rsamtools::scanBam(bam)[[1]])

gr <- GenomicRanges::GRanges("12:112204691-112247789")
sample_id <- "1000genomes/20130502_autosomes"
url <- "https://htsnexus.rnd.dnanex.us/v1"
fl <- tempfile(fileext=".vcf")
vcf <- htsget_variants(gr, sample_id, url, destination = fl)
VariantAnnotation::readVcf(vcf)

Bioconductor/Rhtsget documentation built on May 7, 2019, 8:40 a.m.