Exécutez prepDE.py avec python3

Exécutez prepDE.py avec python3

Personne qui construit un environnement python3 car il est implémenté dans python2, bien que prepDE.py soit préparé dans le package StringTie pour analyser l'expression dans l'environnement R en saisissant le niveau d'expression calculé par StringTie. Pour moi, je dois passer à python2 même temporairement. C'est un peu désagréable et peut être un gros problème pour ceux qui ne veulent pas écrire leur propre code.

Il existe plusieurs façons de convertir du code python2 en python3, mais la conversion ne fonctionne pas toujours. Selon la recherche, RNAseqR, qui est une bibliothèque de R, utilise prepDE.py dans le back-end lors de la lecture dans R lors de l'utilisation du pipeline de StringTie. Le [manuel] de ce RNAseqR (https://bioconductor.org/packages/release/bioc/vignettes/RNASeqR/inst/doc/RNASeqR.html) décrit la correspondance dans le cas de python3. Commencer à citer>

5.9 The Reads Count Table Creator

Whether this step is executed depends on the availability of Python on your workstation.

  • Input: ‘samplelst.txt’
  • Output: ‘gene_count_matrix.csv’, ‘transcript_count_matrix.csv’
  1. The reads count table converter Python script is downloaded as prepDE.py
  2. Python checking
    • When Python is not available, this step is skipped.
    • When Python2 is available, prepDE.py is executed.
    • When Python3 is available, the 2to3 command will be checked.(Usually, if Python3 is installed, 2to3 command will be installed too.)
    • When Python3 is available but the 2to3 command is unavailable, the raw read count step will be skipped.
    • When Python3 and the 2to3 command are available, prepDE.py is converted to a file that can be executed by Python2 and is automatically executed.

<Fin de la citation

En d'autres termes, heureusement, j'ai trouvé que cela semble fonctionner même si je le convertis en code python3 avec la commande de conversion. Essayons. L'environnement est OSX 10.13.4 High Sierra.

Option: préparation Python (si géré par pyenv)

1. Changer la version de python avec pyenv

suimyenbookpuro:stringtie suimye$ pyenv versions
  system
* 2.7.6 (set by /Users/suimye/.pyenv/version)
  3.6.0
  anaconda3-4.3.1
  anaconda3-4.3.1/envs/py3.6.0

2. Changer la version de python avec pyenv

suimyenbookpuro:stringtie suimye$ pyenv global 3.6.0
suimyenbookpuro:stringtie suimye$ pyenv versions
  system
  2.7.6
* 3.6.0 (set by /Users/suimye/.pyenv/version)
  anaconda3-4.3.1
  anaconda3-4.3.1/envs/py3.6.0

Créer du code prepDE.py pour python3

La commande suivante écrase prepDE.py et le traduit en code python3. Le code d'origine est sauvegardé dans un fichier appelé prepDE.py.bak, donc s'il ne fonctionne pas, vous pouvez le restaurer à partir de ce fichier.

2to3 -w ~/tools/stringtie-2.0.6.OSX_x86_64/prepDE.py 

1. Générez un fichier gtf et un fichier ctab avec stringtie

BAMFILE1=test1.sort.bam
BAMFILE2=test2.sort.bam
REFGTF=/Users/suimye/genome/hg19.refFlat.20130205.gtf

/Users/suimye/tools/stringtie-2.0.6.OSX_x86_64/stringtie  $BAMFILE1 -e -B -G $REFGTF -o ball.test1.gtf
/Users/suimye/tools/stringtie-2.0.6.OSX_x86_64/stringtie  $BAMFILE2 -e -B -G $REFGTF -o ball.test1.gtf

2. Créez une liste pour prepDE

printf "test1\tball.test1.gtf\n" >list.txt
printf "test2\tball.test2.gtf\n" >>list.txt

4. Exécutez prepDE.py

python ~/tools/stringtie-2.0.6.OSX_x86_64/prepDE.py -i list.txt

5. Résultat d'exécution (ls)

-rw-r--r--   1 suimye  staff   318K 12 25 13:32 gene_count_matrix.csv
drwxr-xr-x  32 suimye  staff   1.0K 12 25 13:32 .
-rw-r--r--   1 suimye  staff   723K 12 25 13:32 transcript_count_matrix.csv
-rw-r--r--   1 suimye  staff    65M 12 25 13:03 ball.test2.gtf
-rw-r--r--   1 suimye  staff    65M 12 25 13:03 ball.test1.gtf
Contenu de gene_count_matrix.csv
suimyenbookpuro:stringtie suimye$ head gene_count_matrix.csv
gene_id,test1,test2
DDX11L1,15,2
WASH7P,0,1
MIR6859-1,0,0
MIR6859-2,0,0
MIR6859-3,0,0
MIR6859-4,0,0
------réduction-----

Recommended Posts

Exécutez prepDE.py avec python3
Exécutez Python avec VBA
Exécutez Blender avec python
Exécutez iperf avec python
Exécutez python avec PyCharm (Windows)
Exécutez Python avec CloudFlash (arm926ej-s)
Exécuter Label avec tkinter [Python]
Exécutez Rotrics DexArm avec l'API Python
Exécutez mruby avec Python ou Blender
Exécutez XGBoost avec Cloud Dataflow (Python)
Exécutez Aprili depuis Python sur Orange
Exécutez python3 Django1.9 avec mod_wsgi (déployer)
Jusqu'à ce que Python fonctionne sur Apache
FizzBuzz en Python3
Grattage avec Python
Statistiques avec python
Grattage avec Python
Python avec Go
Twilio avec Python
Intégrer avec Python
Jouez avec 2016-Python
AES256 avec python
Testé avec Python
python commence par ()
avec syntaxe (Python)
Bingo avec python
Zundokokiyoshi avec python
Excel avec Python
Micro-ordinateur avec Python
Cast avec python
Exécutez le servo avec Python sur ESP32 (Windows)
Exécutez une application Web Python avec Docker
Communication série avec Python
Zip, décompressez avec python
Django 1.11 a démarré avec Python3.6
Jugement des nombres premiers avec Python
Python avec eclipse + PyDev.
Communication de socket avec Python
Analyse de données avec python 2
Grattage en Python (préparation)
Essayez de gratter avec Python.
Apprendre Python avec ChemTHEATER 03
Recherche séquentielle avec Python
"Orienté objet" appris avec python
Manipuler yaml avec python
Résolvez AtCoder 167 avec python
Communication série avec python
[Python] Utiliser JSON avec Python
Apprendre Python avec ChemTHEATER 05-1
Apprenez Python avec ChemTHEATER
1.1 Premiers pas avec Python
Collecter des tweets avec Python
Binarisation avec OpenCV / Python
3. 3. Programmation IA avec Python
Méthode Kernel avec Python
Non bloquant avec Python + uWSGI
Grattage avec Python + PhantomJS
Publier des tweets avec python
Conduisez WebDriver avec python