You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Truvari currently (v4.2.2) will not perform sequence comparison on symbolic SVs (e.g. <DEL>). Below is a script which will replace symbolic SVs which are resolvable with reference sequence information. After 'resolving' the VCFs should be compatible with sequence comparison inside Truvari.
"""Given a VCF, fill in the <DEL>, <INV>, <DUP> ALT sequence"""importsysimportpysamimporttruvariMAX_SV=100_000_000# Filter things smaller than thisRC=str.maketrans("ATCG", "TAGC")
defdo_rc(s):
""" Reverse complement a sequence """returns.translate(RC)[::-1]
defresolve(entry, ref):
""" """ifentry.start>ref.get_reference_length(entry.chrom):
returnentryifentry.alts[0] in ['<CNV>', '<INS>']:
returnentryseq=ref.fetch(entry.chrom, entry.start, entry.stop)
ifentry.alts[0] =='<DEL>':
entry.ref=seqentry.alts= [seq[0]]
elifentry.alts[0] =='<INV>':
entry.ref=seqentry.alts= [do_rc(seq)]
elifentry.alts[0] =='<DUP>':
entry.info['SVTYPE'] ='INS'entry.ref=seq[0]
entry.alts= [seq]
entry.stop=entry.start+1returnentryif__name__=='__main__':
vcf=pysam.VariantFile(sys.argv[1])
ref=pysam.FastaFile(sys.argv[2])
n_header=vcf.header.copy()
out=pysam.VariantFile("/dev/stdout", 'w', header=n_header)
forentryinvcf:
iftruvari.entry_size(entry) >=MAX_SV:
continueifentry.alts[0].startswith("<"):
entry=resolve(entry, ref)
try:
out.write(entry)
exceptException:
sys.stderr.write(f"{entry}\n{type(entry)}\n")
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Truvari currently (v4.2.2) will not perform sequence comparison on symbolic SVs (e.g.
<DEL>
). Below is a script which will replace symbolic SVs which are resolvable with reference sequence information. After 'resolving' the VCFs should be compatible with sequence comparison inside Truvari.Beta Was this translation helpful? Give feedback.
All reactions