Answers.Body: <p>I think cuffdiff is not quite giving you the right error...it looks like the crux of your problem is you aligned each sample to a different reference.  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-07T20:39:19.560Z
Answers.LastActivityDate: 2019-06-07T20:39:19.560Z
Answers.UserDisplayName: swbarnes2
Answers.Body: <p>As @swbarnes2 noted, the error message is because the chromosome names, sizes, and orders differ between the two reference genomes/species you aligned against. Even if they were the same, you're comparing one sample against another between organisms, which is innately not something likely to work well. Further, I wouldn't expect the Zea Mays annotation to be very useful with whatever <code>Ref_Lai</code> is.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-08T08:19:07.777Z
Answers.LastActivityDate: 2019-06-08T08:19:07.777Z
Answers.UserDisplayName: Devon Ryan
Body: <p>I am a novice to bioinformatics trying to run a cuffdiff job in cufflinks and keep getting this error message: </p>
  
  <pre><code>Error: sort order of reads in BAMs must be the same
  </code></pre>
  
  <p><strong>GENERATING SAM FILES:</strong></p>
  
  <pre><code>cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load hisat2  
  hisat2 -k 1 -p 8 -S 11-5_B73_accepted_hits.sam -x /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_Zea_mays.AGPv4.dna.toplevel -1 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11-5_FCHHL7JBBXX_L7_DLPRMzP300H3AAAPEI-27_1.fq  -2 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11-5_FCHHL7JBBXX_L7_DLPRMzP300H3AAAPEI-27_2.fq
  
  
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11R-5
  module load hisat2  
  hisat2 -k 1 -p 8 -S 11-5_Mo17_accepted_hits.sam -x /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2//Mol17_Ref_Lai -1 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11R-5_DLPRMzP300B4AAAPEI-2_1.fq  -2 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11R-5_DLPRMzP300B4AAAPEI-2_2.fq
  </code></pre>
  
  <p><strong>CONVERTING SAM TO BAM:</strong> </p>
  
  <pre><code>cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load samtools 
  samtools view -bS a_B73_11-5_accepted_hits.sam &gt; a_B73_11-5_accepted_hits.bam
  samtools sort a_B73_11-5_accepted_hits.bam -o a_B73_11-5_accepted_hits.sorted.bam
  
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11-5
  module load samtools 
  samtools view -bS a_Mo17_11-5_accepted_hits.sam &gt; a_Mo17_11-5_accepted_hits.bam
  samtools sort a_Mo17_11-5_accepted_hits.bam -o a_Mo17_11-5_accepted_hits.sorted.bam
  </code></pre>
  
  <p><strong>CUFFDIFF JOB</strong></p>
  
  <pre><code>cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load cufflinks/2.2.1
  cuffdiff -b /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5 -u -N -p 8 /fs/project/PMIU0157/Claire_Stoll/Zea_mays.AGPv4.36.chr.gff3 /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5/a_B73_11-5_accepted_hits.sorted.bam /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11-5/a_Mo17_11-5_accepted_hits.sorted.bam
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T19:04:27.863Z
Comments.Text: Is it the last command that gives the error?
Comments.UserDisplayName: terdon
Tags: <phylogenetics><sam>
Title: Error: sort order of reads in BAMs must be the same
ThreadText: # Error: sort order of reads in BAMs must be the same
  
  (Asked by: username_0 on 2019-06-07)
  
  I am a novice to bioinformatics trying to run a cuffdiff job in cufflinks and keep getting this error message:
  
  ```
  Error: sort order of reads in BAMs must be the same
  
  ```
  
  **GENERATING SAM FILES:**
  
  ```
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load hisat2  
  hisat2 -k 1 -p 8 -S 11-5_B73_accepted_hits.sam -x /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_Zea_mays.AGPv4.dna.toplevel -1 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11-5_FCHHL7JBBXX_L7_DLPRMzP300H3AAAPEI-27_1.fq  -2 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11-5_FCHHL7JBBXX_L7_DLPRMzP300H3AAAPEI-27_2.fq
  
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11R-5
  module load hisat2  
  hisat2 -k 1 -p 8 -S 11-5_Mo17_accepted_hits.sam -x /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2//Mol17_Ref_Lai -1 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11R-5_DLPRMzP300B4AAAPEI-2_1.fq  -2 /fs/project/PMIU0157/Claire_Stoll/RNASeq/11R-5_DLPRMzP300B4AAAPEI-2_2.fq
  
  ```
  
  **CONVERTING SAM TO BAM:**
  
  ```
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load samtools 
  samtools view -bS a_B73_11-5_accepted_hits.sam > a_B73_11-5_accepted_hits.bam
  samtools sort a_B73_11-5_accepted_hits.bam -o a_B73_11-5_accepted_hits.sorted.bam
  
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11-5
  module load samtools 
  samtools view -bS a_Mo17_11-5_accepted_hits.sam > a_Mo17_11-5_accepted_hits.bam
  samtools sort a_Mo17_11-5_accepted_hits.bam -o a_Mo17_11-5_accepted_hits.sorted.bam
  
  ```
  
  **CUFFDIFF JOB**
  
  ```
  cd /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5
  module load cufflinks/2.2.1
  cuffdiff -b /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5 -u -N -p 8 /fs/project/PMIU0157/Claire_Stoll/Zea_mays.AGPv4.36.chr.gff3 /fs/project/PMIU0157/Claire_Stoll/RNASeq/B73_hisat2/B73_hisat2_11-5/a_B73_11-5_accepted_hits.sorted.bam /fs/project/PMIU0157/Claire_Stoll/RNASeq/Mo17_hisat2/Mo17_hisat2_11-5/a_Mo17_11-5_accepted_hits.sorted.bam
  
  ```
  
  **Tags:** phylogenetics, sam
  
  > **Comments:**
  > **username_1**: Is it the last command that gives the error?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-06-07. Score: 3
  
  I think cuffdiff is not quite giving you the right error...it looks like the crux of your problem is you aligned each sample to a different reference.
  
  
  ---
  
  ### Answer by username_3 on 2019-06-08. Score: 2
  
  As @username_2 noted, the error message is because the chromosome names, sizes, and orders differ between the two reference genomes/species you aligned against. Even if they were the same, you're comparing one sample against another between organisms, which is innately not something likely to work well. Further, I wouldn't expect the Zea Mays annotation to be very useful with whatever `Ref_Lai` is.
  
  
  ---
  
  