Question: Uneven Datasets Deseq2 how to fix factor(rep(c("A","B"),each=3))?
0
gravatar for williamsbrian5064
2.2 years ago by
williamsbrian5064250 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 • 577 views
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by williamsbrian5064250
3
gravatar for h.mon
2.2 years ago by
h.mon30k
Brazil
h.mon30k wrote:
samples$condition <- factor( c( "A","A","A","A","B","B" ) )
ADD COMMENTlink modified 2.2 years ago • written 2.2 years ago by h.mon30k

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

ADD REPLYlink written 2.2 years ago by williamsbrian5064250
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 2.2 years ago • written 2.2 years ago by genomax86k
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: 1572 users visited in the last hour