molgenis / NIPTeR

R Package for Non Invasive Prenatal Testing (NIPT) analysis
GNU Lesser General Public License v3.0
40 stars 16 forks source link

BAM file appears to be unsorted .. #12

Open chantisakee opened 6 years ago

chantisakee commented 6 years ago

Hi,

I'm starting to run NIPTeR but there're errors after running this command..

control_group <- as_control_group(nipt_samples = lapply(X = bam_filepaths, bin_bam_sample, do_sort = F, separate_strands = FALSE))

Loading Bam BAM loaded Binning Error: BAM file appears to be unsorted

------ so I chose " do_sort = T" but there's still error!

control_group <- as_control_group(nipt_samples = lapply(X = bam_filepaths, bin_bam_sample, do_sort = T, separate_strands = FALSE))

Loading Bam [bam_sort_core] merging from 7 files... BAM loaded Binning Error: BAM file appears to be unsorted

Ps. actually bam files are basically sorted .. but I don't actually know what's happened.

Another question is can I use symbolic link instead of using real .bam file?

Thanks :} Chantisa

ljohansson commented 6 years ago

Dear Chantisa,

I'm actually not sure how NIPTeR would react to symlinks. Could you retry and set the bam_filepath to the actual folder containing the bam files and check if you still have the error?

Cheers, Lennart

chantisakee commented 6 years ago

Dear Lennart,

Thanks for your answering.

Yes, I've tried using the actual folder containing the bam files and it still has errors.

Regards, Chantisa

GreeshmaThulasi commented 6 years ago

Hi @chantisakee, I did something differently and it worked. You can bin the files separately as,

s1<-bin_bam_sample("./sample1.bam", do_sort = F, separate_strands = F, custom_name = NULL)
s2<-bin_bam_sample("./sample2.bam", do_sort = F, separate_strands = F, custom_name = NULL)
......................................        ........................................................ ..............................................................
 ........................................       .....................................................      ..........................................................

Then list them together as, nipt_samples<-list(s1,s2.........)

Make those list a control group as, control_group <- as_control_group(nipt_samples = nipt_samples) Save the control reads as, saveRDS(object = control_group, file = "./control_group.rds")

chantisakee commented 6 years ago

Dear Greeshma,

I've found the way to list my samples together. Thank you so much for your suggestion :}

Regards, Chantisa

2018-06-15 17:39 GMT+07:00 GreeshmaThulasi notifications@github.com:

Hi @chantisakee https://github.com/chantisakee, I did something differently and it worked. You can bin the files separately as,

s1<-bin_bam_sample("./sample1.bam", do_sort = F, separate_strands = F, custom_name = NULL) s2<-bin_bam_sample("./sample2.bam", do_sort = F, separate_strands = F, custom_name = NULL)

...................................... ........................................................ .............................................................. ........................................ ..................................................... ..........................................................

Then list them together as, nipt_samples<-list(s1,s2.........)

Make those list a control group as, control_group <- as_control_group(nipt_samples = nipt_samples) Save the control reads as, saveRDS(object = control_group, file = "./control_group.rds")

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/molgenis/NIPTeR/issues/12#issuecomment-397583077, or mute the thread https://github.com/notifications/unsubscribe-auth/Adyb-z3gQkWNMmlQguAL90HD2ArGyu82ks5t847ggaJpZM4Ul3iF .

GeorginaAmbriz commented 3 years ago

Hi, I'm trying to analyse some NIPT data with NIPTeR, but I had the same problem with either do_sort = F or do_sort = V :

> s1<-bin_bam_sample("~/scratch/NIPT_workspace/NIPTeR/test_controlSample1/APGPTM.aligned.merged.sorted.filtered.2.bam", do_sort = F, separate_strands = F, custom_name = NULL)
Loading Bam
BAM loaded
Binning
Error: BAM file appears to be unsorted

I wonder if the reference genome version used for alignment could be causing this problem. These reads were aligned using the reference genome version hg19.

Thank you, Georgina Jimenez

ljohansson commented 3 years ago

Dear Georgina,

I'm not sure if I understand your question correctly. You state: "do_sort = F" , so you don't do any sorting. In this case if previously unsorted the bam file remains unsorted. With "do_sort = T" the bam file should be sorted. In some cases indeed the reference genome has been shown to be the issue. Please check if your chromosomes are ordered from 1,2,3 with sex chromosomes at the end. Contigs should not be in between the chromosomes.