Minor derp:

values(vars)[, c(1,2,3,5,6,7)] ## so that it fits in an email :-)

## was actually run as

values(vars)[, c(1,5,6,7)]

## my bad




On Fri, Feb 8, 2013 at 9:50 AM, Tim Triche, Jr. <tim.triche@gmail.com>wrote:

> suppose you have your SNPs in a data.frame named 'SNPs' with columns
> 'chrom' and 'location', and suppose they're called against hg19.  Say,
>
> SNPs <- data.frame(chrom=c('chr1','chr9'), location=c(123, 456))
>
> ## To use locateVariants easily, you'll want to turn them into a GRanges.
>
> library(GenomicRanges)
> SNPs.gr <- GRanges( seqnames=SNPs$chrom,
>                                        IRanges(start=SNPs$location,
> width=1) )
> genome(SNPs.gr) <- 'hg19'  ## always record your genome, always always
>
> ## Then:
>
> library(Homo.sapiens)
> library(VariantAnnotation)
>
> vars <- locateVariants(SNPs.gr,  ## the following is from Homo.sapiens
>                                        TxDb.Hsapiens.UCSC.hg19.knownGene,
>                                        AllVariants())
>
> values(vars)[, c(1,2,3,5,6,7)] ## so that it fits in an email :-)
> ## DataFrame with 2 rows and 4 columns
> ##    LOCATION      GENEID   PRECEDEID    FOLLOWID
> ## 1 intergenic                  NA       79501              653635
> ## 2 intergenic                  NA       81704            100287171
>
> ## As the above are both intergenic, you might like to know what they're
> near:
> ##
> unlist(mget(vars$PRECEDEID, org.Hs.egSYMBOL)) ## from Homo.sapiens
> ##  79501   81704
> ##  "OR4F5" "DOCK8"
>
> unlist(mget(vars$FOLLOWID, org.Hs.egSYMBOL)) ## from Homo.sapiens
> ##    653635 100287171
> ##  "WASH7P"   "WASH1"
>
> Does this make sense?
>
> It is a tremendously useful package (thanks much to Valerie, Martin,
> Michael and Stephanie).
>
>
> On Fri, Feb 8, 2013 at 9:29 AM, Fabrice Tourre <fabrice.ciup@gmail.com>wrote:
>
>> Dear list,
>>
>> I am using VariantAnnotation package to annotated a list of snps. But
>> I only have the snp coordinate information. It seems VariantAnnotation
>> only works with VCF format. I am not family with VCF format.
>>
>> How can I use VariantAnnotation with my snp list? It is not vcf format.
>>
>>
>> Thank you very much in advance.
>>
>> Best wishes,
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
>
>
> --
> *A model is a lie that helps you see the truth.*
> *
> *
> Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>
>



-- 
*A model is a lie that helps you see the truth.*
*
*
Howard Skipper<http://cancerres.aacrjournals.org/content/31/9/1173.full.pdf>

	[[alternative HTML version deleted]]

