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

Problem with calc_rank_dist_ave, Error in Ops.factor(melted_sub$rank1, melted_sub$rank2) : level sets of factors are different #37

Open
atrujillog opened this issue Jun 18, 2019 · 0 comments

Comments

@atrujillog
Copy link

Hello! I am having issues when using the calc_rank_dist_ave function. I am testing a list of universal primers, but this example tests just one from the list

First, I ran search_primer_pair:
primertest <-search_primer_pair(name = FishCB, as.character(TCCTTTTGAGGCGCTACAGT), as.character(GGAATGCGAAGAATCGTGTT), num_aligns = 1000, num_permutations = 200)

Checked on sequence lengths, found no outliers and defined my primertree object:
seq_lengths(PT.FishCB) # No obvious outliers PT.F.FishCB <- FishCB

tmp1 <- PT.F.FishCB TAXID.All <- length(unique(as.data.frame(get(tmp1)$taxonomy)$taxId)) TAXID.Act <- length(unique(subset(as.data.frame(get(tmp1)$taxonomy), subset = class == "Actinopteri")$taxId)) dat.I$PT.Specificity[i] <- round((TAXID.Act/TAXID.All)*100, digits = 2) dat.I$PT.PWDistance[i] <- as.numeric(calc_rank_dist_ave(get(tmp1), ranks = c("genus"))) dat.I$PT.Length[i] <- as.integer(mean(get(tmp1)$BLAST_result$product_length)) dat.I$PT.Resolution[i] <- as.numeric(dat.I$PT.PWDistance[i])/as.numeric(dat.I$PT.Length[i]) dat.I$PT.Order[i] <- length(unique(subset(as.data.frame(get(tmp1)$taxonomy), subset = class == "Actinopteri")$order)) dat.I$PT.Family[i] <- length(unique(subset(as.data.frame(get(tmp1)$taxonomy), subset = class == "Actinopteri")$family)) dat.I$PT.Genus[i] <- length(unique(subset(as.data.frame(get(tmp1)$taxonomy), subset = class == "Actinopteri")$genus))}

When I get to using the calc_rank_dist_ave function I get the following error:

Error in Ops.factor(melted_sub$rank1, melted_sub$rank2) :
level sets of factors are different

checking the PT.F.FishCB object:
str(PT.FishCB)

List of 9
$ alignment : 'DNAbin' raw [1:1000, 1:130] t t t t ...
..- attr(, "dimnames")=List of 2
.. ..$ : chr [1:1000] "1373380155" "1479554780" "1479554778" "1479554776" ...
.. ..$ : NULL
$ arguments :List of 6
..$ forward : chr "TCCTTTTGAGGCGCTACAGT"
..$ reverse : chr "GGAATGCGAAGAATCGTGTT"
..$ name : int 7
..$ num_aligns : num 1000
..$ num_permutations: num 200
..$ simplify : logi TRUE
$ BLAST_result:'data.frame': 1000 obs. of 12 variables:
..$ X1 : int [1:1000] 1 1 1 1 1 1 1 1 1 1 ...
..$ gi : chr [1:1000] "1373380155" "1479554780" "1479554778" "1479554776" ...
..$ accession : Factor w/ 1000 levels "MF040582.1","MG490163.1",..: 1 2 3 4 5 6 7 8 9 10 ...
..$ product_length : num [1:1000] 130 130 130 130 130 130 130 130 130 130 ...
..$ mismatch_forward: int [1:1000] 0 0 0 0 0 0 0 0 0 0 ...
..$ mismatch_reverse: int [1:1000] 0 0 0 0 0 0 0 0 0 0 ...
..$ forward_start : num [1:1000] 415 415 415 415 415 ...
..$ forward_stop : num [1:1000] 434 434 434 434 434 ...
..$ reverse_start : num [1:1000] 544 544 544 544 544 ...
..$ reverse_stop : num [1:1000] 525 525 525 525 525 ...
..$ product_start : num [1:1000] 415 415 415 415 415 ...
..$ product_stop : num [1:1000] 544 544 544 544 544 ...
$ distances : 'dist' num [1:499500] 1 0 1 1 16 10 15 15 15 15 ...
..- attr(
, "Size")= int 1000
..- attr(, "Labels")= chr [1:1000] "1373380155" "1479554780" "1479554778" "1479554776" ...
..- attr(
, "Upper")= logi FALSE
..- attr(, "Diag")= logi FALSE
..- attr(
, "call")= language (function (x, model = "K80", variance = FALSE, gamma = FALSE, pairwise.deletion = FALSE, base.freq = NULL, a| truncated ...
..- attr(, "method")= chr "N"
$ name : Factor w/ 15 levels "16S1","16sFD",..: 7
$ response :List of 1
..$ 1:List of 10
.. ..$ url : chr "https://www.ncbi.nlm.nih.gov/tools/primer-blast/primertool.cgi?ctg_time=1559884302&job_key=PDbjt7pWt_6QxKHBrKGF89a6lMH7qY_c-g"
.. ..$ status_code: int 200
.. ..$ headers :List of 19
.. .. ..$ date : chr "Fri, 07 Jun 2019 05:12:34 GMT"
.. .. ..$ server : chr "Apache"
.. .. ..$ strict-transport-security : chr "max-age=31536000; includeSubDomains; preload"
.. .. ..$ referrer-policy : chr "origin-when-cross-origin"
.. .. ..$ content-security-policy : chr "upgrade-insecure-requests"
.. .. ..$ cache-control : chr "private"
.. .. ..$ ncbi-phid : chr "9CAA3345CF9F20E10000000000000001.m_29"
.. .. ..$ ncbi-sid : chr "07513003CF075801_0000SID"
.. .. ..$ access-control-allow-methods : chr "POST, GET, PUT, OPTIONS, PATCH, DELETE"
.. .. ..$ access-control-allow-origin : chr ""
.. .. ..$ access-control-allow-credentials: chr "true"
.. .. ..$ access-control-allow-headers : chr "Origin,X-Accept-Charset,X-Accept,Content-Type,X-Requested-With,NCBI-SID,NCBI-PHID"
.. .. ..$ content-type : chr "text/html"
.. .. ..$ set-cookie : chr "ncbi_sid=07513003CF075801_0000SID; domain=.nih.gov; path=/; expires=Sun, 07 Jun 2020 05:11:42 GMT"
.. .. ..$ vary : chr "Accept-Encoding"
.. .. ..$ content-encoding : chr "gzip"
.. .. ..$ x-ua-compatible : chr "IE=Edge"
.. .. ..$ x-xss-protection : chr "1; mode=block"
.. .. ..$ transfer-encoding : chr "chunked"
.. .. ..- attr(
, "class")= chr [1:2] "insensitive" "list"
.. ..$ all_headers:List of 1
.. .. ..$ :List of 3
.. .. .. ..$ status : int 200
.. .. .. ..$ version: chr "HTTP/1.1"
.. .. .. ..$ headers:List of 19
.. .. .. .. ..$ date : chr "Fri, 07 Jun 2019 05:12:34 GMT"
.. .. .. .. ..$ server : chr "Apache"
.. .. .. .. ..$ strict-transport-security : chr "max-age=31536000; includeSubDomains; preload"
.. .. .. .. ..$ referrer-policy : chr "origin-when-cross-origin"
.. .. .. .. ..$ content-security-policy : chr "upgrade-insecure-requests"
.. .. .. .. ..$ cache-control : chr "private"
.. .. .. .. ..$ ncbi-phid : chr "9CAA3345CF9F20E10000000000000001.m_29"
.. .. .. .. ..$ ncbi-sid : chr "07513003CF075801_0000SID"
.. .. .. .. ..$ access-control-allow-methods : chr "POST, GET, PUT, OPTIONS, PATCH, DELETE"
.. .. .. .. ..$ access-control-allow-origin : chr ""
.. .. .. .. ..$ access-control-allow-credentials: chr "true"
.. .. .. .. ..$ access-control-allow-headers : chr "Origin,X-Accept-Charset,X-Accept,Content-Type,X-Requested-With,NCBI-SID,NCBI-PHID"
.. .. .. .. ..$ content-type : chr "text/html"
.. .. .. .. ..$ set-cookie : chr "ncbi_sid=07513003CF075801_0000SID; domain=.nih.gov; path=/; expires=Sun, 07 Jun 2020 05:11:42 GMT"
.. .. .. .. ..$ vary : chr "Accept-Encoding"
.. .. .. .. ..$ content-encoding : chr "gzip"
.. .. .. .. ..$ x-ua-compatible : chr "IE=Edge"
.. .. .. .. ..$ x-xss-protection : chr "1; mode=block"
.. .. .. .. ..$ transfer-encoding : chr "chunked"
.. .. .. .. ..- attr(, "class")= chr [1:2] "insensitive" "list"
.. ..$ cookies :'data.frame': 1 obs. of 7 variables:
.. .. ..$ domain : chr ".nih.gov"
.. .. ..$ flag : logi TRUE
.. .. ..$ path : chr "/"
.. .. ..$ secure : logi FALSE
.. .. ..$ expiration: POSIXct[1:1], format: "2020-06-07 15:11:42"
.. .. ..$ name : chr "ncbi_sid"
.. .. ..$ value : chr "07513003CF075801_0000SID"
.. ..$ content : raw [1:448791] ef bb bf 3c ...
.. ..$ date : POSIXct[1:1], format: "2019-06-07 05:12:34"
.. ..$ times : Named num [1:6] 0 0.000001 0.25 0.735 1.016 ...
.. .. ..- attr(
, "names")= chr [1:6] "redirect" "namelookup" "connect" "pretransfer" ...
.. ..$ request :List of 7
.. .. ..$ method : chr "GET"
.. .. ..$ url : chr "https://www.ncbi.nlm.nih.gov/tools/primer-blast/primertool.cgi?ctg_time=1559884302&job_key=PDbjt7pWt_6QxKHBrKGF89a6lMH7qY_c-g"
.. .. ..$ headers : Named chr "application/json, text/xml, application/xml, /"
.. .. .. ..- attr(, "names")= chr "Accept"
.. .. ..$ fields : NULL
.. .. ..$ options :List of 3
.. .. .. ..$ useragent: chr "libcurl/7.59.0 r-curl/3.3 httr/1.4.0"
.. .. .. ..$ cainfo : chr "C:/PROGRA1/R/R-361.0/etc/curl-ca-bundle.crt"
.. .. .. ..$ httpget : logi TRUE
.. .. ..$ auth_token: NULL
.. .. ..$ output : list()
.. .. .. ..- attr(
, "class")= chr [1:2] "write_memory" "write_function"
.. .. ..- attr(, "class")= chr "request"
.. ..$ handle :Class 'curl_handle'
.. ..- attr(
, "class")= chr "response"
..- attr(, "split_type")= chr "array"
..- attr(
, "split_labels")='data.frame': 1 obs. of 1 variable:
.. ..$ X1: int 1
$ sequence :List of 1000
..$ 1373380155: raw [1:130] 18 28 28 18 ...
..$ 1479554780: raw [1:130] 18 28 28 18 ...
..$ 1479554778: raw [1:130] 18 28 28 18 ...
..$ 1479554776: raw [1:130] 18 28 28 18 ...
..$ 1479554774: raw [1:130] 18 28 28 18 ...
..$ 1074199242: raw [1:130] 18 28 28 18 ...
..$ 1063188923: raw [1:130] 18 28 28 18 ...
..$ 1031987841: raw [1:130] 18 28 28 18 ...
..$ 1031987839: raw [1:130] 18 28 28 18 ...
..$ 1031987837: raw [1:130] 18 28 28 18 ...
..$ 1031987835: raw [1:130] 18 28 28 18 ...
..$ 1031987833: raw [1:130] 18 28 28 18 ...
..$ 1031987831: raw [1:130] 18 28 28 18 ...
..$ 1031987829: raw [1:130] 18 28 28 18 ...
..$ 1031987827: raw [1:130] 18 28 28 18 ...
..$ 1031987825: raw [1:130] 18 28 28 18 ...
..$ 1031987823: raw [1:130] 18 28 28 18 ...
..$ 1031987821: raw [1:130] 18 28 28 18 ...
..$ 1031987819: raw [1:130] 18 28 28 18 ...
..$ 1031987817: raw [1:130] 18 28 28 18 ...
..$ 1031987815: raw [1:130] 18 28 28 18 ...
..$ 1031987813: raw [1:130] 18 28 28 18 ...
..$ 1031987811: raw [1:130] 18 28 28 18 ...
..$ 1031987809: raw [1:130] 18 28 28 18 ...
..$ 1031987807: raw [1:130] 18 28 28 18 ...
..$ 1031987805: raw [1:130] 18 28 28 18 ...
..$ 1031987803: raw [1:130] 18 28 28 18 ...
..$ 1031987801: raw [1:130] 18 28 28 18 ...
..$ 1031987799: raw [1:130] 18 28 28 18 ...
..$ 1031987797: raw [1:130] 18 28 28 18 ...
..$ 1031987795: raw [1:130] 18 28 28 18 ...
..$ 1031987793: raw [1:130] 18 28 28 18 ...
..$ 1031987791: raw [1:130] 18 28 28 18 ...
..$ 1031987789: raw [1:130] 18 28 28 18 ...
..$ 1031987787: raw [1:130] 18 28 28 18 ...
..$ 1031987785: raw [1:130] 18 28 28 18 ...
..$ 1031987783: raw [1:130] 18 28 28 18 ...
..$ 1031987781: raw [1:130] 18 28 28 18 ...
..$ 1031987779: raw [1:130] 18 28 28 18 ...
..$ 1031987777: raw [1:130] 18 28 28 18 ...
..$ 1031987775: raw [1:130] 18 28 28 18 ...
..$ 1031987773: raw [1:130] 18 28 28 18 ...
..$ 1031987771: raw [1:130] 18 28 28 18 ...
..$ 1031987769: raw [1:130] 18 28 28 18 ...
..$ 1031987767: raw [1:130] 18 28 28 18 ...
..$ 1031987765: raw [1:130] 18 28 28 18 ...
..$ 1031987763: raw [1:130] 18 28 28 18 ...
..$ 1031987761: raw [1:130] 18 28 28 18 ...
..$ 1031987759: raw [1:130] 18 28 28 18 ...
..$ 1031987757: raw [1:130] 18 28 28 18 ...
..$ 1031987755: raw [1:130] 18 28 28 18 ...
..$ 1031987753: raw [1:130] 18 28 28 18 ...
..$ 1031987751: raw [1:130] 18 28 28 18 ...
..$ 1031987749: raw [1:130] 18 28 28 18 ...
..$ 1031987747: raw [1:130] 18 28 28 18 ...
..$ 1031987745: raw [1:130] 18 28 28 18 ...
..$ 1031987743: raw [1:130] 18 28 28 18 ...
..$ 1031987741: raw [1:130] 18 28 28 18 ...
..$ 1031987739: raw [1:130] 18 28 28 18 ...
..$ 1031987737: raw [1:130] 18 28 28 18 ...
..$ 1031987735: raw [1:130] 18 28 28 18 ...
..$ 1031987733: raw [1:130] 18 28 28 18 ...
..$ 1031987731: raw [1:130] 18 28 28 18 ...
..$ 1031987729: raw [1:130] 18 28 28 18 ...
..$ 1031987727: raw [1:130] 18 28 28 18 ...
..$ 1031987725: raw [1:130] 18 28 28 18 ...
..$ 1031987723: raw [1:130] 18 28 28 18 ...
..$ 1031987721: raw [1:130] 18 28 28 18 ...
..$ 1031987719: raw [1:130] 18 28 28 18 ...
..$ 1031987717: raw [1:130] 18 28 28 18 ...
..$ 762048423 : raw [1:130] 18 28 28 18 ...
..$ 1622212680: raw [1:130] 18 28 28 18 ...
..$ 1572936898: raw [1:130] 18 28 28 18 ...
..$ 1572936896: raw [1:130] 18 28 28 18 ...
..$ 1572936894: raw [1:130] 18 28 28 18 ...
..$ 1572936892: raw [1:130] 18 28 28 18 ...
..$ 1572936890: raw [1:130] 18 28 28 18 ...
..$ 1572936888: raw [1:130] 18 28 28 18 ...
..$ 1572936886: raw [1:130] 18 28 28 18 ...
..$ 1572936884: raw [1:130] 18 28 28 18 ...
..$ 1572936882: raw [1:130] 18 28 28 18 ...
..$ 1572936880: raw [1:130] 18 28 28 18 ...
..$ 1572936878: raw [1:130] 18 28 28 18 ...
..$ 1572936876: raw [1:130] 18 28 28 18 ...
..$ 1572936874: raw [1:130] 18 28 28 18 ...
..$ 1572936872: raw [1:130] 18 28 28 18 ...
..$ 1572936870: raw [1:130] 18 28 28 18 ...
..$ 1572936868: raw [1:130] 18 28 28 18 ...
..$ 1572936866: raw [1:130] 18 28 28 18 ...
..$ 1572936864: raw [1:130] 18 28 28 18 ...
..$ 1572936862: raw [1:130] 18 28 28 18 ...
..$ 1572936860: raw [1:130] 18 28 28 18 ...
..$ 1572936858: raw [1:130] 18 28 28 18 ...
..$ 1572936856: raw [1:130] 18 28 28 18 ...
..$ 1572936854: raw [1:130] 18 28 28 18 ...
..$ 1572936852: raw [1:130] 18 28 28 18 ...
..$ 1572936850: raw [1:130] 18 28 28 18 ...
..$ 1572936848: raw [1:130] 18 28 28 18 ...
..$ 1572936846: raw [1:130] 18 28 28 18 ...
.. [list output truncated]
..- attr(, "class")= chr "DNAbin"
$ taxonomy :'data.frame': 1000 obs. of 22 variables:
..$ taxId : chr [1:1000] "1001918" "1001919" "1001920" "1001920" ...
..$ gi : chr [1:1000] "1139377037" "1139377051" "772393682" "772393674" ...
..$ species : chr [1:1000] "Platysmacheilus sp. ZF-11739" "Microphysogobio sp. ZF-11935" "Microphysogobio brevirostris" "Microphysogobio brevirostris" ...
..$ superkingdom: chr [1:1000] "Eukaryota" "Eukaryota" "Eukaryota" "Eukaryota" ...
..$ kingdom : chr [1:1000] "Metazoa" "Metazoa" "Metazoa" "Metazoa" ...
..$ phylum : chr [1:1000] "Chordata" "Chordata" "Chordata" "Chordata" ...
..$ subphylum : chr [1:1000] "Craniata" "Craniata" "Craniata" "Craniata" ...
..$ superclass : chr [1:1000] "Actinopterygii" "Actinopterygii" "Actinopterygii" "Actinopterygii" ...
..$ class : chr [1:1000] "Actinopteri" "Actinopteri" "Actinopteri" "Actinopteri" ...
..$ subclass : chr [1:1000] "Neopterygii" "Neopterygii" "Neopterygii" "Neopterygii" ...
..$ infraclass : chr [1:1000] "Teleostei" "Teleostei" "Teleostei" "Teleostei" ...
..$ cohort : chr [1:1000] "Otomorpha" "Otomorpha" "Otomorpha" "Otomorpha" ...
..$ subcohort : chr [1:1000] "Ostariophysi" "Ostariophysi" "Ostariophysi" "Ostariophysi" ...
..$ superorder : chr [1:1000] "Cypriniphysae" "Cypriniphysae" "Cypriniphysae" "Cypriniphysae" ...
..$ order : chr [1:1000] "Cypriniformes" "Cypriniformes" "Cypriniformes" "Cypriniformes" ...
..$ suborder : chr [1:1000] "Cyprinoidei" "Cyprinoidei" "Cyprinoidei" "Cyprinoidei" ...
..$ family : chr [1:1000] "Cyprinidae" "Cyprinidae" "Cyprinidae" "Cyprinidae" ...
..$ genus : chr [1:1000] "Platysmacheilus" "Microphysogobio" "Microphysogobio" "Microphysogobio" ...
..$ subfamily : chr [1:1000] NA NA NA NA ...
..$ subspecies : chr [1:1000] NA NA NA NA ...
..$ superfamily : chr [1:1000] NA NA NA NA ...
..$ infraorder : chr [1:1000] NA NA NA NA ...
$ tree :List of 4
..$ edge : int [1:1997, 1:2] 1001 1001 1001 1002 1003 1004 1005 1006 1007 1008 ...
..$ edge.length: num [1:1997] 0 0 0 0 0 0 0 0 0 0 ...
..$ tip.label : chr [1:1000] "1373380155" "1479554780" "1479554778" "1479554776" ...
..$ Nnode : int 998
..- attr(
, "class")= chr "phylo"
..- attr(*, "order")= chr "cladewise"

  • attr(*, "class")= chr "primerTree"

Any ideas as to what I am doing wrong? any help is greatly appreciated

Thank you

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

1 participant