[adegenet-forum] addendum to question about how to remove outliers (http://lists.r-forge.r-project.org/pipermail/adegenet-forum/2015-July/001194.html)
Ella Bowles
bowlese at gmail.com
Thu Mar 30 22:27:31 CEST 2017
Hello,
I am trying to remove a set of loci, as in the question posted here:
http://lists.r-forge.r-project.org/pipermail/adegenet-forum/2015-July/001194.html.
However, I'm wondering if there is a way to list the exact locus names
instead of simply the position of the locus. And, what is more, if there is
a way to provide a vector with loci to remove, with the identifier be only
part of the full locus name?
Say I have the following
> dat.s_subset <- dat.s[1:5,1:5]
> dat.s_subset
/// GENIND OBJECT /////////
// 5 individuals; 3 loci; 5 alleles; size: 6.7 Kb
// Basic content
@tab: 5 x 5 matrix of allele counts
@loc.n.all: number of alleles per locus (range: 1-2)
@loc.fac: locus factor for the 5 columns of @tab
@all.names: list of allele names for each locus
@ploidy: ploidy of each individual (range: 2-2)
@type: codom
@call: .local(x = x, i = i, j = j, drop = drop)
// Optional content
@pop: population of each individual (group size range: 5-5)
> locNames(dat.s_subset)
[1] "12706_10" "14223_16" "14481_7"
As I understand it, if I want to remove locus 14223_16, I can use
> toRemove=c(2)
> x=dat.s_subset[loc=-toRemove]
> x
/// GENIND OBJECT /////////
// 5 individuals; 2 loci; 3 alleles; size: 6.3 Kb
// Basic content
@tab: 5 x 3 matrix of allele counts
@loc.n.all: number of alleles per locus (range: 1-2)
@loc.fac: locus factor for the 3 columns of @tab
@all.names: list of allele names for each locus
@ploidy: ploidy of each individual (range: 2-2)
@type: codom
@call: .local(x = x, i = i, j = j, loc = ..1, drop = drop)
// Optional content
@pop: population of each individual (group size range: 5-5)
> locNames(x)
[1] "12706_10" "14481_7"
However, I have thousands of loci, and from the analysis that I have done,
my vector of loci that I want to remove has the number of the locus before
the underscore. Is there a way of specifying loci using only this
information? So, I'd need something like the unix wildcard "*", and to be
able to say something like toRemove=c(14223*).
I've done a bunch of searching on the web to see if it would be easier to
do this outside of adegenet, but it seems like it is going to be hard.
Any help would be much appreciated.
Sincerely,
Ella
--
Ella Bowles, PhD
Postdoctoral Researcher
Department of Biology
Concordia University
Website: https://ellabowlesphd.wordpress.com/
Email: bowlese at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20170330/792b7399/attachment.html>
More information about the adegenet-forum
mailing list