Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Sequencing.Ace.ACEFileRecord Class Reference

List of all members.

Public Member Functions

def __init__
def sort

Public Attributes

 ncontigs
 nreads
 contigs
 wa

Detailed Description

Holds data of an ACE file.

Definition at line 448 of file Ace.py.


Constructor & Destructor Documentation

Definition at line 451 of file Ace.py.

00451 
00452     def __init__(self):
00453         self.ncontigs=None
00454         self.nreads=None
00455         self.contigs=[]
00456         self.wa=None    # none or many


Member Function Documentation

Sorts wr, rt and ct tags into the appropriate contig / read instance, if possible.  

Definition at line 457 of file Ace.py.

00457 
00458     def sort(self):
00459         """Sorts wr, rt and ct tags into the appropriate contig / read instance, if possible.  """
00460        
00461         ct=[]
00462         rt=[]
00463         wr=[]
00464         # search for tags that aren't in the right position
00465         for i in range(len(self.contigs)):
00466             c = self.contigs[i]
00467             if c.wa:
00468                 if not self.wa:
00469                     self.wa=[]
00470                 self.wa.extend(c.wa)
00471             if c.ct:
00472                 newcts=[ct_tag for ct_tag in c.ct if ct_tag.name!=c.name]
00473                 for x in newcts:
00474                     self.contigs[i].ct.remove(x)
00475                 ct.extend(newcts)
00476             for j in range(len(c.reads)):
00477                 r = c.reads[j]
00478                 if r.rt:
00479                     newrts=[rt_tag for rt_tag in r.rt if rt_tag.name!=r.rd.name]
00480                     for x in newrts:
00481                         self.contigs[i].reads[j].rt.remove(x)
00482                     rt.extend(newrts)
00483                 if r.wr:
00484                     newwrs=[wr_tag for wr_tag in r.wr if wr_tag.name!=r.rd.name]
00485                     for x in newwrs:
00486                         self.contigs[i].reads[j].wr.remove(x)
00487                     wr.extend(newwrs)
00488         # now sort them into their proper place
00489         for i in range(len(self.contigs)):
00490             c = self.contigs[i]
00491             for ct_tag in ct:
00492                 if ct_tag.name==c.name:
00493                     if self.contigs[i].ct is None:
00494                         self.contigs[i].ct=[]
00495                     self.contigs[i].ct.append(ct_tag)
00496             if rt or wr:
00497                 for j in range(len(c.reads)):
00498                     r = c.reads[j]
00499                     for rt_tag in rt:
00500                         if rt_tag.name==r.rd.name:
00501                             if self.contigs[i].reads[j].rt is None:
00502                                 self.contigs[i].reads[j].rt=[]
00503                             self.contigs[i].reads[j].rt.append(rt_tag)
00504                     for wr_tag in wr:
00505                         if wr_tag.name==r.rd.name:
00506                             if self.contigs[i].reads[j].wr is None:
00507                                 self.contigs[i].reads[j].wr=[]
00508                             self.contigs[i].reads[j].wr.append(wr_tag)
       

Member Data Documentation

Definition at line 454 of file Ace.py.

Definition at line 452 of file Ace.py.

Definition at line 453 of file Ace.py.

Definition at line 455 of file Ace.py.


The documentation for this class was generated from the following file: