Created
September 28, 2011 18:03
-
-
Save konrad/1248694 to your computer and use it in GitHub Desktop.
A short test to generate a test SAM file with a long read
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
base_seq = "ACGT" | |
seq = base_seq * int(int(sys.argv[1])/len(base_seq)) | |
spacer_length = 10000 | |
header = "@HD VN:1.0\n@SQ SN:Mock LN:%s" % (len(seq) + spacer_length) | |
cigar_string = "%sM" % (len(seq)) | |
genome_line = "62DJLAAXX_8:1:17056:1190 0 Mock 1 255 %s * 0 0 %s * NM:i:0 MD:Z:30 NH:i:1" % ( | |
cigar_string, seq) | |
print("\n".join([header, genome_line])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for LEN in 400000 800000 1600000 | |
do | |
python generate_sam_test.py ${LEN} > sam_test_${LEN}_nt.sam | |
samtools view -bS sam_test_${LEN}_nt.sam > sam_test_${LEN}_nt.bam | |
samtools sort sam_test_${LEN}_nt.bam sam_test_${LEN}_nt_sorted | |
rm -f sam_test_${LEN}_nt.bam | |
samtools index sam_test_${LEN}_nt_sorted.bam | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment