bam-readcount parser
- Python3.7
- Std python libs
cat test.tsv
20 333333330 G 1053 =:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 A:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 C:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 G:1053:60.00:35.84:0.23:523:530:0.50:0.00:4.89:672:0.48:123.92:0.50 T:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 N:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00
20 4444444401 A 1055 =:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 A:1049:60.00:33.20:0.17:526:523:0.50:0.00:4.84:671:0.49:123.92:0.50 C:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 G:6:60.00:17.83:10.00:0:6:0.28:0.02:26.00:5:0.07:124.33:0.05 T:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 N:0:0.00:0.00:0.00:0:0:0.00:0.00:0.00:0:0.00:0.00:0.00 +G:4:60.00:0.00:0.00:3:1:0.64:0.03:21.25:3:0.54:121.25:0.54
python brc-parser.py test.tsv
cat test_parsed.csv
position,chr,ref,depth,count,base,positive_strand,negative_strand,percent_bias,vaf,mutation
333333330,20,G,1053,0,(A),0,0,0,0,snv
333333330,20,G,1053,0,(C),0,0,0,0,snv
333333330,20,G,1053,1053,(G),523,530,0.5,1.0,no-mutation
333333330,20,G,1053,0,(T),0,0,0,0,snv
333333330,20,G,1053,0,(N),0,0,0,0,snv
4444444401,20,A,1055,1049,(A),526,523,0.5,0.99,no-mutation
4444444401,20,A,1055,0,(C),0,0,0,0,snv
4444444401,20,A,1055,6,(G),0,6,0.0,0.01,snv
4444444401,20,A,1055,0,(T),0,0,0,0,snv
4444444401,20,A,1055,0,(N),0,0,0,0,snv
4444444401,20,A,1055,4,(+G),3,1,0.75,0.0,ins