Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sam to Bam Conversion Failing ****

    Hi All ,
    Can any one please clarify why samtools view is failing .
    I am writing shell script like this

    #!/bin/bash
    #PBS -l nodes=2pn=2
    for files in *.sra
    do
    OUT=(${files%.sra}.bam)
    ref=($"/raid/references-and-indexes/hg19/bwa/hg19.fa")
    fq=$(fastq-dump $files)
    # Main code

    bwa aln -t 8 $ref $fq|bwa samse $ref - $fq -|samtools view -bSh - /raid/development/anusha/python_test/shelltest/fetalbrain_bam/$OUT
    done

    I tried different combination for view like -bS
    -Shu
    by using the option -o still is failing
    the code is working pretty fine till point of samtools view
    I am getting following error many times and creating empty bam files
    bwa_seq_open] fail to open file 'Written' : No such file or directory
    [fread] Unexpected end of file
    [samopen] no @SQ lines in the header.
    [main_samview] random alignment retrieval only works for indexed BAM files.

    [bam_header_read] EOF marker is absent. The input is probably truncated.

    I am not understanding why this is failing

    Thanks in advance ,
    Anusha.Ch

  • #2
    Originally posted by AnushaC View Post
    Code:
    samtools view -bSh -  /raid/development/anusha/python_test/shelltest/fetalbrain_bam/$OUT
    Assuming BWA is producing a properly-formatted SAM file as output (which I'm doubtful of, given the error messages), it looks like you're not specifying the input/output files correctly. Samtools view takes a single non-option parameter (the input file name, or '-' for standard input), and the output (default to standard out) can be redirected to a different file using the '-o' parameter.

    So, there are two ways to output to a file (instead of standard out):
    Code:
    samtools view [options] <input> -o <output> # redirect using samtools 
    samtools view [options] <input> > <output> # redirect using the shell
    Subsituting in the bits from your code for these two options:
    Code:
    samtools view -bSh  - -o /raid/development/anusha/python_test/shelltest/fetalbrain_bam/$OUT # note two dashes separated by a space
    samtools view -bSh  - > /raid/development/anusha/python_test/shelltest/fetalbrain_bam/$OUT
    Of course, that all assumes your other options are correct. If you're sending output to a binary BAM file (option -b), then you don't need to include the SAM header (option -h), because you can't have a BAM file without a header.

    Comment

    Latest Articles

    Collapse

    • seqadmin
      Essential Discoveries and Tools in Epitranscriptomics
      by seqadmin




      The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
      04-22-2024, 07:01 AM
    • seqadmin
      Current Approaches to Protein Sequencing
      by seqadmin


      Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
      04-04-2024, 04:25 PM

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by seqadmin, Yesterday, 11:49 AM
    0 responses
    15 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-24-2024, 08:47 AM
    0 responses
    16 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-11-2024, 12:08 PM
    0 responses
    61 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 10:19 PM
    0 responses
    60 views
    0 likes
    Last Post seqadmin  
    Working...
    X