Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phenotype input file #79

Open
AmruthaJNC opened this issue Oct 16, 2024 · 1 comment
Open

Phenotype input file #79

AmruthaJNC opened this issue Oct 16, 2024 · 1 comment

Comments

@AmruthaJNC
Copy link

AmruthaJNC commented Oct 16, 2024

I am unable to create a phenotype input file. I tried creating a normal text file with two column for sample Ids and phenotype. I also tried creating a vector in R with just the phenotypes, but it is asking for sample Ids. Can i get some help in understanding how to create the phenotype file? I see that the example phen file given is a factor. This might not be a difficult problem, but I'm new to R. So any help will be appreciated.

@caitiecollins
Copy link
Owner

Hi Amrutha,

It sounds like your sample IDs may not be getting assigned as names to your phenotype.
Does names(phen) return NULL? names(phen) should contain your sample IDs.

Have you checked out the example for Loading (phenotypic) data in the Wiki?:
https://github.com/caitiecollins/treeWAS/wiki/2.-Data-&-Data-Cleaning#loading-data

If your sample IDs are a column in your text file, you probably need to do something like this to load and format your data:

## (Generating example data:)
library(treeWAS)
data(phen)
df <- data.frame("sampleID"=names(phen), "phen"=as.vector(phen))
write.table(df, file="./phen_eg.txt")

## Load, format phen:
## Read file:
df <- read.table(file="./phen_eg.txt")
## Get phen vector/factor:
phen <- df$phen
## Assign individual names to phen:
names(phen) <- df$sampleID

Please let me know if that works.
Best,
Caitlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants