[glu-genetics] 2 new revisions pushed by bioinformed@gmail.com on 2012-10-31 22:47 GMT

3 views
Skip to first unread message

glu-ge...@googlecode.com

unread,
Oct 31, 2012, 6:48:06 PM10/31/12
to glu...@googlegroups.com
2 new revisions:

Revision: 8fcf3f7cbf04
Branch: default
Author: Kevin B. Jacobs <jac...@bioinformed.com>
Date: Tue Sep 4 05:21:11 2012
Log: Remove dead code and options.
http://code.google.com/p/glu-genetics/source/detail?r=8fcf3f7cbf04

Revision: c8f2e3411652
Branch: default
Author: Kevin B. Jacobs <jac...@bioinformed.com>
Date: Wed Oct 31 15:46:14 2012
Log: Add extra defensive encoding checks
http://code.google.com/p/glu-genetics/source/detail?r=c8f2e3411652

==============================================================================
Revision: 8fcf3f7cbf04
Branch: default
Author: Kevin B. Jacobs <jac...@bioinformed.com>
Date: Tue Sep 4 05:21:11 2012
Log: Remove dead code and options.
http://code.google.com/p/glu-genetics/source/detail?r=8fcf3f7cbf04

Modified:
/glu/modules/seq/filter.py

=======================================
--- /glu/modules/seq/filter.py Fri Jun 22 10:19:41 2012
+++ /glu/modules/seq/filter.py Tue Sep 4 05:21:11 2012
@@ -22,7 +22,6 @@
from glu.lib.progressbar import progress_loop

from glu.lib.seqlib.bed import read_features
-from glu.lib.seqlib.cigar import fix_cigar_bam, cigar_bam_str
from glu.lib.seqlib.filter import alignment_filter_options,
filter_alignments


@@ -48,21 +47,6 @@
return _set_readgroup()


-from glu.lib.seqlib.edits import reduce_match
-
-def fix_cigar_indels(aligns):
- for align in aligns:
- if align.tid>=0:
- #before = align.cigar
- align.cigar = fix_cigar_bam(align.cigar)
- #if align.cigar is not before:
- # print 'BEFORE:',cigar_bam_str(before)
- # print 'AFTER: ',cigar_bam_str(align.cigar)
- # print
-
- yield align
-
-
def contig_stats(aligns,references,filename):
stats = [0]*len(references)
for align in aligns:
@@ -471,16 +455,13 @@
src_offset = int(src_offset or 0)
dst_len = int(dst_len)

- if src!=dst or offset:
+ if src!=dst or src_offset:
remap[src] = dst,src_offset,dst_len

return remap


def remap_contigs(header, references, lengths, alignments, remap):
- src_remapped = set(r for r in references if r in remap)
- dst_remapped = [ remap[r] for r in sorted(src_remapped) ]
-
tidmap = {}
new_references = []
new_lengths = []
@@ -545,9 +526,6 @@
parser.add_argument('--setreadgroup', type=str, metavar='RGNAME',
help='Set all reads to specified read group name')

- parser.add_argument('--fixindels', action='store_true',
- help='Fix insertions adjacent to deletions and set
them to mismatches.')
-
parser.add_argument('--remapcontig', metavar='FILE',
help='Remap contigs from original to new contigs with
an offset location')

@@ -627,9 +605,6 @@
if options.setreadgroup:
aligns = set_readgroup(options.setreadgroup,header,aligns)

- if options.fixindels:
- aligns = fix_cigar_indels(aligns)
-
flags = 'wb' if options.output.endswith('.bam') else 'wh'

outbam = pysam.Samfile(options.output, flags, header=header,

==============================================================================
Revision: c8f2e3411652
Branch: default
Author: Kevin B. Jacobs <jac...@bioinformed.com>
Date: Wed Oct 31 15:46:14 2012
Log: Add extra defensive encoding checks
http://code.google.com/p/glu-genetics/source/detail?r=c8f2e3411652

Modified:
/glu/modules/convert/from_lbd.py

=======================================
--- /glu/modules/convert/from_lbd.py Sat Jul 30 20:35:40 2011
+++ /glu/modules/convert/from_lbd.py Wed Oct 31 15:46:14 2012
@@ -62,12 +62,21 @@

descr = build_descr(model,len(loci))

+ seen = set()
+
for lname in loci:
+ if lname in seen:
+ raise ValueError('Duplicate locus %s in LBD file' % lname)
+ else:
+ seen.add(lname)
+
genome.merge_locus(lname, model)

def _encode(descr):
for sampleid,genos,gcscores in samples:
genos = GenotypeArray(descr, imap(getitem, repeat(genomap), genos))
+ if not genos.check_encoding():
+ raise ValueError('Invalid input genotype encoding (should not
happen)')
yield sampleid,genos

return GenomatrixStream(_encode(descr), 'sdat', loci=loci,
models=list(descr),
@@ -104,9 +113,12 @@

def _recode():
descr = GenotypeArrayDescriptor(models)
+
for sample,row in genos:
new_row = GenotypeArray(descr)
new_row.data = row.data
+ if not new_row.check_encoding():
+ raise ValueError('Invalid output encoding (should not happen)')
yield sample,new_row

return genos.clone(_recode(), models=models, genome=genome,
materialized=False)
Reply all
Reply to author
Forward
0 new messages