import sys,getopt | |||||
import os | |||||
import fileinput | |||||
outFile = open(sys.argv[2],'w') | |||||
for line in fileinput.input(sys.argv[1]): | |||||
line = line.rstrip() | |||||
strings = line.strip().split('\t') | |||||
#d5 | |||||
if ',' in strings[6]: | |||||
alt_strings = strings[6].split(',') | |||||
alt_len = [len(i) for i in alt_strings] | |||||
alt = max(alt_len) | |||||
else: | |||||
alt = len(strings[6]) | |||||
ref = strings[5] | |||||
pos = int(strings[1]) | |||||
if len(ref) == 1 and alt == 1: | |||||
StartPos = int(pos) -1 | |||||
EndPos = int(pos) | |||||
cate = 'SNV' | |||||
elif len(ref) > alt: | |||||
StartPos = int(pos) - 1 | |||||
EndPos = int(pos) + (len(ref) - 1) | |||||
cate = 'INDEL' | |||||
elif alt > len(ref): | |||||
StartPos = int(pos) - 1 | |||||
EndPos = int(pos) + (alt - 1) | |||||
cate = 'INDEL' | |||||
elif len(ref) == alt: | |||||
StartPos = int(pos) - 1 | |||||
EndPos = int(pos) + (alt - 1) | |||||
cate = 'INDEL' | |||||
outline = '\t'.join(strings) + '\t' + str(StartPos) + '\t' + str(EndPos) + '\t' + cate + '\n' | |||||
outFile.write(outline) | |||||
{ | { | ||||
"{{ project_name }}.right_200": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.200", | "{{ project_name }}.right_200": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.200", | ||||
"{{ project_name }}.left_100": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.100", | "{{ project_name }}.left_100": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.100", | ||||
"{{ project_name }}.MIEpos2bed.docker": "registry-vpc.cn-shanghai.aliyuncs.com/pgx-docker-registry/high_confidence_call_manuscript:v1.4", | |||||
"{{ project_name }}.disk_size": "100", | "{{ project_name }}.disk_size": "100", | ||||
"{{ project_name }}.right_50": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.50", | "{{ project_name }}.right_50": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.50", | ||||
"{{ project_name }}.chromo": "chr6", | "{{ project_name }}.chromo": "chr6", | ||||
"{{ project_name }}.inputSamplesFile": "{{ inputSamplesFile }}", | "{{ project_name }}.inputSamplesFile": "{{ inputSamplesFile }}", | ||||
"{{ project_name }}.right_100": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.100", | "{{ project_name }}.right_100": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.right.100", | ||||
"{{ project_name }}.left_150": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.150", | "{{ project_name }}.left_150": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.150", | ||||
"{{ project_name }}.docker": "registry-internal.cn-shanghai.aliyuncs.com/pgx-docker-registry/bedtools:v2.27.1", | |||||
"{{ project_name }}.left_200": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.200", | "{{ project_name }}.left_200": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.200", | ||||
"{{ project_name }}.bedCoverage.docker": "registry-internal.cn-shanghai.aliyuncs.com/pgx-docker-registry/bedtools:v2.27.1", | |||||
"{{ project_name }}.left_50": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.50", | "{{ project_name }}.left_50": "oss://pgx-result/renluyao/manuscript/small_variants_near_SV/chr6.ins.left.50", | ||||
"{{ project_name }}.cluster_config": "OnDemand bcs.a2.large img-ubuntu-vpc" | "{{ project_name }}.cluster_config": "OnDemand bcs.a2.large img-ubuntu-vpc" | ||||
} | } |
command <<< | command <<< | ||||
cat ${mie_file} | awk '{print $1"\t"$2"\t"$2}' > ${sample_name}.${chromo}.allvariants.bed | |||||
python /opt/vcf2bed.py ${mie_file} ${sample_name}.${chromo}.info.txt | |||||
cat ${mie_file} | grep -v '1:1:1' | awk '{print $1"\t"$2"\t"$2}' > ${sample_name}.${chromo}.mie.bed | |||||
cat ${mie_file} | awk '{ if ($3 == 0) { print } }' | cut -f1,8,9 > ${sample_name}.${chromo}.allvariants.bed | |||||
cat ${mie_file} | awk '{ if ($3 == 0) { print } }' | grep 'MIE' | cut -f1,8,9 > ${sample_name}.${chromo}.mie.bed | |||||
>>> | >>> | ||||
dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/" | dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/" | ||||
} | } | ||||
output { | output { | ||||
File info = "${sample_name}.${chromo}.info.txt" | |||||
File mie_bed = "${sample_name}.${chromo}.mie.bed" | File mie_bed = "${sample_name}.${chromo}.mie.bed" | ||||
File all_bed = "${sample_name}.${chromo}.allvariants.bed" | File all_bed = "${sample_name}.${chromo}.allvariants.bed" | ||||
} | } |
File right_150 | File right_150 | ||||
File right_200 | File right_200 | ||||
String chromo | String chromo | ||||
String docker | |||||
String cluster_config | String cluster_config | ||||
String disk_size | String disk_size | ||||
mie_file=sample[0], | mie_file=sample[0], | ||||
chromo=chromo, | chromo=chromo, | ||||
sample_name=sample[1], | sample_name=sample[1], | ||||
docker=docker, | |||||
cluster_config=cluster_config, | cluster_config=cluster_config, | ||||
disk_size=disk_size | disk_size=disk_size | ||||
} | } | ||||
right_200=right_200, | right_200=right_200, | ||||
sample_name=sample[1], | sample_name=sample[1], | ||||
chromo=chromo, | chromo=chromo, | ||||
docker=docker, | |||||
cluster_config=cluster_config, | cluster_config=cluster_config, | ||||
disk_size=disk_size | disk_size=disk_size | ||||
} | } |