Question: extract data from RangedData table (IRange TEQC packages)
0
gravatar for nac
7.4 years ago by
nac280
nac280 wrote:
Hi, I would like to extract a txt file of a RangedData table I have created with TEQC package using the get.targets function and a bed target file "file" as an input: > targets<-get.targets("file", chrcol=1,startcol=2,endcol=3, zerobased=F, sep="\t",skip=0) [1] "read 1243 target regions in total, which are collapsed to 598 non-overlapping target regions" > targets RangedData with 598 rows and 0 value columns across 18 spaces space ranges | <factor> <iranges> | 1 Chr1 [115247090, 115250671] | 2 Chr1 [115250775, 115250813] | 3 Chr1 [115251152, 115251275] | 4 Chr1 [115252190, 115252349] | 5 Chr1 [115256421, 115256599] | 6 Chr1 [115258671, 115258798] | 7 Chr1 [115259279, 115259515] | 8 Chr10 [ 89622870, 89624305] | 9 Chr10 [ 89626430, 89626806] | ... ... ... ... 590 ChrX [133607389, 133607495] | 591 ChrX [133609211, 133609394] | 592 ChrX [133620495, 133620560] | 593 ChrX [133620692, 133620696] | 594 ChrX [133624218, 133624235] | 595 ChrX [133627538, 133627620] | 596 ChrX [133632420, 133632466] | 597 ChrX [133632638, 133632714] | 598 ChrX [133634060, 133634698] | I would like to extract the collapsed chromosome start and end points from this to a txt file? Any suggestions would be welcome... output file should contain: Chr1 115247090, 115250671 Chr1 115250775, 115250813 Chr1 115251152, 115251275 ..... Many thanks, Nat -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
teqc • 748 views
ADD COMMENTlink modified 7.4 years ago by Michael Lawrence11k • written 7.4 years ago by nac280
Answer: extract data from RangedData table (IRange TEQC packages)
0
gravatar for Ivan Gregoretti
7.4 years ago by
Canada
Ivan Gregoretti310 wrote:
Hello Nathalie, Try this write.table(as.data.frame(targets)[,c(1,2,3)],file="./output.bed", quote=FALSE, sep="\t", row.names=FALSE, col.names=FALSE) Ivan Ivan Gregoretti, PhD National Institute of Diabetes and Digestive and Kidney Diseases National Institutes of Health 5 Memorial Dr, Building 5, Room 205. Bethesda, MD 20892. USA. Phone: 1-301-496-1592 Fax: 1-301-496-9878 On Thu, Apr 19, 2012 at 11:29 AM, nathalie <nac at="" sanger.ac.uk=""> wrote: > > Hi, > I would like to extract a txt file of a RangedData table I have created with > TEQC package using the get.targets function and a bed target file "file" as > an input: > >> targets<-get.targets("file", chrcol=1,startcol=2,endcol=3, zerobased=F, >> sep="\t",skip=0) > > [1] "read 1243 target regions in total, which are collapsed to 598 > non-overlapping target regions" > >> targets > RangedData with 598 rows and 0 value columns across 18 spaces > ? ? ? space ? ? ? ? ? ? ? ? ranges ? | > <factor> <iranges> ? | > 1 ? ? ? Chr1 [115247090, 115250671] ? | > 2 ? ? ? Chr1 [115250775, 115250813] ? | > 3 ? ? ? Chr1 [115251152, 115251275] ? | > 4 ? ? ? Chr1 [115252190, 115252349] ? | > 5 ? ? ? Chr1 [115256421, 115256599] ? | > 6 ? ? ? Chr1 [115258671, 115258798] ? | > 7 ? ? ? Chr1 [115259279, 115259515] ? | > 8 ? ? ?Chr10 [ 89622870, ?89624305] ? | > 9 ? ? ?Chr10 [ 89626430, ?89626806] ? | > ... ? ? ?... ? ? ? ? ? ? ? ? ? ?... ... > 590 ? ? ChrX [133607389, 133607495] ? | > 591 ? ? ChrX [133609211, 133609394] ? | > 592 ? ? ChrX [133620495, 133620560] ? | > 593 ? ? ChrX [133620692, 133620696] ? | > 594 ? ? ChrX [133624218, 133624235] ? | > 595 ? ? ChrX [133627538, 133627620] ? | > 596 ? ? ChrX [133632420, 133632466] ? | > 597 ? ? ChrX [133632638, 133632714] ? | > 598 ? ? ChrX [133634060, 133634698] ? | > > > I would like to extract the collapsed chromosome start and end points from > this to a txt file? Any suggestions would be welcome... > > output file should contain: > Chr1 115247090, 115250671 > Chr1 115250775, 115250813 > Chr1 115251152, 115251275 > ..... > > > Many thanks, > Nat > > > -- > The Wellcome Trust Sanger Institute is operated by Genome Research Limited, > a charity registered in England with number 1021457 and a company registered > in England with number 2742969, whose registered office is 215 Euston Road, > London, NW1 2BE. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENTlink written 7.4 years ago by Ivan Gregoretti310
On 19/04/12 16:43, Ivan Gregoretti wrote: > write.table(as.data.frame(targets)[,c(1,2,3)],file="./output.bed", > quote=FALSE, sep="\t", row.names=FALSE, col.names=FALSE) works brilliantly thanks :) -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
ADD REPLYlink written 7.4 years ago by nac280
I am glad it works for you. Just notice that the output is standard BED, so, it does not contain the comma between start and end. Happy bioconducting! Ivan On Thu, Apr 19, 2012 at 11:49 AM, nathalie <nac at="" sanger.ac.uk=""> wrote: > On 19/04/12 16:43, Ivan Gregoretti wrote: >> >> write.table(as.data.frame(targets)[,c(1,2,3)],file="./output.bed", >> quote=FALSE, sep="\t", row.names=FALSE, col.names=FALSE) > > works brilliantly thanks > :) > > > > -- > The Wellcome Trust Sanger Institute is operated by Genome Research Limited, > a charity registered in England with number 1021457 and a company registered > in England with number 2742969, whose registered offic...{{dropped:3}}
ADD REPLYlink written 7.4 years ago by Ivan Gregoretti310
Answer: extract data from RangedData table (IRange TEQC packages)
0
gravatar for Michael Lawrence
7.4 years ago by
United States
Michael Lawrence11k wrote:
If you're going to output the data as a BED file, then you're probably better off with: rtracklayer::export(targets, "my.bed") That makes it an actual BED, e.g. it converts the intervals to zero- based half-open. Michael On Thu, Apr 19, 2012 at 8:29 AM, nathalie <nac@sanger.ac.uk> wrote: > > Hi, > I would like to extract a txt file of a RangedData table I have created > with TEQC package using the get.targets function and a bed target file > "file" as an input: > > > targets<-get.targets("file", chrcol=1,startcol=2,endcol=3, zerobased=F, > sep="\t",skip=0) > > [1] "read 1243 target regions in total, which are collapsed to 598 > non-overlapping target regions" > > > targets > RangedData with 598 rows and 0 value columns across 18 spaces > space ranges | > <factor> <iranges> | > 1 Chr1 [115247090, 115250671] | > 2 Chr1 [115250775, 115250813] | > 3 Chr1 [115251152, 115251275] | > 4 Chr1 [115252190, 115252349] | > 5 Chr1 [115256421, 115256599] | > 6 Chr1 [115258671, 115258798] | > 7 Chr1 [115259279, 115259515] | > 8 Chr10 [ 89622870, 89624305] | > 9 Chr10 [ 89626430, 89626806] | > ... ... ... ... > 590 ChrX [133607389, 133607495] | > 591 ChrX [133609211, 133609394] | > 592 ChrX [133620495, 133620560] | > 593 ChrX [133620692, 133620696] | > 594 ChrX [133624218, 133624235] | > 595 ChrX [133627538, 133627620] | > 596 ChrX [133632420, 133632466] | > 597 ChrX [133632638, 133632714] | > 598 ChrX [133634060, 133634698] | > > > I would like to extract the collapsed chromosome start and end points from > this to a txt file? Any suggestions would be welcome... > > output file should contain: > Chr1 115247090, 115250671 > Chr1 115250775, 115250813 > Chr1 115251152, 115251275 > ..... > > > Many thanks, > Nat > > > -- > The Wellcome Trust Sanger Institute is operated by Genome Research > Limited, a charity registered in England with number 1021457 and a company > registered in England with number 2742969, whose registered office is 215 > Euston Road, London, NW1 2BE. > > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > [[alternative HTML version deleted]]
ADD COMMENTlink written 7.4 years ago by Michael Lawrence11k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 128 users visited in the last hour