flashPCAR cannot load .fam file

64 views
Skip to first unread message

Nicole Torosin

unread,
Sep 15, 2018, 6:58:11 PM9/15/18
to flashpca-users
I am using flashPCAR on linux OS and R version 3.4.3

My plink files are in the directory I am working in and when typing the following 
gatk <- gsub("\\.bed","",
+ system.file("ext.data","gatk.bed",package = "flashpcaR"))

and then trying to run 
f2 <- flashpca(gatk)

The error is
 Error in flashpca_plink_internal(X, stand_i, ndim, div, maxiter, block_size,  : 
  Error reading file '.fam': No such file or directory

Even though it is definitely there and it is called gatk.fam. 

How would I modify the code to make the path to this file clearer, or is there another solution here?

Thank you for any input!


Gad Abraham

unread,
Sep 17, 2018, 12:17:03 AM9/17/18
to flashpca-users
Hi Nicole,

The system.file function is only for loading the example data provided with the package. To read you own data, you don't need that.

Try running
f2 <- flashpca("gatk.fam")

and see if that works.

Gad

Nicole Torosin

unread,
Sep 18, 2018, 5:59:37 PM9/18/18
to flashpca-users
Thank you so much for clarifying Gad, that was helpful. 

I'm also stuck now on how to designate colors for different individuals or populations. I'm not sure where to code the populations, or species in my case, into the plink files and how to then translate that into color coding. Right now each individual is labeled but I cannot see how to translate that either. For example gatk$individual does not work. 


Any advice here would be appreciated, thank you!
Nicole 

Gad Abraham

unread,
Sep 18, 2018, 8:36:52 PM9/18/18
to ntor...@gmail.com, flashpca-users
Hi Nicole,

That's more of an R issue than a flashpca question, but you'll
basically need to read that external information (species or whatever
you want to plot by), e.g., using read.table(), making sure it's in
the same exact ordering as the fam file, then when you go to plot the
PCs, use the information from that external source as the colour
specification for the plot.

Hope that helps.
Gad
> --
> You received this message because you are subscribed to the Google Groups "flashpca-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to flashpca-user...@googlegroups.com.
> To post to this group, send email to flashpc...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/flashpca-users/97b66822-ab26-4176-9f19-1e303f24a7bb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Nicole Torosin

unread,
Sep 19, 2018, 3:01:18 PM9/19/18
to flashpca-users
Hi Gad, 

I really appreciate you helping me with that. One last question, I hope, is there any way to figure out which genetic variants are responsible for PC1 and PC2?

Thank you so much,
Nicole 

Gad Abraham

unread,
Sep 19, 2018, 8:17:41 PM9/19/18
to ntor...@gmail.com, flashpca-users
Nicole, these would be the per-SNP loadings, to get these you'll need
to re-run flashpca with do_loadings=TRUE, and then look at
f2$loadings.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/flashpca-users/2224482c-d541-4057-b777-96fd1128b063%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages