Skip to content

Instantly share code, notes, and snippets.

@robsyme
Created November 3, 2010 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robsyme/660729 to your computer and use it in GitHub Desktop.
Save robsyme/660729 to your computer and use it in GitHub Desktop.
library(Rsamtools)
library(ShortRead)
gene_locations <- read.csv("gene_locations.csv")
gr <- GRanges( seqnames = gene_locations$Scaffold_name,
ranges = IRanges(start=gene_locations$Gene.Start,end=gene_locations$Gene.Stop,names=gene_locations$locus_tag),
strand = gene_locations$Gene.Strand)
#> head(gene_locations)
# locus Gene.name locus_tag Locus_evidence_level Scaffold.Number Scaffold_name
#1 2 SNOG_00002 3 1 scaffold_1
#2 3 SNOG_00003 2 1 scaffold_1
#3 4 SNOG_00004 3 1 scaffold_1
#4 5 SNOG_00005 3 1 scaffold_1
#5 6 SNOG_00006 3 1 scaffold_1
#6 7 SNOG_00007 3 1 scaffold_1
# Gene.Start Gene.Stop Gene.Strand
#1 22020 24466 +
#2 25842 26135 +
#3 26209 29547 -
#4 30072 31598 +
#5 32042 33094 +
#6 33307 33642 -
#> gr
#GRanges with 100 ranges and 0 elementMetadata values
# seqnames ranges strand |
# <Rle> <IRanges> <Rle> |
#SNOG_00002 scaffold_1 [22020, 24466] + |
#SNOG_00004 scaffold_1 [26209, 29547] - |
#SNOG_00005 scaffold_1 [30072, 31598] + |
#SNOG_00006 scaffold_1 [32042, 33094] + |
#SNOG_00007 scaffold_1 [33307, 33642] - |
#SNOG_00008 scaffold_1 [33962, 34992] - |
#SNOG_00010 scaffold_1 [39124, 40913] - |
#SNOG_00011 scaffold_1 [41484, 43978] - |
#SNOG_00012 scaffold_1 [45102, 45308] + |
# ... ... ... ... ...
#SNOG_00120 scaffold_1 [308457, 309143] + |
#SNOG_00121 scaffold_1 [310554, 310751] - |
#SNOG_00122 scaffold_1 [310817, 312067] - |
#SNOG_00126 scaffold_1 [315859, 316811] - |
#SNOG_00127 scaffold_1 [318645, 319559] - |
#SNOG_00128 scaffold_1 [319911, 321243] + |
#SNOG_00129 scaffold_1 [321461, 323775] + |
#SNOG_00130 scaffold_1 [323824, 324134] + |
#SNOG_00131 scaffold_1 [324364, 325175] + |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment