Removing overlaps in GRange function
0
0
Entering edit mode
6.1 years ago
jmw730 • 0

Here is my current code below. I am tying to look for a command in the GRanges objects that will match Patients Normal(10A) data with their Tumors(01A) and compare ONLY the ranges of the patients to themselves.

#I am using data from the FireBrowse Website
```{r}

library(raster)

WantedData<-subset(NewBreastCancerFireBrowse, subset=(Type=="10A" |Type=="01A"))

WantedData<-subset(Tumor,subset=((Num_Probes>=20 &(Segment_Mean<=(- .2)|Segment_Mean>= .2))))

WD<-with(WantedData, GRanges(seqnames =Chromosome,ranges= IRanges(start=Start, end=End), strand="+", Participant=Participant, SM=Segment_Mean, Type=Type, NumProbes=Num_Probes) )

```

All of the above code works. The Participant column holds a portion of the id column from firebrowse and is labeled "AALJ","AAAU","AALI" etc. Each is unique to each patient.

I want to check for overlaps in the ranges BUT only testing each patient against itself, not against any patients ranges.

I've tried using findOverlaps() but this tests for any overlaps against all patients, which is a lot and also not helpful.

If there is no function to do this, possibly a loop?

Any comments are appreciated! Thank you!

GRanges IRanges Raster FireBrowse R • 2.5k views
ADD COMMENT
0
Entering edit mode

For each patient you can subset the Granges using Participant column. Then you have a subGRanges with only the data of your patient that you can work with.

ADD REPLY
0
Entering edit mode

I am working with a data frame that is about 100,000 levels. There is over 1000 unique patients. I would have to subset them individually to compare them to themselves?

`subset(WD, subset=(Participant=="AAAU")).     subset(WD, subset=(Participant=="AAAL"))`

And so on..

Is there no way to say read each unique patient and compare them to each other?

ADD REPLY
1
Entering edit mode

You can get all the unique patient id, then :

  • Loop over this list
    • For each loop take the patient id and subset your GRanges using the patient id (you'll get a sub Granges with the information of the patient with this id)
    • Do whatever you want with the sub GRanges
ADD REPLY

Login before adding your answer.

Traffic: 1708 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6