Skip to content

Commit 329160e

Browse files
author
b-schubert
committed
Merge pull request #109 from b-schubert/release_2.0
Release 2.0
2 parents 2e3c627 + 8d7e402 commit 329160e

File tree

16 files changed

+10
-1446
lines changed

16 files changed

+10
-1446
lines changed

Fred2/Core/Generator.py

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -366,108 +366,6 @@ def _generate_combinations(tId, vs, seq, usedVs, offset, isReverse=False):
366366
yield Transcript("".join(varSeq), geneid, tId, vars=varComb)
367367

368368

369-
def generate_transcripts_from_tumor_variants(normal, tumor, dbadapter, id_type):
370-
"""
371-
Generates all possible :class:`~Fred2.Core.Transcript.Transcript` variations of the given
372-
:class:`~Fred2.Core.Variant.Variant`.
373-
374-
The result is a generator.
375-
376-
:param normal: A list of variants of the normal tissue
377-
:type normal: list(:class:`~Fred2.Core.Variant.Variant`)
378-
:param tumor: A list of variant of the cancer tissue for which transcript should be generated
379-
:type tumor: list(:class:`~Fred2.Core.Variant.Variant`)
380-
:param dbadapter: a DBAdapter to fetch the transcript sequences
381-
:type dbadapter: :class:`~Fred2.IO.ADBAdapter.ADBAdapter`
382-
:param id_type: The type of the transcript IDs used in annotation of variants (e.g. REFSEQ, ENSAMBLE)
383-
:type id_type: :func:`~Fred2.IO.ADBAdapter.EIdentifierTypes`
384-
:return: A generator of transcripts with all possible variations determined by the given variant list
385-
:rtype: Generator(:class:`~Fred2.Core.Transcript.Transcript`)
386-
"""
387-
def _generate_combinations(tId, vs, seq, usedVs, offset):
388-
"""
389-
recursive variant combination generator
390-
"""
391-
transOff = generate_transcripts_from_tumor_variants.transOff
392-
#print "TransOffset ", transOff, tId,usedVs
393-
if vs:
394-
flag, v = vs.pop()
395-
396-
if v.isHomozygous:
397-
pos = v.coding[tId].tranPos + offset
398-
usedVs[pos] = v
399-
offset = _incorp.get(v.type, lambda a, b, c, d, e: e)(seq, v, tId, pos, offset)
400-
for s in _generate_combinations(tId, vs, seq, usedVs, offset):
401-
yield s
402-
else:
403-
vs_tmp = vs[:]
404-
tmp_seq = seq[:]
405-
tmp_usedVs = usedVs.copy()
406-
407-
if flag:
408-
for s in _generate_combinations(tId, vs_tmp, tmp_seq, tmp_usedVs, offset):
409-
yield s
410-
411-
# update the transcript variant id
412-
generate_transcripts_from_tumor_variants.transOff += 1
413-
pos = v.coding[tId].tranPos + offset
414-
usedVs[pos] = v
415-
416-
offset = _incorp.get(v.type, lambda a, b, c, d, e: e)(seq, v, tId, pos, offset)
417-
418-
for s in _generate_combinations(tId, vs, seq, usedVs, offset):
419-
yield s
420-
else:
421-
yield tId+":FRED2_%i"%transOff, seq, usedVs
422-
423-
#1) get all transcripts and sort the variants to transcripts
424-
425-
#For a transcript do:
426-
#A) get transcript sequences
427-
#B) generate all possible combinations of variants
428-
#C) apply variants to transcript and generate transcript object
429-
430-
if not isinstance(dbadapter, ADBAdapter):
431-
raise TypeError("The given dbadapter is not of type ADBAdapter")
432-
433-
transToVar = {}
434-
for v in tumor:
435-
for trans_id in v.coding.iterkeys():
436-
transToVar.setdefault(trans_id, []).append((False, v))
437-
438-
for v in normal:
439-
for trans_id in v.coding.iterkeys():
440-
if trans_id in transToVar:
441-
transToVar.setdefault(trans_id, []).append((True, v))
442-
443-
for tId, vs in transToVar.iteritems():
444-
query = dbadapter.get_transcript_information(tId, type=id_type)
445-
if query is None:
446-
warnings.warn("Transcript with ID %s not found in DB"%tId)
447-
continue
448-
449-
tSeq = query[EAdapterFields.SEQ]
450-
geneid = query[EAdapterFields.GENE]
451-
strand = query[EAdapterFields.STRAND]
452-
453-
#if its a reverse transcript form the complement of the variants
454-
if strand == REVERS:
455-
for flag, v in transToVar[tId]:
456-
v.ref = v.ref[::-1].translate(COMPLEMENT)
457-
v.obs = v.obs[::-1].translate(COMPLEMENT)
458-
459-
vs.sort(key=lambda (isTumor, v): v.genomePos-1
460-
if v.type in [VariationType.FSINS, VariationType.INS]
461-
else v.genomePos, reverse=True)
462-
if not _check_for_problematic_variants(map(lambda x: x[1],vs)):
463-
warnings.warn("Intersecting variants found for Transcript %s"%tId)
464-
continue
465-
466-
generate_transcripts_from_tumor_variants.transOff = 0
467-
for tId, varSeq, varComb in _generate_combinations(tId, vs, list(tSeq), {}, 0):
468-
yield Transcript("".join(varSeq), geneid, tId, vars=varComb)
469-
470-
471369
################################################################################
472370
# T R A N S C R I P T = = > P R O T E I N
473371
################################################################################

Fred2/Distance2Self/Distance2Self.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

Fred2/Distance2Self/DistanceMatrix.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

Fred2/Distance2Self/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

Fred2/Distance2Self/hw.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.

Fred2/Distance2Self/src/Matrix.hpp

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)