Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • convert sorted bam to sorted sam for htseq-count

    Hi there,

    I have a bowtie2 alignment of PE non-stranded RNA-seq reads from a bacterial species (used option -k 1; 96.20% pairs aligned concordantly exactly 1 time) , and would like to use htseq-count to get count data across genes. I am having trouble retaining reads sorted after converting a sorted bam to sam format (htseq-count needs sorted sam for PE reads).

    These are my attempts and error messages:

    # sorting reads
    $ samtools sort myalignment.bam myalignment.sorted

    # convert back to sam
    $ samtools view -h myalignment.sorted.bam > out.sorted.sam

    # check (truncated output) - note @HD line 'unsorted', ?
    $ head out.sorted.sam
    @HD VN:1.0 SO:unsorted
    @SQ SN:NC_017656.1 LN:5212843
    @PG ID:bowtie2 PN:bowtie2 VN:2.0.0-beta7
    HWUSI-EAS1615L:13:FC64RB1AAXX:4:23:7604:14541_1 99 NC_017656.1 156 255 68M = 206 118 CAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACCATTACCACCACCA IIIIIIEIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHIIIIHGIIIIGHIIHIHH AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:68 YS:i:0 YT:Z:CP
    HWUSI-EAS1615L:13:FC64RB1AAXX:4:70:9040:11393_1 99 NC_017656.1 164 255 68M = 207 111 TAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACCATTACCACCACCATCACCATT IIIIFIIIIBHHHIFIIIIIIIIIHIGIHIIIIIFHIIIIBIHGHIGHIHHICIHCHF;FEDEFDEH< AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:68 YS:i:0 YT:Z:CP

    # tried htseq-count (truncated output)
    $ htseq-count -s no -t gene -i ID out.sorted.sam ../reference.gff
    4965 GFF lines processed.
    Warning: Read HWUSI-EAS1615L:13:FC64RB1AAXX:4:23:7604:14541_1 claims to have an aligned mate which could not be found. (Is the SAM file properly sorted?)
    Warning: Read HWUSI-EAS1615L:13:FC64RB1AAXX:4:70:9040:11393_1 claims to have an aligned mate which could not be found. (Is the SAM file properly sorted?)
    Warning: Read HWUSI-EAS1615L:13:FC64RB1AAXX:4:62:8731:7335_1 claims to have an aligned mate which could not be found. (Is the SAM file properly sorted?)


    Your insight is much appreciated!

  • #2
    I think I figured it out. Bowtie2 outputs by default reads sorted by name. The offending part in the reads is the _1, _2 at the end. Removing those (in vim) fixed the problem and htseq-count works without any sorting needed. Only after couple hours of staring at the reads to figure this out, came across this thread that explains an identical issue. Feeling slow...

    Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc


    thanks

    Comment


    • #3
      Simple curiosity (since I've also done RNA-seq on some bacterial species), why have you chosen to do your study with paired-end sequencing?

      TP

      Comment


      • #4
        To align reads with greater confidence, as these strains have many phages and IS elements ( some of which are chromosomal in certain strains and plasmid borne in others ), and their genomes have not been sequenced yet ( so I also sequenced the genomes ).

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Non-Coding RNA Research and Technologies
          by seqadmin




          Non-coding RNAs (ncRNAs) do not code for proteins but play important roles in numerous cellular processes including gene silencing, developmental pathways, and more. There are numerous types including microRNA (miRNA), long ncRNA (lncRNA), circular RNA (circRNA), and more. In this article, we discuss innovative ncRNA research and explore recent technological advancements that improve the study of ncRNAs.

          Nobel Prize for MicroRNA Discovery
          This week,...
          10-07-2024, 08:07 AM
        • seqadmin
          Recent Developments in Metagenomics
          by seqadmin





          Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
          09-23-2024, 06:35 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, Yesterday, 06:55 AM
        0 responses
        10 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 10-02-2024, 04:51 AM
        0 responses
        108 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 10-01-2024, 07:10 AM
        0 responses
        114 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 09-30-2024, 08:33 AM
        1 response
        118 views
        0 likes
        Last Post EmiTom
        by EmiTom
         
        Working...
        X