rr1859 / R.4Cker

MIT License
16 stars 15 forks source link

error when running nearbaitanalysis #3

Open yangruialex opened 8 years ago

yangruialex commented 8 years ago

I was able to generate the required bedGraph files and successfully create the R4Cker object. However when I run the nearbaitanalysis I get error message below:

[1] "Building adaptive windows..." Error in coord[i] - coord[(i - k)] : non-numeric argument to binary operator

Could you help me with this? Thanks!

rr1859 commented 8 years ago

Hi,

Can you send me your code to create the 4C-ker object?

yangruialex commented 8 years ago

Here it is:

my_obj = createR4CkerObjectFromFiles(files = c("Caco2_CFTR_pro_2014_May_aligned_sorted_rm.bedGraph","Caco2_CFTR_pro_2014_Oct_aligned_sorted_rm.bedGraph"),bait_chr="chr12",bait_coord= 117120597,bait_name = "CFTR_pro",primary_enz = "CATG",samples = c("Caco2_May", "Caco2_Oct"),conditions = "CFTR_pro",replicates = 2,species = "hg",output_dir = "Caco2_CFTR_pro_results/")

rr1859 commented 8 years ago

what k are you using? and have you looked at the stats file to see if your samples have at 1 million reads and at least 40% of the reads on cis?

yangruialex commented 8 years ago

I tried 3,5, and 10 and got the same error message. I attached my stats file. It looks like one of my replicates has too few reads and the other has less than 40% of reads on cis. Is that why I get the error message? CFTR_pro_stats.txt

rr1859 commented 8 years ago

The values are still close to what is expected. I would also check the coverage in the 200kb window around the bait to make sure its greater than 40%. Its not obvious from the file name but did you remove the undigested and self-ligated fragments? I havnt seen this error before but I think it might have to do with the coverage.

yangruialex commented 8 years ago

Yes I did remove the undigested and self-ligated fragments. I tried again with another pair of replicates that are better in quality but got the same error. Here is the command line:

my_obj_2 = createR4CkerObjectFromFiles(files = c("bait1_aligned_rm_self_und.bedGraph","bait2_aligned_rm_self_und.bedGraph"),bait_chr="chr7",bait_coord= 117120597,bait_name = "CFTR_pro",primary_enz = "CATG",samples = c("rep1", "rep2"),conditions = "CFTR_pro",replicates = 2,species = "hg",output_dir = "Caco2_ctr_CFTR_pro_results/")

nb_results=nearBaitAnalysis(my_obj_2,k=3) [1] "Building adaptive windows..." Error in coord[i] - coord[(i - k)] : non-numeric argument to binary operator

I attached the stats file as well as the bedgraph files.

CFTR_pro_results.zip

I am pretty sure the coverage should be OK. I have ran these data through 4cseqpipe and the resulting figures look as expected.

Thanks for your help!

rr1859 commented 8 years ago

thanks for sending me your files. Since you have the chrUn in the bedGraph file, which have 'gl' in the coordinates, it was reading the coordinates column as a string and therefore could not do the subtraction. I removed those chromosomes and tried running the nearBaitAnalysus and it works fine. I will add a note in the README file - thanks!

yangruialex commented 8 years ago

It works! Thank you so much!

quzhouxiachuan commented 8 years ago

my bedGraph have string coordinate as such: chr17 ctg5 hap1 178 chr17 ctg5 hap1 1 chr17 ctg5 hap1 1 chr17 ctg5 hap1 1 chr17 ctg5 hap1 142 chr17 ctg5 hap1 8 chr17 ctg5 hap1 2

Do I delete them?

Thanks!

rr1859 commented 8 years ago

Yes please remove those.