xapple / track Goto Github PK
View Code? Open in Web Editor NEWProvides easy read/write access to genomic tracks
Home Page: http://xapple.github.com/track/
License: GNU General Public License v3.0
Provides easy read/write access to genomic tracks
Home Page: http://xapple.github.com/track/
License: GNU General Public License v3.0
Hello, in the line 85 of the file parser/wig.py:
feature = [params['start'], params['start'] + params['span'], line]
params['start'] += params['span'] + params['step'] - 1
I think that it is wrong. Because it is using the span to set the starting position.
The right code is:
feature = [params['start'], params['start'] + params['span'] - 1, line]
params['start'] += params['step']
The explanation is here (taken from http://genome.ucsc.edu/goldenPath/help/wiggle.html)
fixedStep chrom=chr3 start=400601 step=100 span=5
11
22
33
causes the values 11, 22, and 33 to be displayed as 5-base regions on chromosome 3 at positions 400601-400605, 400701-400705, and 400801-400805, respectively.
(If we use the actual code from parser/wig.py, the positions will be 400601-400606, 400705-400709, 400809-400814, and so on...)
Hi!
I know you said you don't really maintain the package anymore, but still, I found a weird thing and thought, you might improve it... For now I did a dirty hack in my installation where necessary, but without understanding the architecture of the package it is hard to do it properly.
So, the thing is, it seems, that all the manipulations with tracks, such as overlapping, assume that features of tracks have names and 2 other fields after it.
You can see it in, for example, overlap.py file.
make_feature function from git:
def make_feature(a, b):
return (max(a[0],b[0]),
min(a[1],b[1]),
make_name(a[2], b[2]),
(a[3]+b[3])/2.0,
a[4]==b[4] and b[4] or 0) + b[5:]
It caused error on the line with a call of make_name, because there was no a[2] or b[2] in my track - the features didn't have names.
This is how my dirty function looks and causes no trouble:
def make_feature(a, b):
try:
name = make_name(a[2], b[2])
except:
try:
return (max(a[0],b[0]),
min(a[1],b[1]))
except:
raise ValueError
return (max(a[0],b[0]),
min(a[1],b[1]),
name,
(a[3]+b[3])/2.0,
a[4]==b[4] and b[4] or 0) + b[5:]
The change is quite obvious, and it solved the problem, but it is not really a good way to solve it.
Another thing, concerning fields, is that such thing doesn't work:
two_not_one = overlap(complement(track1), track2)
It causes this:
Traceback (most recent call last):
File "my_script.py", line 17, in <module>
two_not_one = overlap(complement(track1), track2)
File "/usr/local/lib/python2.7/dist-packages/track-1.2.0-py2.7-linux-x86_64.egg/track/manipulate.py", line 206, in __call__
rest_of_fields = [f for f in value.fields if f not in first_fields]
AttributeError: 'VirtualTrack' object has no attribute 'fields'
I had to comment a few line in the manipulate.py to make it work, though It probably now loses the field information from tracks (I don't have any fields except for start and end, so it is not a problem for now).
It would be really nice, if you looked into these issues.
load calls convert (passing source_format in a tuple), but this is ignored if you use a .gz file, ie:
if is_gzip(source_path): source_format = gzip_inner_format(source_path)
Maybe this should be:
if not source_format and is_gzip(source_path): source_format = gzip_inner_format(source_path)
Hi!
I am using track to analyse some BED files. I want to try to do some overlapping on them and similar things. Do I understand correctly, that to use overlap I need to load chromosome files for each track?
I am trying that and I am getting a weird error:
import track
from track.manipulate import overlap
data1 = track.load('some_file1.bed', 'bed')
data2 = track.load('some_file2.bed', 'bed')
data1.load_chr_file('chrlengths.txt')
data2.load_chr_file('chrlengths.txt')
common = overlap(data1, data2)
This returns
Traceback (most recent call last):
File "my_script.py", line 12, in <module>
data1.load_chr_file('chrlengths.txt')
File "/usr/local/lib/python2.7/dist-packages/track-1.2.0-py2.7-linux-x86_64.egg/track/__init__.py", line 1113, in load_chr_file
self.chrmeta = parse_chr_file(path)
TypeError: parse_chr_file() takes exactly 2 arguments (1 given)
I don't really know if it is a bug, but looks like one, because there is nothing in the documentation about 2 arguments for the load_chr_file function (and, actually, the error is raised in another internal function, so - no idea about the reason).
Hi,
I'm following the installation manual on documentation but it's not working:
sudo pip install -e git+https://github.com/xapple/track
--editable=git+https://github.com/xapple/track is not the right format; it must have #egg=Package
Storing debug log for failure in /home/gmarco/.pip/pip.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.