Question: Uneven Datasets Deseq2 how to fix factor(rep(c("A","B"),each=3))?
0
gravatar for williamsbrian5064
11 months ago by
williamsbrian5064150 wrote:

I have a set of data that consists of 4 controls samples and 2 affected samples. I am trying to use Deseq2 for some DE but I am running into an issue. I have been successful working with Deseq2 in the past, but I have always had equal data sets. I have pretty much have been following along through the Deseq2 tutorial here. I figured out where my issue is. There is a line that says

library("tximport")
library("readr")
library("tximportData")
dir <- system.file("extdata", package="tximportData")
samples <- read.table(file.path(dir,"samples.txt"), header=TRUE)
samples$condition <- factor(rep(c("A","B"),each=3))
rownames(samples) <- samples$run
samples[,c("pop","center","run","condition")]

The line that is giving me all the issues is

samples$condition <- factor(rep(c("A","B"),each=3))

It is assume that I have two group and each group contains 3 samples. Even when I take away the "each=3", it still just assumes there are two group with 3 samples in each group. What I really have is two groups, group A containing 4 samples and group B containing 2 samples.

Is there a way to fix this? I know people work with uneven datasets all the time so I hope this is an easy fix.

assembly rna-seq next-gen R • 296 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by williamsbrian5064150
3
gravatar for h.mon
11 months ago by
h.mon24k
Brazil
h.mon24k wrote:
samples$condition <- factor( c( "A","A","A","A","B","B" ) )
ADD COMMENTlink modified 11 months ago • written 11 months ago by h.mon24k

BOOM! Worked like a charm. Thank you very very much for your help.

ADD REPLYlink written 11 months ago by williamsbrian5064150
1

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

ADD REPLYlink modified 11 months ago • written 11 months ago by genomax64k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1819 users visited in the last hour