convert sam format to axt Format
1
0
Entering edit mode
9.3 years ago
midox ▴ 290

hello,
I would like to convert my sam file (.sam) to another type is .axt format.
i used BWA for alignement but the output of this tool is .sam format.
Can you help me?
Thanks

alignment sam axtformat • 4.2k views
ADD COMMENT
0
Entering edit mode

does AXT supports INDELS (like SAM)?

ADD REPLY
0
Entering edit mode

yes. it support indels

ADD REPLY
0
Entering edit mode

so, how does it look likes with indels, I cannot find an example

ADD REPLY
0
Entering edit mode

this is an example:

14 NODE_98_length_11049_ID_45456 4251 4311 Read_10 8190 8248 - 3854
aaatgtattccgataggccattttacatttggagggacggttgaaag---tggacagaggaaaa
aaatgtattccgatagg----tttacatttggagg-acggttgaaagacttggacagaggaaaa

so how convert .sam output to .axt?

ADD REPLY
0
Entering edit mode

i cant install ant in my server!!! have you solution?

ADD REPLY
0
Entering edit mode

you don't need to be root to install ant, just download and put it anywhere: https://ant.apache.org/bindownload.cgi

ADD REPLY
0
Entering edit mode

I installed apache.

but no run to biostar170742.

[mk@rainman jvarkit]$ /home/mk/apache-ant-1.9.6/bin/ant -version
Apache Ant version 1.7.1 compiled on August 24 2010
[mk@rainman jvarkit]$ make biostar170742
echo "Compiling htsjdk with ${JAVA_HOME} = "
Compiling htsjdk with  =
echo "Compiling htsjdk library for java. Requires  apache ANT. If it fails here, it's a not a problem with jvarkit."
Compiling htsjdk library for java. Requires  apache ANT. If it fails here, it's a not a problem with jvarkit.
echo "And ${JAVA_HOME}/bin/javac should be >=1.8"
And /bin/javac should be >=1.8
(cd /home/mk/jvarkit/htsjdk-2.0.1 && ant )
Buildfile: build.xml

write-version-property:

BUILD FAILED
/home/mk/jvarkit/htsjdk-2.0.1/build.xml:64: Problem: failed to create task or type propertyfile
Cause: the class org.apache.tools.ant.taskdefs.optional.PropertyFile was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/home/mk/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

Total time: 0 seconds
make: *** [/home/mk/jvarkit/htsjdk-2.0.1/dist/htsjdk-2.0.1.jar] Erreur 1
[mk@rainman jvarkit]$
ADD REPLY
0
Entering edit mode

thank you but I cant install apache. I don't know the problem

have you another solution to run samtoaxt.java?

Thanks

ADD REPLY
2
Entering edit mode
9.3 years ago

I quickly wrote a converter https://github.com/lindenb/jvarkit/wiki/Biostar170742

$ java -jar dist-2.0.1/biostar170742.jar \
    -R ref.fa \
    S1.bam

0 rotavirus 1 70 rotavirus_1_317_5:0:0_7:0:0_2de/1 + 60
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGCAGATGGTAAGCTCTATTATT
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAATATGGCGTCAACTCAGCAGATGGTCAGCTCTAATATT

1 rotavirus 1 70 rotavirus_1_535_4:0:0_4:0:0_1a6/2 + 60
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGCAGATGGTAAGCTCTATTATT
GGCTTTTACTGCTTTTCAGTGGTTGCTTCTCAAGATGGAGTGTACTCATCAGATGGTAAGCTCTATTATT

2 rotavirus 1 70 rotavirus_1_543_5:0:0_11:0:0_390/2 + 60
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGCAGATGGTAAGCTCTATTATT
GGCTTTTAATGCTTTTCATTTGATGCTGCTCAAGATGGAGTCTACACAGCAGATGGTCAGCTCTATTATT

3 rotavirus 1 70 rotavirus_1_578_3:0:0_7:0:0_7c/1 + 60
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGCAGATGGTAAGCTCTATTATT
GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTCCTGAGCAGCTGGTAAGCTCTATTATT
(...)
ADD COMMENT
0
Entering edit mode

thank you pierre but I can't run this code.

I must install jvarkit?

ADD REPLY
0
Entering edit mode

I installed the tool. but I can't run Biostar70742.java

there are errors.

[m@rainman biostar]$ javac Biostar170742.java

Biostar170742.java:29: package com.github.lindenb.jvarkit.util.picard does not exist
import com.github.lindenb.jvarkit.util.picard.GenomicSequence;
^
Biostar170742.java:30: package com.github.lindenb.jvarkit.util.picard does not exist
import com.github.lindenb.jvarkit.util.picard.SAMSequenceDictionaryProgress;
^
Biostar170742.java:32: package htsjdk.samtools does not exist
import htsjdk.samtools.Cigar;
^
Biostar170742.java:33: package htsjdk.samtools does not exist
import htsjdk.samtools.CigarElement;
^
Biostar170742.java:34: package htsjdk.samtools does not exist
import htsjdk.samtools.CigarOperator;
^
Biostar170742.java:35: package htsjdk.samtools does not exist
import htsjdk.samtools.SAMRecord;
^
Biostar170742.java:36: package htsjdk.samtools does not exist
import htsjdk.samtools.SAMRecordIterator;
^
Biostar170742.java:37: package htsjdk.samtools does not exist
import htsjdk.samtools.SamReader;
^
Biostar170742.java:38: package htsjdk.samtools.reference does not exist
import htsjdk.samtools.reference.IndexedFastaSequenceFile;
^
Biostar170742.java:39: package htsjdk.samtools.util does not exist
import htsjdk.samtools.util.CloserUtil;
^
Biostar170742.java:42: cannot find symbol
symbol: class AbstractBiostar170742
public class Biostar170742 extends AbstractBiostar170742
^
Biostar170742.java:44: package org.slf4j does not exist
private static final org.slf4j.Logger LOG = com.github.lindenb.jvarkit.util.log.Logging.getLog(Biostar170742.class);
^
Biostar170742.java:44: package com.github.lindenb.jvarkit.util.log does not exist
private static final org.slf4j.Logger LOG = com.github.lindenb.jvarkit.util.log.Logging.getLog(Biostar170742.class);
^
Biostar170742.java:51: cannot find symbol
symbol : variable super
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
if(super.faidx==null)
^
Biostar170742.java:53: cannot find symbol
symbol : method wrapException(java.lang.String)
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
return wrapException("Reference sequence was not defined");
^
Biostar170742.java:56: cannot find symbol
symbol : class SamReader
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
SamReader sfr=null;
^
Biostar170742.java:57: cannot find symbol
symbol : class SAMRecordIterator
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
SAMRecordIterator iter=null;
^
Biostar170742.java:58: cannot find symbol
symbol : class GenomicSequence
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
GenomicSequence genomicSequence = null;
^
Biostar170742.java:59: cannot find symbol
symbol : class IndexedFastaSequenceFile
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
IndexedFastaSequenceFile indexedFastaSequenceFile= null;
^
Biostar170742.java:62: cannot find symbol
symbol : class IndexedFastaSequenceFile
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
indexedFastaSequenceFile = new IndexedFastaSequenceFile(super.faidx);
^
Biostar170742.java:62: cannot find symbol
symbol : variable super
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
indexedFastaSequenceFile = new IndexedFastaSequenceFile(super.faidx);
^
Biostar170742.java:64: cannot find symbol
symbol : method openSamReader(java.lang.String)
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
sfr = openSamReader(inputName);
^
Biostar170742.java:65: cannot find symbol
symbol : variable super
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
out = super.openFileOrStdoutAsPrintStream();
^
Biostar170742.java:69: cannot find symbol
symbol : class SAMSequenceDictionaryProgress
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
final SAMSequenceDictionaryProgress progress = new SAMSequenceDictionaryProgress(sfr.getFileHeader());
^
Biostar170742.java:69: cannot find symbol
symbol : class SAMSequenceDictionaryProgress
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
final SAMSequenceDictionaryProgress progress = new SAMSequenceDictionaryProgress(sfr.getFileHeader());
^
Biostar170742.java:73: cannot find symbol
symbol : class SAMRecord
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
final SAMRecord rec= progress.watch(iter.next());
^
Biostar170742.java:75: cannot find symbol
symbol : class Cigar
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
final Cigar cigar = rec.getCigar();
^
Biostar170742.java:82: cannot find symbol
symbol : class GenomicSequence
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
genomicSequence = new GenomicSequence(indexedFastaSequenceFile, rec.getReferenceName());
^
Biostar170742.java:89: cannot find symbol
symbol : class CigarElement
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
for(final CigarElement ce: cigar.getCigarElements())
^
Biostar170742.java:91: cannot find symbol
symbol : class CigarOperator
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
final CigarOperator op = ce.getOperator();
^
Biostar170742.java:92: cannot find symbol
symbol : variable CigarOperator
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
if(op.equals(CigarOperator.S))
^
Biostar170742.java:94: operator + cannot be applied to int,CigarElement.getLength
readpos+=ce.getLength();
^
Biostar170742.java:94: inconvertible types
found : <nulltype>
required: int
readpos+=ce.getLength();
^
Biostar170742.java:97: cannot find symbol
symbol : variable CigarOperator
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
if(op.equals(CigarOperator.H))
^
Biostar170742.java:163: cannot find symbol
symbol : variable RETURN_OK
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
return RETURN_OK;
^
Biostar170742.java:167: cannot find symbol
symbol : method wrapException(java.lang.Exception)
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
return wrapException(err);
^
Biostar170742.java:171: cannot find symbol
symbol : variable CloserUtil
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
CloserUtil.close(out);
^
Biostar170742.java:172: cannot find symbol
symbol : variable CloserUtil
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
CloserUtil.close(iter);
^
Biostar170742.java:173: cannot find symbol
symbol : variable CloserUtil
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
CloserUtil.close(sfr);
^
Biostar170742.java:174: cannot find symbol
symbol : variable CloserUtil
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
CloserUtil.close(indexedFastaSequenceFile);
^
Biostar170742.java:49: method does not override or implement a method from a supertype
@Override
^
Biostar170742.java:180: cannot find symbol
symbol : method instanceMain(java.lang.String[])
location: class com.github.lindenb.jvarkit.tools.biostar.Biostar170742
new Biostar170742().instanceMain(args);
^
42 errors

ADD REPLY
0
Entering edit mode

you didn't follow the instructions: https://github.com/lindenb/jvarkit/wiki/Biostar170742

make biostar170742
ADD REPLY
0
Entering edit mode

same problem BUILD Failed.

[mk@rainman jvarkit]$ make biostar170742
echo "Compiling htsjdk with ${JAVA_HOME} = "
Compiling htsjdk with  =
echo "Compiling htsjdk library for java. Requires  apache ANT. If it fails here, it's a not a problem with jvarkit."
Compiling htsjdk library for java. Requires  apache ANT. If it fails here, it's a not a problem with jvarkit.
echo "And ${JAVA_HOME}/bin/javac should be >=1.8"
And /bin/javac should be >=1.8
(cd /home/mk/jvarkit/htsjdk-2.0.1 && ant )
Buildfile: build.xml

write-version-property:

BUILD FAILED
/home/mk/jvarkit/htsjdk-2.0.1/build.xml:64: Problem: failed to create task or type propertyfile
Cause: the class org.apache.tools.ant.taskdefs.optional.PropertyFile was not found.
        This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
        -/usr/share/ant/lib
        -/home/mk/.ant/lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

Total time: 0 seconds
make: *** [/home/mk/jvarkit/htsjdk-2.0.1/dist/htsjdk-2.0.1.jar] Erreur 1
[mk@rainman jvarkit]$
ADD REPLY
0
Entering edit mode

as it is described "ant-optional" is missing...

try googling please.

ADD REPLY
0
Entering edit mode

forgot to put the read positions: udpated the source https://github.com/lindenb/jvarkit/commit/84dfac8015be3ae66cdb15b25618022198b8f106

ADD REPLY

Login before adding your answer.

Traffic: 1225 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6