Giter Site home page Giter Site logo

track's People

Contributors

bow avatar delafont avatar fabdavid avatar jrougemo avatar xapple avatar yjarosz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

track's Issues

Setting start and end regions position for wig files

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...)

Track manipulations assume features have names

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.

track.load ignores source parameter for .gz files

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)

load_chr_file doesn't work?

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).

pip install from git failing

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.