I want to analyze RNA seq data using R package cummeRbund. Using this package I have a problem changing sample names. When I run this command in cummeRbund

sample_index sample_name sample_name parameter value
1            1          q1        <NA>      <NA>  <NA>
2            2          q2        <NA>      <NA>  <NA>
3            3          q3        <NA>      <NA>  <NA>
4            4          q4        <NA>      <NA>  <NA>
5            5          q5        <NA>      <NA>  <NA>

It shows q1,q2,q3,q4 and q5 as sample names for the five samples but I want to change the sample names and put following names for the samples Batis, Blue_silver, Chakwal_50, Local_white and Syn_22 for q1,q2,q3,q4 ad q5 respectively. To accomplish this I ran following command:

> samples(cuff) <- c("Batis", "Blue_silver","Chakwal_50","Local_white","Syn_22")
Error in samples(cuff) <- c("Batis", "Blue_silver", "Chakwal_50", "Local_white",  : 
could not find function "samples<-"

but this command gave error as shown above.

Also the BAM files have same names for all the samples as mentioned above.

How could I change the sample names to desired names in R using cummeRbund?

Or I need to re-run cuffdiff and change the names somewhere else?


1 Answer 1


Don't know which file was used by cummeRbund for sample names but replacing q1,q2,q3 and q4 with Batis, Blue_silver, Chakwal_50 and Syn_22 for all the files in the directory containing cuffdiff output worked for me.

I used sed language for this as shown below:

sed -i 's/q4/Syn_22/g' *

Or more generally you can use

sed -i 's/sample_name_shown/sample_name_to_change/g' *

After that I deleted the sqlite object created by cummeRbund and again created this object using readCufflinks() in R. This time sample names are changed as desired:

sample_index sample_name sample_name parameter value
1            1       Batis        <NA>      <NA>  <NA>
2            2 Blue_silver        <NA>      <NA>  <NA>
3            3  Chakwal_50        <NA>      <NA>  <NA>
4            4      Syn_22        <NA>      <NA>  <NA>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.