This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Removing overlaps in GRange function

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

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.

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?

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

0 answers

No answers yet.

Log in to answer this question.