Skip to content

Commit

Permalink
modification for pysam 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
friend1ws committed Oct 11, 2016
1 parent 2ce0422 commit 94075a7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GenomonSV
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import argparse
# top level parser
parser = argparse.ArgumentParser(prog = "GenomonSV", formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("--version", action = "version", version = "GenomonSV-0.4.1")
parser.add_argument("--version", action = "version", version = "GenomonSV-0.4.2rc")

subparsers = parser.add_subparsers()

Expand Down
27 changes: 26 additions & 1 deletion lib/genomonsv/realignmentFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(int(juncPos2) + validate_sequence_length)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(int(juncPos2) + validate_sequence_length), '')

print >> hOUT, '>' + ','.join([juncChr1, str(juncPos1), juncDir1, juncChr2, str(juncPos2), juncDir2]) + "_ref"
print >> hOUT, seq
Expand All @@ -224,12 +226,16 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(juncPos1)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(juncPos1), '')

seq = seq + juncSeq

for item in pysam.faidx(reference_genome, juncChr2 + ":" + str(juncPos2) + "-" + str(int(juncPos2) + validate_sequence_length)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr2 + ":" + str(juncPos2) + "-" + str(int(juncPos2) + validate_sequence_length), '')

print >> hOUT, '>' + ','.join([juncChr1, str(juncPos1), juncDir1, juncChr2, str(juncPos2), juncDir2]) + "_alt"
print >> hOUT, seq
Expand All @@ -240,12 +246,16 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(juncPos2)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(juncPos2), '')

seq = seq + juncSeq

for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(juncPos1) + "-" + str(int(juncPos1) + validate_sequence_length)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr1 + ":" + str(juncPos1) + "-" + str(int(juncPos1) + validate_sequence_length), '')

print >> hOUT, '>' + ','.join([juncChr1, str(juncPos1), juncDir1, juncChr2, str(juncPos2), juncDir2]) + "_alt"
print >> hOUT, seq
Expand All @@ -257,6 +267,8 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(int(juncPos1) + validate_sequence_length)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()
seq = seq.replace('>', '')
seq = seq.replace(juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(int(juncPos1) + validate_sequence_length), '')

print >> hOUT, '>' + ','.join([juncChr1, str(juncPos1), juncDir1, juncChr2, str(juncPos2), juncDir2]) + "_ref1"
print >> hOUT, seq
Expand All @@ -265,7 +277,9 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(int(juncPos2) + validate_sequence_length)):
if item[0] == ">": continue
seq = seq + item.rstrip('\n').upper()

seq = seq.replace('>', '')
seq = seq.replace(juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(int(juncPos2) + validate_sequence_length), '')

print >> hOUT, '>' + ','.join([juncChr1, str(juncPos1), juncDir1, juncChr2, str(juncPos2), juncDir2]) + "_ref2"
print >> hOUT, seq

Expand All @@ -276,11 +290,16 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(juncPos1)):
if item[0] == ">": continue
tseq = tseq + item.rstrip('\n').upper()
tseq = tseq.replace('>', '')
tseq = tseq.replace(juncChr1 + ":" + str(int(juncPos1) - validate_sequence_length) + "-" + str(juncPos1), '')
else:
tseq = ""
for item in pysam.faidx(reference_genome, juncChr1 + ":" + str(juncPos1) + "-" + str(int(juncPos1) + validate_sequence_length)):
if item[0] == ">": continue
tseq = tseq + item.rstrip('\n').upper()
tseq = tseq.replace('>', '')
tseq = tseq.replace(juncChr1 + ":" + str(juncPos1) + "-" + str(int(juncPos1) + validate_sequence_length), '')

tseq = utils.reverseComplement(tseq)

seq = tseq + juncSeq
Expand All @@ -290,11 +309,17 @@ def getRefAltForSV(outputFilePath, juncChr1, juncPos1, juncDir1, juncChr2, juncP
for item in pysam.faidx(reference_genome, juncChr2 + ":" + str(juncPos2) + "-" + str(int(juncPos2) + validate_sequence_length)):
if item[0] == ">": continue
tseq = tseq + item.rstrip('\n').upper()
tseq = tseq.replace('>', '')
tseq = tseq.replace(juncChr2 + ":" + str(juncPos2) + "-" + str(int(juncPos2) + validate_sequence_length), '')

else:
tseq = ""
for item in pysam.faidx(reference_genome, juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(juncPos2)):
if item[0] == ">": continue
tseq = tseq + item.rstrip('\n').upper()
tseq = tseq.replace('>', '')
tseq = tseq.replace(juncChr2 + ":" + str(int(juncPos2) - validate_sequence_length) + "-" + str(juncPos2), '')

tseq = utils.reverseComplement(tseq)

seq = seq + tseq
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name='genomonsv',
version='0.4.1',
version='0.4.2rc',
description='Python tools for detecting somatic structural variation from cancer genome sequencing data.',
author='Yuichi Shiraishi',
author_email='[email protected]',
Expand Down

0 comments on commit 94075a7

Please sign in to comment.