Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about the SCDataset class #55

Open
ChaozhongLiu opened this issue May 14, 2024 · 0 comments
Open

Question about the SCDataset class #55

ChaozhongLiu opened this issue May 14, 2024 · 0 comments

Comments

@ChaozhongLiu
Copy link

Hi there,

Thanks for the amazing work! When I was reading the source code, I got one question in mind and couldn't find an answer myself. It will great if any of you can help!

So in the SCDataset class, when a single cell is being sampled, why it appends a 0 at the end of the gene expression vector?

class SCDataset(Dataset):
    def __init__(self, data):
        super().__init__()
        self.data = data

    def __getitem__(self, index):
        rand_start = random.randint(0, self.data.shape[0]-1)
        full_seq = self.data[rand_start].toarray()[0]
        full_seq[full_seq > (CLASS - 2)] = CLASS - 2
        full_seq = torch.from_numpy(full_seq).long()
        ############################################################
        full_seq = torch.cat((full_seq, torch.tensor([0]))).to(device)
        ############################################################

        return full_seq

    def __len__(self):
        return self.data.shape[0]

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant