Entering edit mode
2.1 years ago
rishav513
▴
30
Hi,
I am analyzing my data in R using the phyloseq package, but one thing I am unable to understand while performing this task.
> samples.out <- rownames(otu)
> rownames(sam) <- samples.out
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length
After assigning "samples.out", the value of "rownames(otu)" , the output of "samples.out" is like this :
[1] "ASV_1" "ASV_2" "ASV_3" "ASV_4" "ASV_5" "ASV_6"
[7] "ASV_7" "ASV_8" "ASV_9" "ASV_10" "ASV_11" "ASV_12"
[13] "ASV_13" "ASV_14" "ASV_15" "ASV_16" "ASV_17" "ASV_18"
[19] "ASV_19" "ASV_20" "ASV_21" "ASV_22" "ASV_23" "ASV_24"
[25] "ASV_25" "ASV_26" "ASV_27" "ASV_28" "ASV_29" "ASV_30"
[31] "ASV_31" "ASV_32" "ASV_33" "ASV_34" "ASV_35" "ASV_36"
[37] "ASV_37" "ASV_38" "ASV_39" "ASV_40" "ASV_41" "ASV_42"
[43] "ASV_43" "ASV_44" "ASV_45" "ASV_46" "ASV_47" "ASV_48"
[49] "ASV_49" "ASV_50" "ASV_51" "ASV_52" "ASV_53" "ASV_54"
[55] "ASV_55" "ASV_56" "ASV_57" "ASV_58" "ASV_59" "ASV_60"
[61] "ASV_61" "ASV_62" "ASV_63" "ASV_64" "ASV_65" "ASV_66"
[67] "ASV_67" "ASV_68" "ASV_69" "ASV_70" "ASV_71" "ASV_72"
[73] "ASV_73" "ASV_74" "ASV_75" "ASV_76" "ASV_77" "ASV_78"
[79] "ASV_79" "ASV_80" "ASV_81" "ASV_82" "ASV_83" "ASV_84"
[85] "ASV_85" "ASV_86" "ASV_87" "ASV_88" "ASV_89" "ASV_90"
[91] "ASV_91" "ASV_92" "ASV_93" "ASV_94" "ASV_95" "ASV_96"
[97] "ASV_97" "ASV_98" "ASV_99" "ASV_100" "ASV_101" "ASV_102"
[103] "ASV_103" "ASV_104" "ASV_105" "ASV_106" "ASV_107" "ASV_108"
[109] "ASV_109" "ASV_110" "ASV_111" "ASV_112" "ASV_113" "ASV_114"
[115] "ASV_115" "ASV_116" "ASV_117" "ASV_118" "ASV_119" "ASV_120"
[121] "ASV_121" "ASV_122" "ASV_123" "ASV_124" "ASV_125" "ASV_126"
[127] "ASV_127" "ASV_128" "ASV_129" "ASV_130" "ASV_131" "ASV_132"
[133] "ASV_133" "ASV_134" "ASV_135" "ASV_136" "ASV_137" "ASV_138"
[139] "ASV_139" "ASV_140" "ASV_141" "ASV_142" "ASV_143" "ASV_144"
[145] "ASV_145" "ASV_146" "ASV_147" "ASV_148" "ASV_149" "ASV_150"
[151] "ASV_151" "ASV_152" "ASV_153" "ASV_154" "ASV_155" "ASV_156"
[157] "ASV_157" "ASV_158" "ASV_159" "ASV_160" "ASV_161" "ASV_162"
[163] "ASV_163" "ASV_164" "ASV_165" "ASV_166" "ASV_167" "ASV_168"
[169] "ASV_169" "ASV_170" "ASV_171" "ASV_172" "ASV_173" "ASV_174"
[175] "ASV_175" "ASV_176" "ASV_177" "ASV_178" "ASV_179" "ASV_180"
[181] "ASV_181" "ASV_182" "ASV_183" "ASV_184" "ASV_185" "ASV_186"
[187] "ASV_187" "ASV_188" "ASV_189" "ASV_190" "ASV_191" "ASV_192"
[193] "ASV_193" "ASV_194" "ASV_195" "ASV_196" "ASV_197" "ASV_198"
[199] "ASV_199" "ASV_200" "ASV_201" "ASV_202" "ASV_203" "ASV_204"
[205] "ASV_205" "ASV_206" "ASV_207" "ASV_208" "ASV_209" "ASV_210"
[211] "ASV_211" "ASV_212" "ASV_213" "ASV_214" "ASV_215" "ASV_216"
[217] "ASV_217" "ASV_218" "ASV_219" "ASV_220" "ASV_221" "ASV_222"
[223] "ASV_223" "ASV_224" "ASV_225" "ASV_226" "ASV_227" "ASV_228"
[229] "ASV_229" "ASV_230" "ASV_231" "ASV_232" "ASV_233" "ASV_234"
[235] "ASV_235" "ASV_236" "ASV_237" "ASV_238" "ASV_239" "ASV_240"
[241] "ASV_241" "ASV_242" "ASV_243" "ASV_244" "ASV_245" "ASV_246"
[247] "ASV_247" "ASV_248" "ASV_249" "ASV_250" "ASV_251" "ASV_252"
[253] "ASV_253" "ASV_254" "ASV_255" "ASV_256" "ASV_257" "ASV_258"
[259] "ASV_259" "ASV_260" "ASV_261" "ASV_262" "ASV_263" "ASV_264"
[265] "ASV_265" "ASV_266" "ASV_267" "ASV_268" "ASV_269" "ASV_270"
[271] "ASV_271" "ASV_272" "ASV_273" "ASV_274" "ASV_275" "ASV_276"
[277] "ASV_277" "ASV_278" "ASV_279" "ASV_280" "ASV_281" "ASV_282"
[283] "ASV_283" "ASV_284" "ASV_285" "ASV_286" "ASV_287" "ASV_288"
[289] "ASV_289" "ASV_290" "ASV_291" "ASV_292" "ASV_293" "ASV_294"
[295] "ASV_295" "ASV_296" "ASV_297" "ASV_298" "ASV_299" "ASV_300"
[301] "ASV_301" "ASV_302" "ASV_303" "ASV_304" "ASV_305" "ASV_306"
[307] "ASV_307" "ASV_308" "ASV_309" "ASV_310" "ASV_311" "ASV_312"
[313] "ASV_313" "ASV_314" "ASV_315" "ASV_316" "ASV_317" "ASV_318"
[319] "ASV_319" "ASV_320" "ASV_321" "ASV_322" "ASV_323" "ASV_324"
[325] "ASV_325" "ASV_326" "ASV_327" "ASV_328" "ASV_329" "ASV_330"
[331] "ASV_331" "ASV_332" "ASV_333" "ASV_334" "ASV_335" "ASV_336"
[337] "ASV_337" "ASV_338" "ASV_339" "ASV_340" "ASV_341" "ASV_342"
[343] "ASV_343" "ASV_344" "ASV_345" "ASV_346" "ASV_347" "ASV_348"
[349] "ASV_349" "ASV_350" "ASV_351" "ASV_352" "ASV_353" "ASV_354"
[355] "ASV_355" "ASV_356" "ASV_357" "ASV_358" "ASV_359" "ASV_360"
[361] "ASV_361" "ASV_362" "ASV_363" "ASV_364" "ASV_365" "ASV_366"
[367] "ASV_367" "ASV_368" "ASV_369" "ASV_370" "ASV_371" "ASV_372"
[373] "ASV_373" "ASV_374" "ASV_375" "ASV_376" "ASV_377" "ASV_378"
[379] "ASV_379" "ASV_380" "ASV_381" "ASV_382" "ASV_383" "ASV_384"
[385] "ASV_385" "ASV_386" "ASV_387" "ASV_388" "ASV_389" "ASV_390"
[391] "ASV_391" "ASV_392" "ASV_393" "ASV_394" "ASV_395" "ASV_396"
[397] "ASV_397" "ASV_398" "ASV_399" "ASV_400" "ASV_401" "ASV_402"
[403] "ASV_403" "ASV_404" "ASV_405" "ASV_406" "ASV_407" "ASV_408"
[409] "ASV_409" "ASV_410" "ASV_411" "ASV_412" "ASV_413" "ASV_414"
[415] "ASV_415" "ASV_416" "ASV_417" "ASV_418" "ASV_419" "ASV_420"
[421] "ASV_421" "ASV_422" "ASV_423" "ASV_424" "ASV_425" "ASV_426"
[427] "ASV_427" "ASV_428" "ASV_429" "ASV_430" "ASV_431" "ASV_432"
[433] "ASV_433" "ASV_434" "ASV_435" "ASV_436" "ASV_437" "ASV_438"
[439] "ASV_439" "ASV_440" "ASV_441" "ASV_442" "ASV_443" "ASV_444"
[445] "ASV_445" "ASV_446" "ASV_447" "ASV_448" "ASV_449" "ASV_450"
[451] "ASV_451" "ASV_452" "ASV_453" "ASV_454" "ASV_455" "ASV_456"
[457] "ASV_457" "ASV_458" "ASV_459" "ASV_460" "ASV_461" "ASV_462"
[463] "ASV_463" "ASV_464" "ASV_465" "ASV_466" "ASV_467" "ASV_468"
[469] "ASV_469" "ASV_470" "ASV_471" "ASV_472" "ASV_473" "ASV_474"
[475] "ASV_475" "ASV_476" "ASV_477" "ASV_478" "ASV_479" "ASV_480"
[481] "ASV_481" "ASV_482" "ASV_483" "ASV_484" "ASV_485" "ASV_486"
[487] "ASV_487" "ASV_488" "ASV_489" "ASV_490" "ASV_491" "ASV_492"
[493] "ASV_493" "ASV_494" "ASV_495" "ASV_496" "ASV_497" "ASV_498"
[499] "ASV_499" "ASV_500" "ASV_501" "ASV_502" "ASV_503" "ASV_504"
And the output of "rownames(sam)" is
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"
[13] "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24"
[25] "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36"
[37] "37" "38" "39" "40" "41" "42" "43" "44" "45" "46" "47" "48"
[49] "49" "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "60"
[61] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72"
[73] "73" "74" "75" "76" "77" "78" "79" "80" "81" "82" "83" "84"
[85] "85" "86" "87" "88" "89" "90" "91" "92" "93" "94" "95" "96"
[97] "97" "98" "99" "100" "101" "102" "103" "104" "105" "106" "107" "108"
[109] "109" "110" "111" "112" "113" "114" "115" "116"
please help me.
Just run
length(rownames(sam))
andlength(sample.out)
and you will see what the problem is.Yaa, I know this is problem but is there any way to solve this problem ?
We don't have any idea of what you are doing, as you didn't show much code, nor described in detail the analyses you are performing. Why the lengths differ? Did you perform some kind of ASV filtering or clustering?
As a extreme example, you could be trying to transfer the ASV names from one experiment (like microbiome from human gut) to another completely different experiment (microbiome from soil).
What exactly is your intention? What are the
sam
andotu
objects?OTU is the output of dada2 that contains ASV information, here is an overview of the file:
and sam contains metadata information, here is an overview of the file
I want to merge my data using this command :
for alpha diversity analysis
Why
taxa_are_rows=FALSE
if you taxa are rows?Actually, I am following standard workflow to construct a phyloseq object directly from the dada2 outputs, and in that workflow, this code was written for constructing a phyloseq object.
Here, otu contains count values, sam contains metadata information of the sample and taxa contains taxonomical information. I think "taxa_are_rows=FALSE" is kept so that only count values of otu would be considered.