Hi all, 

I have RNA-Seq time-series data generated by HTseq counts. There are sort of 2 replicates. The First replicate has 4 time point samples(day0,2,5,14), while the Second has 5 time point samples(day0,2,5,15,30). The data was loaded as a read.table matrix in R. 
The following is the script used:

    setwd("Downloads")
    df_A <- read.table(file='Replicate_sample_Raw_RPM_counts-2',header=T,sep='\t')
    df_B <- read.table(file='HT-seq_counts.txt-2',header=T,sep='\t')
    merged_df <- merge(df_A,df_B,by='geneID')
    write.table(merged_df,file='merged_count.txt',row.names=F,quote=F,sep='\t')
    counts<-read.csv("merged_count.txt",header=T,sep="\t")
    data<-counts[-1]
    rlog(data)

head(data)

      day0.x day2.x day5.x day14 day0.y day2.y day5.y day15 day30
    1    358    422    241   617    145    508    389   357   594
    2     11     31     44    26      8     24     41    49    49
    3      7      3     33   392      2      5     25   159   155
    4     26     45     74  5624     45    175     94  4604 14238
    5      4     10     66   338     19     13     70   229   242
    6    477    138     64    21    747    507     98    25    22

But when I try to to run rlog or rlogTransformation I get the following error: 

    Error in (function (classes, fdef, mtable)  : 
      unable to find an inherited method for function ‘sizeFactors’ for signature ‘"data.frame"’

How can I improve the script to make rlog run so that I can have my HT-seq counts normalized?
I would highly recommend you read the [DESeq2 vignette][1].


You first need to create a design matrix. This will be a 3 columned table, where each row represents a replicate, and each column represents, time, donor/sample, and treatment (If you have control replicates. If all samples are treated with the same stimulation (i.e. no controls), then you don't need a column for it.).

You can proceed to create a DESeq data object (your data is currently a "raw matrix") from your count table and your design table.

    dds<-DESeqDataSetFromMatrix(data, design, ~ time + sample + treatment)

Your design formula needs to take into account your time points as well as the two replicated samples.

Then, estimate the size factors (partial cause of the error message), and proceed to rlog the data-set

    norm<-estimateSizeFactors(dds) 
    expr<-rlog(norm)


Also, you might want to look into VST normalizing your data (run it with the blind parameter = FALSE). VST normalization takes into account your experimental design when normalizing. You might want to remove the 30 day time point replicate, this will make your time-course data-set more even. 

  [1]: https://www.bioconductor.org/packages/3.3/bioc/vignettes/DESeq2/inst/doc/DESeq2.pdf