This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Conversion From Sam To Bed With Max Information

I am trying to convert my sam file into bed file in such a way that i will keep some information from the sam file.

I am primarily interested in keeping the actual short sequences in the bed format so that i do not lose track.

I used sam to bam and then bedtools but i ended up getting something like this

chr1 123 456 0 255 +

I have so many short sequences and how will i know which of my sequence is which

sam bam conversion bed

Why? Why do you want to do that? There is very likely a better way to go about things. While you could probably shove either the read name or the sequence into the 4th column, that's probably just a waste of space.

I sorted this sompy by changinf the input file when i create the sam file. So it is sorted now. Thanks

Ummm, that doesn't parse, but OK.

2 answers

Change the input file format to include the names

Version 2.4 of BEDOPS sam2bed preserves all read columns. Add the --keep-header option to preserve the header section.

To use, briefly:

$ sam2bed --keep-header < myReads.sam > mySortedReadsWithHeader.bed

Log in to answer this question.