Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use misc.compareGenomes.py? #3

Closed
ShuaiNIEgithub opened this issue Mar 14, 2022 · 10 comments
Closed

how to use misc.compareGenomes.py? #3

ShuaiNIEgithub opened this issue Mar 14, 2022 · 10 comments

Comments

@ShuaiNIEgithub
Copy link

ShuaiNIEgithub commented Mar 14, 2022

Hi, teams
thanks for your works on Agora.

I think the script "misc.compareGenomes.py" looks great. However, I got an error while running it with the example data. Did I get the input file wrong? or anything?

Could you please give me some advice to using the script?

Thank you very much.

This is my code:

src/misc.compareGenomes.py \
example/data/genes/genes.M1.list.bz2 \
example/data/genes/genes.M2.list.bz2 \
example/results/ancGenes/all/ancGenes.A3.list.bz2 \
-mode=drawKaryotype \
-minChrSize=200 > M1M2_min200genes.ps

The Error:

--------------------------------------------------------------------------------
| Key                      | Values                                            |
--------------------------------------------------------------------------------
| studiedGenome            | example/data/genes/genes.M1.list.bz2              |
| referenceGenome          | example/data/genes/genes.M2.list.bz2              |
| orthologuesList          | example/results/ancGenes/all/ancGenes.A3.list.bz2 |
| includeGaps              | False                                             |
| includeScaffolds         | True                                              |
| includeRandoms           | False                                             |
| includeNones             | False                                             |
| reverse                  | False                                             |
| mode                     | drawKaryotype                                     |
| orthoslist:fullgenenames | False                                             |
| orthoschr:minHomology    | 90                                                |
| minChrSize               | 200                                               |
| matrix:scaleY            | False                                             |
| matrix:pointSize         | -1                                                |
| sortBySize               | False                                             |
| matrix:colorFile         |                                                   |
| matrix:defaultColor      | black                                             |
| matrix:penColor          | black                                             |
| karyo:landscape          | False                                             |
| ps:backgroundColor       |                                                   |
| karyo:roundedChr         | False                                             |
| karyo:resolution         | 1                                                 |
| karyo:showText           | True                                              |
| karyo:drawBorder         | False                                             |
| karyo:defaultColor       |                                                   |
| karyo:penColor           | black                                             |
--------------------------------------------------------------------------------
Loading genome of example/results/ancGenes/all/ancGenes.A3.list.bz2 ... (ancestral genes) OK
Loading genome of example/data/genes/genes.M1.list.bz2 ... (Ensembl) OK
Loading genome of example/data/genes/genes.M2.list.bz2 ... (Ensembl) OK
27 24
Traceback (most recent call last):
  File "src/misc.compareGenomes.py", line 264, in <module>
    eval(str(arguments["mode"]))()
  File "src/misc.compareGenomes.py", line 161, in drawKaryotype
    (lx,ly) = utils.myPsOutput.printPsHeader(arguments["karyo:landscape"])
  File "/home/nieshuai/bin/Agora-master/src/utils/myPsOutput.py", line 24, in printPsHeader
    initColor()
  File "/home/nieshuai/bin/Agora-master/src/utils/myPsOutput.py", line 54, in initColor
    location = [f for f in knownLocations if os.path.exists(f)][0]
IndexError: list index out of range
@DyogenIBENS
Copy link
Owner

Hi,
thank you for using AGORA.
it seems that the scripts can't access to /etc/X11/rgb.txt nor /opt/X11/share/X11/rgb.txt on your computer (defined on line 51 and 52 of src/utils/myPsOutput.py).
Can you tell me on what os you're running the script?

thanks in advance,
Alexandra

@ShuaiNIEgithub
Copy link
Author

ShuaiNIEgithub commented Mar 15, 2022

Hi, Alexandra

Thanks for your reply.
My OS is: CentOS Linux release 8.1.1911 (Core).
And you are right, the problem is indeed that src/utils/myPsOutput.py can't access to rgb.txt. The rgb.txt is located in /usr/share/X11 on my computer.
When I add "/usr/share/X11/rgb.txt" to line 53 of "myPsOutput.py", misc.compareGenomes.py is run successfully!

But I encountered a new problem when converting ps to pdf: only the text "Chromosome ID", but no color filled graphics in the pdf file. Am I using the wrong code?

This is my code: (no bug report)

src/misc.compareGenomes.py \
example/data/genes/genes.M1.list.bz2 \
example/data/genes/genes.M2.list.bz2 \
example/results/ancGenes/all/ancGenes.A3.list.bz2 \
-mode=drawKaryotype \
-minChrSize=200 > M1M2_min200genes.ps
ps2pdf M1M2_min200genes.ps M1M2_min200genes.pdf

--------------------------------------------------------------------------------
| Key                      | Values                                            |
--------------------------------------------------------------------------------
| studiedGenome            | example/data/genes/genes.M1.list.bz2              |
| referenceGenome          | example/data/genes/genes.M2.list.bz2              |
| orthologuesList          | example/results/ancGenes/all/ancGenes.A3.list.bz2 |
| includeGaps              | False                                             |
| includeScaffolds         | True                                              |
| includeRandoms           | False                                             |
| includeNones             | False                                             |
| reverse                  | False                                             |
| mode                     | drawKaryotype                                     |
| orthoslist:fullgenenames | False                                             |
| orthoschr:minHomology    | 90                                                |
| minChrSize               | 200                                               |
| matrix:scaleY            | False                                             |
| matrix:pointSize         | -1                                                |
| sortBySize               | False                                             |
| matrix:colorFile         |                                                   |
| matrix:defaultColor      | black                                             |
| matrix:penColor          | black                                             |
| karyo:landscape          | False                                             |
| ps:backgroundColor       |                                                   |
| karyo:roundedChr         | False                                             |
| karyo:resolution         | 1                                                 |
| karyo:showText           | True                                              |
| karyo:drawBorder         | False                                             |
| karyo:defaultColor       |                                                   |
| karyo:penColor           | black                                             |
--------------------------------------------------------------------------------
Loading genome of example/results/ancGenes/all/ancGenes.A3.list.bz2 ... (ancestral genes) OK
Loading genome of example/data/genes/genes.M1.list.bz2 ... (Ensembl) OK
Loading genome of example/data/genes/genes.M2.list.bz2 ... (Ensembl) OK
27 24
Affichage ... OK

Looking forward to hearing from you.
Best wishes,
Shuai

@ShuaiNIEgithub
Copy link
Author

The same problem occurs when I open the ps file "M1M2_min200genes.ps" in photoshop.

@DyogenIBENS
Copy link
Owner

Hi,
the command line is correct, but at the present time, misc.compareGenomes.py uses chromosome number for the initialization of the color for the option drawKaryotype.
I'm working on this bug fix, but mean while, if you replace the chromosome names (i.e Chr1) by only the chromosome number (i.e 1), in the genes files, it will work.
I'll come back to you as soon as the bug is fixed. Sorry for the inconvenient.
Best wishes,
Alexandra

@ShuaiNIEgithub
Copy link
Author

Dear Alexandra,
it was a pleasure to work with you to refine this script, the process was very interesting. So please don't be sorry.

And you are right, I ran the command line successfully after replacing the chromosome names.
I also tested it with my own data and it works fine!

Then, I think it would be helpful if the script could output another plot to illustrate what each coloured block represents. I guess we drew the chromosomes of M1, and the different coloured blocks correspond to different chromosomes of M2. But I am not sure which chromosome is represented by a certain coloured block. Maybe chr1 is red?

Looking forward to your better works, and thank you so much.

Bests,
Shuai

@DyogenIBENS
Copy link
Owner

Dear Shuai,
to have the color corresponding to M2, you can use the same script, but comparing the genome with... itself...

if you run:
src/misc.compareGenomes.py genes.M2 genes.M2 tmp/ancGenes/all/ancGenes.M2.list.bz2 -mode=drawKaryotype > M2.ps

you should have the corresponding color.
I take into account your remark and add it on the todo list.

Best,
Alexandra

@ShuaiNIEgithub
Copy link
Author

It worked successfully.
It's really cleverly designed to compare itself to itself!

@muffato
Copy link
Collaborator

muffato commented Mar 16, 2022

Dear Shuai,

I have pushed a fix on the bugfix/3 branch. src/misc.compareGenomes.py is now able to draw karyotypes regardless of how the chromosomes are named (the colour scale corresponds to the chromosomes by decreasing size). Could you give it a try ?

Regards,
Matthieu

@ShuaiNIEgithub
Copy link
Author

Dear Matthieu,

It worked out!
Your team is the most efficient one I've ever seen, many thanks!

Bests,
Shuai

@muffato
Copy link
Collaborator

muffato commented Mar 17, 2022

You're most welcome. FYI, the bugfix is now on the master branch too.

Best regards,
Matthieu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants