Skip to content

Commit

Permalink
fixed bug identified in issue 12
Browse files Browse the repository at this point in the history
  • Loading branch information
billgreenwald committed Oct 8, 2022
1 parent eb4f417 commit 5662fa4
Show file tree
Hide file tree
Showing 33 changed files with 4,122 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*/*ipynb
*ipynb
*.ipynb
*/.ipynb*
*/*/.ipynb*
10 changes: 10 additions & 0 deletions Module/PyGLtools.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: PyGLtools
Version: 2.1.7
Summary: A python module of the pgltools tool suite
Home-page: http://github.com/billgreenwald/pgltools
Author: Bill Young Greenwald
Author-email: billgreenwald@ucsd.edu
License: BSD-3-clause
Description: UNKNOWN
Platform: UNKNOWN
28 changes: 28 additions & 0 deletions Module/PyGLtools.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
README.md
setup.cfg
setup.py
PyGLtools/__init__.py
PyGLtools/browser.py
PyGLtools/closest.py
PyGLtools/closest1D.py
PyGLtools/column_flip.py
PyGLtools/condense.py
PyGLtools/conveRt.py
PyGLtools/coverage.py
PyGLtools/expand.py
PyGLtools/findLoops.py
PyGLtools/formatTripSparse.py
PyGLtools/intersect.py
PyGLtools/intersect1D.py
PyGLtools/juicebox.py
PyGLtools/merge.py
PyGLtools/pgltools_library.py
PyGLtools/samTopgl.py
PyGLtools/subtract.py
PyGLtools/subtract1D.py
PyGLtools/window.py
PyGLtools.egg-info/PKG-INFO
PyGLtools.egg-info/SOURCES.txt
PyGLtools.egg-info/dependency_links.txt
PyGLtools.egg-info/not-zip-safe
PyGLtools.egg-info/top_level.txt
1 change: 1 addition & 0 deletions Module/PyGLtools.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Module/PyGLtools.egg-info/not-zip-safe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Module/PyGLtools.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PyGLtools
405 changes: 405 additions & 0 deletions Module/PyGLtools/.ipynb_checkpoints/intersect1D-checkpoint.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Module/PyGLtools/intersect1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _overlap1D(contactsA,bedB,useBAnnots,useAllAnnots,aLocations,dist,dashV,repo
else:
if chrA1 in bedB:
for k in range(len(bedB[chrA1])):

Aannots=contactsA[i][6][:]
chrB=chrA1
startB=max(bedB[chrB][k][0],0)
endB=bedB[chrB][k][1]
Expand Down Expand Up @@ -213,7 +213,7 @@ def _overlap1D(contactsA,bedB,useBAnnots,useAllAnnots,aLocations,dist,dashV,repo
newPeaks.append([[chr1,start1,end1,chr2,start2,end2,"A"],Aannots])
if chrA2 in bedB:
for k in range(len(bedB[chrA2])):

Aannots=contactsA[i][6][:]
chrB=chrA2
startB=max(bedB[chrB][k][0],0)
endB=bedB[chrB][k][1]
Expand Down
197 changes: 197 additions & 0 deletions Module/build/lib/PyGLtools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@

# coding: utf-8

# In[2]:

import browser as _brow
import closest as _clos2d
import closest1D as _clos1d
import condense as _cond
import conveRt as _conv
import coverage as _cov
import expand as _expa
import findLoops as _fl
import intersect as _inter2d
import intersect1D as _inter1d
import juicebox as _jb
import merge as _mer
import subtract as _subtr2d
import subtract1D as _subtr1d
import window as _wind
import pgltools_library as _pgltl
del pgltools_library


# In[1]:

def read_PGL(FilePath):
"""Takes a file path and returns a header and PyGL object of the pgl file. Recommended use is header,pgl=read_PGL(FilePath)"""
return _pgltl.processFile(FilePath)


# In[ ]:

def read_Bed(FilePath):
"""Takes a file path and returns a header and PyGL-bed object of the pgl file. Recommended use is header,pgl=read_PGL(FilePath)"""
return _pgltl.processBedFile(FilePath)


# In[ ]:

def _cs(pgl):
return _pgltl.checkSorted(pgl)


# In[56]:

def pyglSort(PGL):
"""Takes a PyGL object and returns a sorted PyGL object"""
return sorted(PGL,key=lambda x:(x[0],x[1],x[2],x[3],x[4],x[5]))


# In[2]:

def browser(PGL,N=0,S=0,P=0,Q=0,tN='pgl_track'):
"""Takes a PyGL object and returns a string formatted for the UCSC genome browser."""
return _brow.browser(PGL,N,S,P,Q,tN)


# In[3]:

def closest1D(PGL,BED,ba=False):
"""Takes a PyGL object and a PyGL-bed object and returns a PyGL object resulting from the closest1D operation"""
args={'ba':ba}
return _clos1d.closest1D(PGL,BED,args)


# In[4]:

def closest2D(A,B):
"""Takes two PyGL objects and returns a PyGL object resulting from the closest operation"""
return _clos2d.closest2D(A,B)


# In[72]:

def condense(PGL,asObject=False):
"""Takes a PyGL object and returns a string or PyGL-bed object resulting from the condense operation"""
t=[]
for i in range(len(PGL)):
t1=[str(y) for y in PGL[i][:6]]
t1.extend([str(y) for y in PGL[i][6]])
t.append(t1)
return _cond.condense(t,asObject=asObject)


# In[6]:

def conveRt(PGL,C=0,P=0,Q=0):
"""Takes a PyGL object and returns a string formatted by the conveRt operation"""
args={'C':C,'P':0,'Q':0}
return _conv.conveRt(PGL,args)


# In[7]:

def coverage(A,B,z=False):
"""Takes two PyGL objects and returns a PyGL object resulting from the coverage operation"""
if _cs(A)!=0:
print "A is not sorted. Please use a pyglSort."
return
if _cs(B)!=0:
print "B is not sorted. Please use a pyglSort."
return
args={'z':z}
return _cov.coverage(A,B,"",args)


# In[8]:

def expand(PGL,d=0,genome={}):
"""Takes a PyGL object and returns a PyGL object resulting from the expand operation"""
args={'d':d}
return _expa.expand(PGL,args,genome)


# In[9]:

def findLoops(PGL):
"""Takes a PyGL object and returns a PyGL-bed object resulting from the findLoops operation"""
return _fl.findLoops(PGL)


# In[10]:

def intersect2D(A,B,d=0,v=False,bA=False,allA=False,m=False,mc=False,u=False,wa=False,wb=False,wo=False):
"""Takes two PyGL objects and returns a PyGL object resulting from the intersect operation"""
if _cs(A)!=0:
print "A is not sorted. Please use a pyglSort."
return
if _cs(B)!=0:
print "B is not sorted. Please use a pyglSort."
return
args={'d':d,'v':v,'bA':bA,'allA':allA,'m':m,'mc':mc,'u':u,'wa':wa,'wb':wb,'wo':wo}
return _inter2d.intersect2D(A,B,args,"")


# In[11]:

def intersect1D(PGL,BED,bA=False,allA=False,wa=False,wb=False,v=False,u=False,d=0):
"""Takes a PyGL object and a PyGL-bed object and returns a PyGL object resulting from the intersect1D operation"""
if _cs(PGL)!=0:
print "The PyGL supplied is not sorted. Please use a pyglSort."
return
args={'bA':bA,'allA':allA,'wa':wa,'wb':wb,'v':v,'u':u,'d':d,}
return _inter1d.intersect1D(PGL,BED,args,"","")


# In[12]:

def juicebox(PGL,N=0,C=0):
"""Takes a PyGL object and returns a string formatted by the juicebox operation"""
args={'N':N,'C':C}
return _jb.juicebox(PGL,args)


# In[13]:

def merge(PGL,c="%#$",o="%#$",delim=',',d=0):
"""Takes a PyGL object and returns a PyGL object resulting from the merge operation"""
if _cs(PGL)!=0:
print "The PyGL supplied is not sorted. Please use a pyglSort."
return
args={'c':c,'o':o,'delim':delim,'d':d,'noH':True}
return _mer.merge(PGL,args,"")


# In[35]:

def subtract2D(A,B):
"""Takes two PyGL objects and returns a PyGL object resulting from the subtract operation"""
if _cs(A)!=0:
print "A is not sorted. Please use a pyglSort."
return
if _cs(B)!=0:
print "B is not sorted. Please use a pyglSort."
return
return _subtr2d.subtract2D(A,B,{},"")


# In[46]:

def subtract1D(PGL,BED):
"""Takes a PyGL object and a PyGL-bed object and returns a PyGL object resulting from the subtract1D operation"""
if _cs(PGL)!=0:
print "The PyGL supplied is not sorted. Please use a pyglSort."
return
return _subtr1d.subtract1D(PGL,BED,{},"")


# In[50]:

def window(PGL,window1="%#$",window2="%#$"):
"""Takes a PyGL object and returns a PyGL object resulting from the window operation"""
args={'window1':window1,'window2':window2}
return _wind.window(PGL,args)


Loading

0 comments on commit 5662fa4

Please sign in to comment.