Hi Rebecca, If you don't mind commercial software novosort will happily merge files with different @SQ orders and output order will follow from the first file.
novosort -m 16G -i -o out.bam NA18867.bam Denisovan.bam Output will be coordinate sorted and indexed. With a license file it will run multi-threaded else it single threads. I've attached a temporary license. Just extract the file novoalign.lic from the tar and save into folder with novosort which you can download as part of novocraft package at www.novocraft.com/download Kind Regards, Colin Colin Hercus, *Novocraft Technologies Sdn Bhd* <http://www.novocraft.com/> C-23A-05, 3 Two Square, Jalan 19/1, Section 19, 46300 Petaling Jaya, Selangor Darul Ehsan, Malaysia Tel: +6016 2482 668 Fax: +603 7960 0540 www.novocraft.com On 11 October 2016 at 04:49, Rebecca Harris <rebz...@gmail.com> wrote: > Hi, > > I have a couple of genomes, aligned to the same reference, that I am > trying to merge using the command: > > java -jar picard.jar MergeSamFiles MERGE_SEQUENCE_DICTIONARIES=true > I=NA18867.bam I=Denisovan.bam O=out.bam > > Upon merging, I get an error that my BAM files are in different orders - > in particular 2 and 19. So, I attempted to use samtools sort -n to sort all > my BAM files. However, this is not working as expected. After sorting, I > used samtools view -H to look at the header of my sorted BAM files (results > shown below) and find that these genomes continue to be in different orders. > > I am using samtools version 1.2 and the following command for sorting: > samtools sort -n -T human -o humans/NA18867.sorted.bam -O bam -@ 12 > humans/NA18867.bam > > Any help would be greatly appreciated. Thanks! > Rebecca > > > For one genome I get: > > @HD VN:1.0 SO:queryname > > @SQ SN:1 LN:249250621 > > @SQ SN:10 LN:135534747 > > @SQ SN:11 LN:135006516 > > @SQ SN:12 LN:133851895 > > @SQ SN:13 LN:115169878 > > @SQ SN:14 LN:107349540 > > @SQ SN:15 LN:102531392 > > @SQ SN:16 LN:90354753 > > @SQ SN:17 LN:81195210 > > @SQ SN:18 LN:78077248 > > @SQ SN:19 LN:59128983 > @SQ SN:2 LN:243199373 > > and for the other genome I get: > > @HD VN:1.0 GO:none SO:queryname > > @SQ SN:1 LN:249250621 AS:NCBI37 UR:ftp://ftp.1000genomes.ebi. > ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz M5: > 1b22b98cdeb4a9304cb5d48026a85128 SP:Human > > @SQ SN:2 LN:243199373 AS:NCBI37 UR:ftp://ftp.1000genomes.ebi. > ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz M5: > a0d9851da00400dec1098a9255ac712e SP:Human > > @SQ SN:3 LN:198022430 AS:NCBI37 UR:ftp://ftp.1000genomes.ebi. > ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz M5: > fdfd811849cc2fadebc929bb925902e5 SP:Human > > @SQ SN:4 LN:191154276 AS:NCBI37 UR:ftp://ftp.1000genomes.ebi. > ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz M5: > 23dccd106897542ad87d2765d28a19a1 SP:Human > > > ------------------------------------------------------------ > ------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Samtools-help mailing list > Samtools-help@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/samtools-help > >
RebeccaHarris.tar.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help