Skip to content

Commit

Permalink
Add tests and CI (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
kescobo authored Oct 5, 2017
1 parent fb1abaa commit eb89479
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ notifications:
git:
depth: 99999999

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - julia: nightly
# uncomment the following lines to allow failures on nightly julia
# (tests will run but not make your overall status red)
matrix:
allow_failures:
- julia: nightly

## uncomment and modify the following lines to manually install system packages
#addons:
Expand All @@ -25,8 +25,8 @@ git:
#before_script: # homebrew for mac
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi

## uncomment the following lines to override the default test script
#script:
# # uncomment the following lines to override the default test script
# script:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("Microbiome"); Pkg.test("Microbiome"; coverage=true)'
after_success:
# push coverage results to Coveralls
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/kescobo/Microbiome.jl.svg?branch=master)](https://travis-ci.org/kescobo/Microbiome.jl)

# Microbiome-related methods for julia

This package provides (or will provide) methods for microbial community
Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ julia 0.6-
RecipesBase
Distances
DataFrames
IterTools
MultivariateStats
Clustering
Colors
5 changes: 2 additions & 3 deletions src/Microbiome.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ export
getrowdm,
pcoa,
eigenvalue,
principalcoord
principalcoord,
relativeabundance

using BioSequences
using RecipesBase
using Distances
using IterTools
using Colors

using DataFrames: DataFrame
Expand Down
2 changes: 1 addition & 1 deletion src/abundances.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function relativeabundance(a::AbundanceTable; kind::Symbol=:fraction)
kind == :percent ? relab = relab .* 100 : true

return AbundanceTable(
reshape([a[x,i] / sum(a[:,i]) for i in 1:size(a, 2) for x in 1:size(a, 1) ], size(a, 1), size(a, 2)),
reshape(relab, size(a, 1), size(a, 2)),
a.samples,
a.features)
end
10 changes: 8 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microbiome
using Distances
using Base.Test

@testset "Abundances" begin
Expand All @@ -12,10 +13,11 @@ using Base.Test

@test typeof(relab_fract) <: AbundanceTable
@test typeof(relab_perc) <: AbundanceTable
@test typeof(relab_filt) <: AbundanceTable
@test typeof(filt) <: AbundanceTable

@test size(abund) == (100, 10)
@test size(relab_fract) == (100, 10)
@test size(relab_perc) == (100, 10)
@test size(filt) == (6, 10)

for i in 1:10
Expand All @@ -28,7 +30,11 @@ using Base.Test
end

@testset "Distances" begin
dm = getdm(abund, BrayCurtis())
abund = AbundanceTable(
rand(100, 10), ["sample_$x" for x in 1:10],
["feature_$x" for x in 1:100])

dm = getdm(abund, Jaccard()) # TODO: change to BrayCurtis after PR merges in Distances.jl
p = pcoa(dm, correct_neg=true)

@test size(dm) == (10, 10)
Expand Down

0 comments on commit eb89479

Please sign in to comment.