Test-drive the GATK tools and Best Practices pipelines on Terra


Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

Piped command for realignment of BAM files

jushjush PhillyMember
Sorry for any errors, I'm new to the forum

I'm currently trying to realign my bam file to the hg38 reference genome. I tried my own piped command and also the command from GATK tutorial 6483

```
gatk SamToFastq -I markedadapters.bam -F /dev/stdout --CLIPPING_ATTRIBUTE XT --CLIPPING_ACTION 2 --INTERLEAVE true -NON_PF true -TMP_DIR= path/hello | bwa mem -M -t 12 -p /mydata/Homo_sapiens_assembly38.fasta /dev/stdin | gatk MergeBamAlignment --ALIGNED_BAM /dev/stdin --UNMAPPED_BAM unmap.bam -O piped.bam -R /mydata/Homo_sapiens_assembly38.fasta --CREATE_INDEX true --ADD_MATE_CIGAR true --CLIP_ADAPTERS false --CLIP_OVERLAPPING_READS true --INCLUDE_SECONDARY_ALIGNMENTS true --MAX_INSERTIONS_OR_DELETIONS -1 --PRIMARY_ALIGNMENT_STRATEGY MostDistant --ATTRIBUTES_TO_RETAIN XS -TMP_DIR= path/hello
```

but I kept getting this error:

```
htsjdk.samtools.SAMException: Error in writing fastq file /dev/stdout
```

I ran SamToFastq by itself in this format and it worked

```
gatk SamToFastq -I markedadapters.bam -F /dev/stdout --CLIPPING_ATTRIBUTE XT --CLIPPING_ACTION 2 --INTERLEAVE true -NON_PF true -TMP_DIR= path/hello > mytest.fastq
```

I'd love to be able to use piped commands since my bam files are 150G

Answers

  • bshifawbshifaw Member, Broadie, Moderator admin

    @jush

    If you see the following [E::bwa_idx_load_from_disk] fail to locate the index files Try indexing your fasta with bwa then run your command again. Forum post

    bwa index Homo_sapiens_assembly38.fasta 
    

    If not please post the full stacktrace for running your command to this thread.

Sign In or Register to comment.