Reply

unmapped reads after run longranger alignment

Posted By: Jia_Ding, on Jan 10, 2018 at 8:05 AM

Is there any one knows a way to fetch unmapped reads from .bam after "longranger wgs" to hg19? 

Here is what I tried:

 

samtools view -f 4 phased_possorted_bam.bam > phased_possorted_bam_unmapped.bam

bamtofastq phased_possorted_bam_unmapped.bam bamtofastq_out
bamtofastq v1.0.0
[W::bam_hdr_read] EOF marker is absent. The input is probably truncated.
[E::bam_hdr_read] invalid BAM binary header
Segmentation fault (core dumped)

 

Thanks!

2 Replies

Re: unmapped reads after run longranger alignment

Posted By: rachanajain, on Jan 11, 2018 at 11:11 AM

Hi Jia,

 

I think the error in bam2fastq could be becuase of:

a) missing header in the file that results from your samtools command.

b) The file output by your command is in sam format and not bam format.

 

Could you try using the following command to extract the unmapped reads and then try to run bam2fastq ?

 

 

samtools view -h -b -f 4 phased_possorted_bam.bam > phased_possorted_bam_unmapped.bam

 

 

 

 

Thanks

Re: unmapped reads after run longranger alignment

Posted By: Jia_Ding, on Jan 12, 2018 at 12:31 AM

Hi rchanajain,

 

I extracted the unmapped reads including the head into a .bam format file.

I did exactly like the command you've suggested.

Thus, I don't know what's the reason for such error msg.

 

Any other suggestions? I pasted the header information below.

Thanks!

Jia

 

 

$ samtools view -H phased_possorted_bam_unmapped.bam
@HD VN:1.3 SO:coordinate
@SQ SN:chr1 LN:249250621 AS:chr1 SP:human
@SQ SN:chr2 LN:243199373 AS:chr2 SP:human
@SQ SN:chr3 LN:198022430 AS:chr3 SP:human
@SQ SN:chr4 LN:191154276 AS:chr4 SP:human
@SQ SN:chr5 LN:180915260 AS:chr5 SP:human
@SQ SN:chr6 LN:171115067 AS:chr6 SP:human
@SQ SN:chr7 LN:159138663 AS:chr7 SP:human
@SQ SN:chr8 LN:146364022 AS:chr8 SP:human
@SQ SN:chr9 LN:141213431 AS:chr9 SP:human
@SQ SN:chr10 LN:135534747 AS:chr10 SP:human
@SQ SN:chr11 LN:135006516 AS:chr11 SP:human
@SQ SN:chr12 LN:133851895 AS:chr12 SP:human
@SQ SN:chr13 LN:115169878 AS:chr13 SP:human
@SQ SN:chr14 LN:107349540 AS:chr14 SP:human
@SQ SN:chr15 LN:102531392 AS:chr15 SP:human
@SQ SN:chr16 LN:90354753 AS:chr16 SP:human
@SQ SN:chr17 LN:81195210 AS:chr17 SP:human
@SQ SN:chr18 LN:78077248 AS:chr18 SP:human
@SQ SN:chr19 LN:59128983 AS:chr19 SP:human
@SQ SN:chr20 LN:63025520 AS:chr20 SP:human
@SQ SN:chr21 LN:48129895 AS:chr21 SP:human

@SQ SN:chr22 LN:51304566 AS:chr22 SP:human
@SQ SN:chrX LN:155270560 AS:chrX SP:human
@SQ SN:chrY LN:59373566 AS:chrY SP:human
@SQ SN:chrM LN:16571 AS:chrM SP:human
@SQ SN:chr1_gl000191_random LN:106433 AS:chr1_gl000191_random SP:human
@SQ SN:chr1_gl000192_random LN:547496 AS:chr1_gl000192_random SP:human
@SQ SN:chr4_gl000193_random LN:189789 AS:chr4_gl000193_random SP:human
@SQ SN:chr4_gl000194_random LN:191469 AS:chr4_gl000194_random SP:human
@SQ SN:chr7_gl000195_random LN:182896 AS:chr7_gl000195_random SP:human
@SQ SN:chr8_gl000196_random LN:38914 AS:chr8_gl000196_random SP:human
@SQ SN:chr8_gl000197_random LN:37175 AS:chr8_gl000197_random SP:human
@SQ SN:chr9_gl000198_random LN:90085 AS:chr9_gl000198_random SP:human
@SQ SN:chr9_gl000199_random LN:169874 AS:chr9_gl000199_random SP:human
@SQ SN:chr9_gl000200_random LN:187035 AS:chr9_gl000200_random SP:human
@SQ SN:chr9_gl000201_random LN:36148 AS:chr9_gl000201_random SP:human
@SQ SN:chr11_gl000202_random LN:40103 AS:chr11_gl000202_random SP:human
@SQ SN:chr17_gl000203_random LN:37498 AS:chr17_gl000203_random SP:human
@SQ SN:chr17_gl000204_random LN:81310 AS:chr17_gl000204_random SP:human
@SQ SN:chr17_gl000205_random LN:174588 AS:chr17_gl000205_random SP:human
@SQ SN:chr17_gl000206_random LN:41001 AS:chr17_gl000206_random SP:human
@SQ SN:chr18_gl000207_random LN:4262 AS:chr18_gl000207_random SP:human
@SQ SN:chr19_gl000208_random LN:92689 AS:chr19_gl000208_random SP:human
@SQ SN:chr19_gl000209_random LN:159169 AS:chr19_gl000209_random SP:human
@SQ SN:chr21_gl000210_random LN:27682 AS:chr21_gl000210_random SP:human
@SQ SN:chrUn_gl000211 LN:166566 AS:chrUn_gl000211 SP:human
@SQ SN:chrUn_gl000212 LN:186858 AS:chrUn_gl000212 SP:human
@SQ SN:chrUn_gl000213 LN:164239 AS:chrUn_gl000213 SP:human
@SQ SN:chrUn_gl000214 LN:137718 AS:chrUn_gl000214 SP:human
@SQ SN:chrUn_gl000215 LN:172545 AS:chrUn_gl000215 SP:human
@SQ SN:chrUn_gl000216 LN:172294 AS:chrUn_gl000216 SP:human
@SQ SN:chrUn_gl000217 LN:172149 AS:chrUn_gl000217 SP:human
@SQ SN:chrUn_gl000218 LN:161147 AS:chrUn_gl000218 SP:human
@SQ SN:chrUn_gl000219 LN:179198 AS:chrUn_gl000219 SP:human
@SQ SN:chrUn_gl000220 LN:161802 AS:chrUn_gl000220 SP:human
@SQ SN:chrUn_gl000221 LN:155397 AS:chrUn_gl000221 SP:human
@SQ SN:chrUn_gl000222 LN:186861 AS:chrUn_gl000222 SP:human
@SQ SN:chrUn_gl000223 LN:180455 AS:chrUn_gl000223 SP:human
@SQ SN:chrUn_gl000224 LN:179693 AS:chrUn_gl000224 SP:human
@SQ SN:chrUn_gl000225 LN:211173 AS:chrUn_gl000225 SP:human
@SQ SN:chrUn_gl000226 LN:15008 AS:chrUn_gl000226 SP:human
@SQ SN:chrUn_gl000227 LN:128374 AS:chrUn_gl000227 SP:human
@SQ SN:chrUn_gl000228 LN:129120 AS:chrUn_gl000228 SP:human
@SQ SN:chrUn_gl000229 LN:19913 AS:chrUn_gl000229 SP:human
@SQ SN:chrUn_gl000230 LN:43691 AS:chrUn_gl000230 SP:human
@SQ SN:chrUn_gl000231 LN:27386 AS:chrUn_gl000231 SP:human
@SQ SN:chrUn_gl000232 LN:40652 AS:chrUn_gl000232 SP:human
@SQ SN:chrUn_gl000233 LN:45941 AS:chrUn_gl000233 SP:human
@SQ SN:chrUn_gl000234 LN:40531 AS:chrUn_gl000234 SP:human
@SQ SN:chrUn_gl000235 LN:34474 AS:chrUn_gl000235 SP:human
@SQ SN:chrUn_gl000236 LN:41934 AS:chrUn_gl000236 SP:human
@SQ SN:chrUn_gl000237 LN:45867 AS:chrUn_gl000237 SP:human
@SQ SN:chrUn_gl000238 LN:39939 AS:chrUn_gl000238 SP:human
@SQ SN:chrUn_gl000239 LN:33824 AS:chrUn_gl000239 SP:human
@SQ SN:chrUn_gl000240 LN:41933 AS:chrUn_gl000240 SP:human
@SQ SN:chrUn_gl000241 LN:42152 AS:chrUn_gl000241 SP:human
@SQ SN:chrUn_gl000242 LN:43523 AS:chrUn_gl000242 SP:human
@SQ SN:chrUn_gl000243 LN:43341 AS:chrUn_gl000243 SP:human
@SQ SN:chrUn_gl000244 LN:39929 AS:chrUn_gl000244 SP:human
@SQ SN:chrUn_gl000245 LN:36651 AS:chrUn_gl000245 SP:human
@SQ SN:chrUn_gl000246 LN:38154 AS:chrUn_gl000246 SP:human
@SQ SN:chrUn_gl000247 LN:36422 AS:chrUn_gl000247 SP:human
@SQ SN:chrUn_gl000248 LN:39786 AS:chrUn_gl000248 SP:human
@SQ SN:chrUn_gl000249 LN:38502 AS:chrUn_gl000249 SP:human
@SQ SN:hs37d5 LN:35477943 AS:hs37d5 SP:human
@RG ID:4131-MEZ-0009_wtoSpec:LibraryNotSpecified:1:H5NLTALXX:7 SM:4131-MEZ-0009_wtoSpec LB:LibraryNotSpecified.1 PU:4131-MEZ-0009_wtoSpec:LibraryNotSpecified:1:H5NLTALXX:7 DT:2017-11-06T16:26:07+0100 PL:ILLUMINA
@PG PN:longranger.lariat ID:lariat CL:lariat -reads=/ddn1/vol1/staging/leuven/stg_00019/masoud/10X/22q/wgs/4131-MEZ-0009_wtoSpec/PHASER_SVCALLER_CS/PHASER_SVCALLER/_LINKED_READS_ALIGNER/_SORT_FASTQ_BY_BARCODE/SORT_FASTQ_BY_BC/fork0/chnk0/files/reads.fastq.gz -read_groups=4131-MEZ-0009_wtoSpec:LibraryNotSpecified:1:H5NLTALXX:7 -genome=/data/leuven/leuven-data/308/vsc30843/Reference/refdata-hg19-2.1.0//fasta/genome.fa -sample_id=4131-MEZ-0009_wtoSpec -threads=4 -centromeres=/data/leuven/leuven-data/308/vsc30843/Reference/refdata-hg19-2.1.0/regions/centromeres.tsv -trim_length=7 -output=/ddn1/vol1/staging/leuven/stg_00019/masoud/10X/22q/wgs/4131-MEZ-0009_wtoSpec/PHASER_SVCALLER_CS/PHASER_SVCALLER/_LINKED_READS_ALIGNER/BARCODE_AWARE_ALIGNER/fork0/chnk0/files VN:0a2f9d6
@PG PN:longranger.attach_phasing ID:attach_phasing VN:2.1.2 PP:lariat
@PG PN:longranger ID:longranger VN:2.1.2 PP:attach_phasing
@CO 10x_bam_to_fastq:R1(RX:QX,TR:TQ,SEQ:QUAL)
@CO 10x_bam_to_fastq:R2(SEQ:QUAL)
@CO 10x_bam_to_fastq:I1(BC:QT)