Ha! That's because gaps are coded with dashes in your files; I assumed it was 
X's (as returned by ape::trans). So this line 7 should be:

    foo <- function(x) sum(x == 0x58 | x == 0x2d)

Or (probably easier to modify):

    foo <- function(x) sum(x == charToRaw("X") | x == charToRaw("-"))

Cheers,
Emmanuel

----- Le 2 Nov 21, à 19:23, Vojtěch Zeisek vo...@trapa.cz a écrit :

> Thank You, Emmanuel,
> I thought I must do something with line 7, but I had no idea what. :-)
> Unfortunately it didn't work. I still get "All sequences of the same length:
> 249" after running the edited function as 'aln.ng <- del.colgapsonly(x=aln,
> threshold=0.25, freq.only=FALSE)'... :-( I'm attaching one example (I have
> almost 1000 of them, so I'd like to avoid to edit all of them manually:-).
> Sincerely,
> V.
> 
> Dne úterý 2. listopadu 2021 12:36:53 CET jste napsal(a):
>> Hi Vojtěch,
>> In addition to removing lines 3 and 4, replace line 7:
>>     foo <- function(x) sum(x == 4)
>> by:
>>     foo <- function(x) sum(x == 0x58)
>> That sh(c)ould do it.
>> Best,
>> Emmanuel
>> 
>> Le 2 Nov 21, à 17:37, Vojtěch Zeisek vo...@trapa.cz a écrit :
>> > Hello,
>> > I try to trim protein alignments in R. I see del.colgapsonly() and
>> > del.rowgapsonly() from ape can trim only class DNAbin. As DNAbin as
>> > basically same matrix as AAbin (Isn't it?), I thought it should be
>> > easy. I commented out lines 3 and 4 in both del.colgapsonly() and
>> > del.rowgapsonly(), but it didn't lead to success. I haven't found
>> > any other way how to trim protein alignment in R similar to what
>> > these two function do. Is there any way?
>> > Sincerely,
>> > V.
> --
> Vojtěch Zeisek
> https://trapa.cz/en/
> 
> Department of Botany, Faculty of Science
> Charles University, Prague, Czech Republic
> https://www.natur.cuni.cz/biology/botany/
> https://lab-allience.natur.cuni.cz/
> 
> Institute of Botany, Czech Academy of Sciences
> Průhonice, Czech Republic
> https://www.ibot.cas.cz/en/
> Computing cluster
> https://sorbus.ibot.cas.cz/en/start
> 
> _______________________________________________
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to