Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 9f7b6d4e450c337560b4a6df9198aa74c9be01b9 authored by Vladislav Kamenev on 07 August 2018, 09:41:33 UTC, committed by GitHub on 07 August 2018, 09:41:33 UTC
Merge pull request #85 from ctlab/develop
Develop
2 parent s d144ef5 + 39a8be5
  • Files
  • Changes
  • 1494e59
  • /
  • tests
  • /
  • testthat
  • /
  • testloadGEO.R
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:9f7b6d4e450c337560b4a6df9198aa74c9be01b9
directory badge Iframe embedding
swh:1:dir:6eed3189f9d1c16a526fe8e444591639d89ee4c3
content badge Iframe embedding
swh:1:cnt:8e9202c1f4d41792547bc91f12111d3418fa2bca
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
testloadGEO.R
context("Load GEO and its utils")
library(jsonlite)
library(Biobase)
library(data.table)

test_that("loadGEO finishes with result", {
    options(phantasusMirrorPath = "https://genome.ifmo.ru/files/software/phantasus")

    x <- loadGEO("GSE27112")
    expect_is(x, "json")

    ess <- protolite::unserialize_pb(readBin(fromJSON(x), what="raw", n=100000000))

    expect_equal(length(ess), 2)

    x <- loadGEO("GSE27112-GPL6885")
    expect_is(x, "json")

    ess <- protolite::unserialize_pb(readBin(fromJSON(x), what="raw", n=100000000))

    expect_equal(length(ess), 1)

    expect_is(loadGEO("GSE14308"), "json")
    expect_is(loadGEO("GDS4885"), "json")

    expect_error(loadGEO("WRONGNAME"))

    options(phantasusMirrorPath = NULL)
})

test_that("reparseCachedGSEs works", {
    cacheDir <- tempdir()
    getES("GSE14308", destdir = cacheDir)
    expect_true("GSE14308" %in% reparseCachedESs(destdir = cacheDir))
})

test_that("checkGPLs counts gpls correctly", {
    options(phantasusMirrorPath = "https://genome.ifmo.ru/files/software/phantasus")

    expect_equal(fromJSON(checkGPLs("GSE14308")), c("GSE14308"))
    expect_equal(fromJSON(checkGPLs("GDS4885")), c("GDS4885"))
    expect_length(fromJSON(checkGPLs("GSE27112")), 2)
    expect_length(fromJSON(checkGPLs("GSE10000")), 2)
    expect_warning(checkGPLs("GSE101"))
    expect_warning(checkGPLs("GSE201"))

    options(phantasusMirrorPath = NULL)
})

test_that("checkGPLs counts existing files correctly without connection", {
    options(phantasusMirrorPath = "https://notworkingdomain",
            phantasusCacheDir = system.file("testdata", package="phantasus"))

    expect_message(checkGPLs("GSE27112"), regexp = "Problems establishing connection")
    expect_length(fromJSON(checkGPLs("GSE27112")), 1)
    expect_warning(checkGPLs("GSE14308"))

    options(phantasusCacheDir = NULL,
            phantasusMirrorPath = NULL)
})

test_that("getGSE works with ARCHS4", {
    ess <- getGSE("GSE99709", destdir=system.file("testdata", package="phantasus"))
    expect_gt(nrow(ess[[1]]), 0)
    expect_gt(ncol(ess[[1]]), 0)
})

test_that("InferConditionImpl  works correctly", {
    tests <- fread(system.file("testdata/dts.tsv", package="phantasus"))
    test_ds <- data.table(title=tests$Title, series=tests$Series, accession=tests$Accession, rep=tests$Replicate, inferCondition=tests$InferCondition)
    cond <- split(test_ds$title, test_ds$series)
    inf_cond_test <- split(test_ds$inferCondition, test_ds$series)
    rep_test <- split(test_ds$rep, test_ds$series)
    new_cond <- lapply(cond, inferConditionImpl)
    expect_equal(new_cond$GSE100221, list()) # text in all titles is unique
    expect_equal(new_cond$GSE10380, list())  # long dataset
    expect_equal(new_cond$GSE10382, list())  # number-only titles
    expect_equal(new_cond$GSE10383, list())  # two-color datasets
    expect_equal(new_cond$GSE10385, list())  # the same text and replicate number in all titles
    expect_equal(new_cond$GSE10039, list())  # ambiguous replicate number "High_Mo_seg_pool_Ler_col_F2" "Low_Mo_seg_pool_Ler_col_F2"  "Col-0 3"
    expect_equal(new_cond$GSE101508$condition, inf_cond_test$GSE101508) #"IFNγ+LPS rep2" -> "IFNγ+LPS" + "2"
    expect_equal(new_cond$GSE101508$replicate, as.character(rep_test$GSE101508))
    expect_equal(new_cond$GSE10392$condition, inf_cond_test$GSE10392) # "MPA 1" - > "MPA" + "1"
    expect_equal(new_cond$GSE10392$replicate, as.character(rep_test$GSE10392))
    expect_equal(new_cond$GSE10123$condition, inf_cond_test$GSE10123) # "WT-GFP-lamin A Induction: Day 0 Replicate A" -> "WT-GFP-lamin A Induction: Day 0" + "A"
    expect_equal(new_cond$GSE10123$replicate, as.character(rep_test$GSE10123))


})

The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API