yahs icon indicating copy to clipboard operation
yahs copied to clipboard

0 read pairs

Open ajkshdkjahdka opened this issue 2 years ago • 21 comments

[I::main] dump hic links (BAM) to binary file yahs.out.bin [I::dump_links_from_bam_file] 1 million records processed, 0 read pairs [I::dump_links_from_bam_file] 2 million records processed, 0 read pairs [I::dump_links_from_bam_file] 3 million records processed, 0 read pairs [I::dump_links_from_bam_file] 4 million records processed, 0 read pairs [I::dump_links_from_bam_file] 5 million records processed, 0 read pairs

what happened ? could you please tell why?

ajkshdkjahdka avatar Feb 11 '23 10:02 ajkshdkjahdka

Hello @ajkshdkjahdka,

For a BAM input, you need to make sure the reads in your BAM file are with proper SAM flags (which are used to pair reads). This should not be a problem if your BAM file was generated in a standard way. Can you please provide more information about your alignment pipeline? Show here a few lines of your BAM file would help too.

Chenxi

c-zhou avatar Feb 13 '23 11:02 c-zhou

Also, if your BAM file was sorted by read names, the read names of a read pair need to be identical. Another parameter that would affect the filtering for a name-sorted BAM is the mapping quality threshold (-q), the default value is 10.

c-zhou avatar Feb 13 '23 11:02 c-zhou

acturally, i used the pipline you described herehttps://www.jianshu.com/p/620ddc8764ee, the chromap generated the bam file, but it did not work out

ajkshdkjahdka avatar Feb 14 '23 01:02 ajkshdkjahdka

Hi, I have the same problem, did you solve it ?

Jrbfo avatar Feb 14 '23 08:02 Jrbfo

yeah,I also have the same problem。But my BAM file was converted by SAM file via samtools . More , the yahs.out .bin I got is also empty.

Thousandl avatar Feb 14 '23 09:02 Thousandl

Hello @ajkshdkjahdka, @Jrbfo, @Thousandl,

I am not familiar with chromap and am not the author of that blog. I can have a look if you can show me here a few lines of your BAM file, for example with samtools view -F0xD00 -q10 ${your_bam_file} | cut -f1-9 | head.

Chenxi

c-zhou avatar Feb 14 '23 10:02 c-zhou

图片

Jrbfo avatar Feb 14 '23 11:02 Jrbfo

微信图片_20230214193733 @c-zhou

Thousandl avatar Feb 14 '23 11:02 Thousandl

Thanks @Jrbfo and @Thousandl,

Your files have the same problem. They are essentially not standard BAM/SAM files. In a standard BAM file, we are expected to see identical read names (the first column) for a read pair, i.e., no '/1' and '/2' appended to the read names. If you also used the pipeline described here https://www.jianshu.com/p/620ddc8764ee like @ajkshdkjahdka, this was likely introduced by chromap. It is probably worth asking the chromap group to fix it.

For a quick fix, you can convert your BAM file to a BED file with bedtools and then use the BED file as input to YaHS. You can do something like this samtools view -bh -u -F0xF0C -q10 ${your_bam_file} | bedtools bamtobed | awk -v OFS='\t' '{$4=substr($4,1,length($4)-2); print}' >${your_out_prefix}.bed.

Best, Chenxi

c-zhou avatar Feb 14 '23 12:02 c-zhou

Chromap has the option to output BED format files. That might be another option if you do not mind redoing read mapping. Chenxi

c-zhou avatar Feb 14 '23 12:02 c-zhou

OK THANK YOU VERY MUCH! I WILL TRY IT NOW

ajkshdkjahdka avatar Feb 14 '23 12:02 ajkshdkjahdka

Thanks @c-zhou Ok, thank you very much for the suggestion, I'll this quick fix before going and asking chromap group to fix. Your answer is of great help to me. Thank you again for your sincere reply and wish you success in your work. best wishes Liqian

Thousandl avatar Feb 14 '23 12:02 Thousandl

Thanks Liqian. The same to you! Chenxi

c-zhou avatar Feb 14 '23 13:02 c-zhou

@c-zhou Thank You So Much!

Jrbfo avatar Feb 15 '23 08:02 Jrbfo

Thanks @c-zhou Ok, thank you very much for the suggestion, I'll this quick fix before going and asking chromap group to fix. Your answer is of great help to me. Thank you again for your sincere reply and wish you success in your work. best wishes Liqian

Hi! Did you solve this problem after converting bam file to bed file?

anxuan-web avatar Jun 14 '23 03:06 anxuan-web

Yes, I have solved this problem and it is already in use.

---Original--- From: @.> Date: Wed, Jun 14, 2023 11:34 AM To: @.>; Cc: @.@.>; Subject: Re: [c-zhou/yahs] 0 read pairs (Issue #47)

Thanks @c-zhou Ok, thank you very much for the suggestion, I'll this quick fix before going and asking chromap group to fix. Your answer is of great help to me. Thank you again for your sincere reply and wish you success in your work. best wishes Liqian

Hi! Did you solve this problem after converting bam file to bed file?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Thousandl avatar Jun 14 '23 04:06 Thousandl

@c-zhou I have the same problem, here a few lines of BAM file,Thanks. image image

ColinR01 avatar Feb 01 '24 06:02 ColinR01

length($4)-2

length($4)-4 ? bed read-pairs need same name ,also?

felixlee0608 avatar Jul 08 '24 05:07 felixlee0608

Hi @felixlee0608,

Thanks for your reply. It should be length($4)-2. This is to removed '/1' and '/2' suffixes.

I realised it is not really necessary to remove suffixes for BED files. The program has been written to deal with them. See https://github.com/c-zhou/yahs/blob/2630cff2d247d794e8e776ee42f8d45ee1e9d3cb/asset.c#L167-L180.

This should work too, samtools view -bh -u -F0xF0C -q10 ${your_bam_file} | bedtools bamtobed | >${your_out_prefix}.bed. The BAM file should be sorted by read names.

For BAM files, the read names for a read pair need to be identical. No '/1' or '/2' suffixes are allowed.

Best, Chenxi

c-zhou avatar Jul 08 '24 09:07 c-zhou

@c-zhou Hello, I am facing the same issue with '0' read pairs and my bam file seems to have '/1' and '/2' appended to the read names. However, this happens only in certain samples that I am working with. I am running the same pipeline for all samples. I am unable to understand why the BAM files happen to have /1-/2 tags on it in certain cases but not in others? Also, is there an option to modify the BAM file instead of converting it to BED?
Thank you!

afiyachida avatar Aug 01 '24 06:08 afiyachida

@felixlee0608 Were you able to remove the '/1' /2' tags from the BAM file directly ?

afiyachida avatar Aug 08 '24 17:08 afiyachida