Skip to content

Issue with Startrac.run(): dcast Error in pIndex.migr Calculation #14

@s4rivera

Description

@s4rivera

Hello! I am really looking forward to using your very exciting tool!

Currently I am having the following issue with my data which I confirmed when trying to reproduce your vignette:
https://htmlpreview.github.io/?https://github.com/Japrin/STARTRAC/blob/master/vignettes/startrac.html

I am encountering an issue when trying to run Startrac.run() using the provided example dataset (example.cloneDat.Zhang2018.txt). The pipeline fails during the pairwise index calculation with an error related to dcast from data.table.

System Information:

R version: 4.4.2 (2024-10-31)
Startrac version: 0.1.0
data.table version: 1.17.0
Reproducible Example:
I followed the Startrac vignette and ran the following minimal script:

library(Startrac)
library(data.table)
library(dplyr)

Define file path

file_path <- "example.cloneDat.Zhang2018.txt"

Read the file

in.dat <- fread(file_path, stringsAsFactors = FALSE, header = TRUE)

Run Startrac pipeline

tic("Startrac.run")
out <- Startrac.run(in.dat, proj="CRC", verbose=F)
Error Message:

[2025-03-17 16:34:42.528854] initialize Startrac ...
[2025-03-17 16:34:42.557158] calculate startrac index ...
[2025-03-17 16:34:42.577406] calculate pairwise index ...

Error in dcast(cls.migr.index.df, majorCluster ~ crossLoc, value.var = "pIndex.migr") : The dcast generic in data.table has been passed a data.frame, but data.table::dcast currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(cls.migr.index.df) or as.data.table(cls.migr.index.df). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.

What I’ve Tried:

Confirmed that the input dataset is correctly formatted
Verified column names match expected names (Cell_Name, clone.id, patient, majorCluster, loc).
Checked the class of cls.migr.index.df
It appears to be a data.frame, but dcast() expects a data.table.
Tried setDT(cls.migr.index.df) before running pIndex(), but it did not resolve the issue.
Tried running pIndex(obj) separately, same error persists.
This issue persists even when using the example dataset. Is there a known fix for this, or should Startrac.run() be handling this conversion internally? Any help would be appreciated!

Thanks so much!

Sam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions