EcoJulia / Microbiome.jl

For analysis of microbiome and microbial community data
Other
48 stars 10 forks source link

Add function to join community profiles #58

Closed kescobo closed 3 years ago

kescobo commented 3 years ago

Add function to join community profiles

Types of changes

This PR implements the following changes: (Please tick any or all of the following that are applicable)

:ballot_box_with_check: Checklist

@annelle-abatoni - This should be helpful with reading in a bunch of individual metaphlan tables

julia> mss = [MicrobiomeSample("sample\$i") for i in 1:15];

julia> txs = [Taxon("taxon\$i") for i in 1:20];

julia> cm1 = CommunityProfile(spzeros(10,5), txs[1:10], mss[1:5])
CommunityProfile{Float64, Taxon, MicrobiomeSample} with 10 things in 5 places

Thing names:
taxon1, taxon2, taxon3...taxon9, taxon10

Place names:
sample1, sample2, sample3, sample4, sample5

julia> cm2 = CommunityProfile(spzeros(10,5), txs[6:15], mss[6:10])
CommunityProfile{Float64, Taxon, MicrobiomeSample} with 10 things in 5 places

Thing names:
taxon6, taxon7, taxon8...taxon14, taxon15

Place names:
sample6, sample7, sample8, sample9, sample10

julia> cm3 = CommunityProfile(spzeros(10,5), txs[11:20], mss[11:15])
CommunityProfile{Float64, Taxon, MicrobiomeSample} with 10 things in 5 places

Thing names:
taxon11, taxon12, taxon13...taxon19, taxon20

Place names:
sample11, sample12, sample13, sample14, sample15

julia> commjoin(cm1, cm2, cm3)
CommunityProfile{Float64, Taxon, MicrobiomeSample} with 20 things in 15 places

Thing names:
taxon1, taxon2, taxon3...taxon19, taxon20

Place names:
sample1, sample2, sample3...sample14, sample15
kescobo commented 3 years ago

This function could probably use a better name, but I'll leave it for now/