Giter Club home page Giter Club logo

isotools's Introduction

tests docs PyPI PyPIDownloadsTotal Licence: MIT

IsoTools

IsoTools is a python module for Long Read Transcriptome Sequencing (LRTS) analysis.

Key features:

  • Import of LRTS bam files (aligned full length transcripts).
  • Import of reference annotation in gff3/gtf format.
  • Computation of quality control metrics.
  • Annotation and classification of novel transcripts with biologically motivated classification scheme.
  • Definition of alternative splicing events based on segment graphs.
  • Detection of differential alternative splicing between samples and groups of samples.
  • Data visualization.

documentation:

The documentation, including tutorials with real-world case studies and the complete API reference is available at readthedocs

installation:

Isotools is available from PyPI, and can be installed with the pip command:

python3 -m pip install isotools

Alternatively, to install from github, use the following command:

git clone https://github.com/MatthiasLienhard/isotools.git
cd isotools
python3 -m pip install .

usage:

This code block demonstrates the basic file import with IsoTools. It uses a small test data set contained in this repository, and should run within seconds. The paths are relative to the root of the repository. For more comprehensive real world examples see the tutorials.

from  isotools import Transcriptome
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
# import the reference annotation
isoseq = Transcriptome.from_reference('tests/data/example.gff.gz')
# import the isoseq data
for sa in ('CTL', 'VPA'):
    isoseq.add_sample_from_bam(f'../tests/data/example_1_{sa}.bam', sample_name=sa, group=sa, platform='SequelII')
# save the imported file as pkl file (for faster import)
isoseq.add_qc_metrics('../tests/data/example.fa')
isoseq.save('../tests/data/example_1_isotools.pkl')

Citation and feedback:

  • If you run into any issues, please use the github issues report feature.
  • For general feedback, please write me an email to [email protected].
  • If you use isotools in your publication, please cite the following paper: Lienhard et al, Bioinformatics, 2023: IsoTools: a flexible workflow for long-read transcriptome sequencing analysis

isotools's People

Contributors

carmineceraolo avatar matthiaslienhard avatar tensulin avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

isotools's Issues

gff file incompatibility?

Hi Matthias,
Thank you for making such a nice tool!
I would be interested to use it but I cannot seem to format my gff so that it would be compatible.
What version of tabix should I be using?

I'm getting the following error;
annotation_fn=f'sorted_fixed_input.gff3.gz' #create the IsoTools transcriptome object from the reference annotation isoseq=Transcriptome.from_reference(annotation_fn)

  0%|                                                                                       | 0.00/15.1M [00:00<?, ?B/s]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[8], line 3
      1 annotation_fn=f'sorted_fixed_input.gff3.gz'
      2 #create the IsoTools transcriptome object from the reference annotation
----> 3 isoseq=Transcriptome.from_reference(annotation_fn)

File ~/anaconda3/envs/metacell/lib/python3.11/site-packages/isotools/transcriptome.py:55, in Transcriptome.from_reference(cls, reference_file, file_format, **kwargs)
     53 tr = cls()
     54 tr.chimeric = {}
---> 55 tr.data = import_ref_transcripts(reference_file, tr, file_format,  **kwargs)
     56 tr.infos = {'reference_file': reference_file, 'isotools_version': __version__}
     57 tr.filter = {'gene': DEFAULT_GENE_FILTER.copy(),
     58              'transcript': DEFAULT_TRANSCRIPT_FILTER.copy(),
     59              'reference': DEFAULT_REF_TRANSCRIPT_FILTER.copy()}

File ~/anaconda3/envs/metacell/lib/python3.11/site-packages/isotools/_transcriptome_io.py:1064, in import_ref_transcripts(fn, transcriptome, file_format, chromosomes, gene_categories, short_exon_th, **kwargs)
   1062     exons, transcripts, gene_infos, cds_start, cds_stop, skipped = _read_gtf_file(fn, chromosomes, **kwargs)
   1063 else:  # gff/gff3
-> 1064     exons, transcripts, gene_infos, cds_start, cds_stop, skipped = _read_gff_file(fn, chromosomes, **kwargs)
   1066 if skipped:
   1067     logger.info('skipped the following categories: %s', skipped)

File ~/anaconda3/envs/metacell/lib/python3.11/site-packages/isotools/_transcriptome_io.py:1012, in _read_gff_file(file_name, chromosomes, progress_bar)
   1010 with tqdm(total=path.getsize(file_name), unit_scale=True, unit='B', unit_divisor=1024, disable=not progress_bar) as pbar, TabixFile(file_name) as gff:
   1011     chrom_ids = get_gff_chrom_dict(gff, chromosomes)
-> 1012     for line in gff.fetch():
   1013         file_pos = gff.tell() >> 16  # the lower 16 bit are the position within the zipped block
   1014         if pbar.n < file_pos:

File ~/anaconda3/envs/metacell/lib/python3.11/site-packages/pysam/libctabix.pyx:499, in pysam.libctabix.TabixFile.fetch()

ValueError: could not create iterator, possible tabix version mismatch

Thank you very much for your help,
Best,
Ruth

AssertionError

Hello, I'm running IsoTools in command line and keep getting an AssertionError with the TALAM1 gene after sample import. Is this something on my end? Does it have to do with the annotation I'm using? I previously ran IsoTools with just 2 mouse samples and it worked just fine, so I'm not sure if it's something to do with my human genome/reference and/or samples. Any help would be appreciated!

samples='samples.txt'
anno='gencode.v43.annotation.gtf'
genome='GRCh38.primary_assembly.genome.fa'

run_isotools
--anno $anno
--log INFO
--progress_bar
--genome $genome
--samples $samples
--file_prefix ./isotools
--group_by group
--diff
--diff_plots 5
--diff NT/KD

59%|███████████████████████████████████████████████████▋ | 142870/243415 [1:21:17<57:12, 29.29genes/s]2023-06-15 19:14:41 ERROR: Gene TALAM1 chr11:65499311-65507432(-), 1 reference transcripts, 150 expressed transcripts TSS= {'hNT1': {65504026: 1}}, PAS={'hNT1': {65500537: 1}} -> TSS_unified= {'hNT1': {65500848: 1}}, PAS_unified={'hNT1': {65500537: 1}}
59%|███████████████████████████████████████████████████▋ | 142884/243415 [1:21:17<57:11, 29.30genes/s]
Traceback (most recent call last):
File "/home/data/Megan/anaconda3/bin/run_isotools", line 8, in
sys.exit(main())
File "/home/data/Megan/anaconda3/lib/python3.9/site-packages/isotools/run_isotools.py", line 66, in main
isoseq = load_isoseq(args)
File "/home/data/Megan/anaconda3/lib/python3.9/site-packages/isotools/run_isotools.py", line 155, in load_isoseq
isoseq.add_qc_metrics(args.genome, progress_bar=args.progress_bar)
File "/home/data/Megan/anaconda3/lib/python3.9/site-packages/isotools/_transcriptome_filter.py", line 68, in add_qc_metrics
g._unify_ends()
File "/home/data/Megan/anaconda3/lib/python3.9/site-packages/isotools/gene.py", line 897, in _unify_ends
assert end > tr['exons'][-1][0] or len(tr['exons']) == 1, 'error unifying %s: %s<=%s' % (tr["exons"], end, tr['exons'][-1][0])
AssertionError: error unifying [[65500537, 65500920], [65501008, 65504026]]: 65500848<=65501008

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.