> For the complete documentation index, see [llms.txt](https://ucsc-xena.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ucsc-xena.gitbook.io/project/how-do-i/how-do-i-remove-duplicate-samples-from-a-km-plot.md).

# How do I remove duplicate samples from a KM plot?

If your plot has an '!' icon next to the p-value this means that some patients are in your plot twice. This can happen when A) a patient has both a tumor and normal sample or when a patient has a metastasis that is part of the dataset and/or B) a tumor sample was split into multiple aliquots and then run through the same analysis twice.

This page will guide you on how to remove duplicates due to A. If there are duplicates due to B you will need to [download the data](/project/overview-of-features/download-data.md), decide how to resolve any inconsistencies between the multiple aliquots and [load it into your own Xena Hub](/project/local-xena-hub.md).

### Example of error icon

[**Ending Screenshot**](https://xenabrowser.net/heatmap/?bookmark=93a89b4749b93a0288d9c2ea23045fae)

![](/files/-LLG1ZRE6mqJycMsgOM1)

## Removing duplicates

1. Add the data column of 'sample type' from the Phenotype data

{% hint style="info" %}
We are adding a column of data that indicates the sample type such as 'Primary Tumor', 'Normal', etc. Note that different datasets may have a different name for this the data.
{% endhint %}

2\. Filter to only samples that are 'Primary tumor' by typing 'primary' into the filter search box. Next, click the filter icon next to the filter search box and chose 'Filter'. This will filter out all samples that are not primary tumor.

{% hint style="warning" %}
Note that if you are viewing a mostly metastatic cancer like melanoma you may instead need to filter on 'metastatic' instead of 'primary'

[More help on filtering](/project/overview-of-features/filter-and-subgrouping.md)
{% endhint %}

3\. Run your KM analysis by clicking the caret menu at the top of the column and choosing 'Kaplan-Meier plot' It will now only have primary tumor samples in it.

## Example

Removing duplicate samples from TCGA Lower Grade Glioma KM analysis

[**Ending Screenshot**](https://xenabrowser.net/heatmap/?bookmark=a56b47aefabb74042622547395a6b0a0)

![](/files/-LLG2oxvLT8DBzLCzdIZ)

![](/files/-LLG38YXPYttliei4YI2)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ucsc-xena.gitbook.io/project/how-do-i/how-do-i-remove-duplicate-samples-from-a-km-plot.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
