Change of samples colors in 2D PCoA graphs

509 views
Skip to first unread message

Andrea

unread,
Jun 1, 2012, 11:57:58 AM6/1/12
to Qiime Forum
Hello All,
I would like to change samples colors in the 2D PCoA graphs for
jackknife beta-diversity.
I'm comparing bacterial communities of two different age-groups and I
want to color the samples of each group different than the default
blue and red.
I found a similar post in this forum but I cannot make it work
(https://groups.google.com/group/qiime-forum/browse_thread/thread/
7adbb4a4de1c9045/f79fb473e8b20f9e?lnk=gst&q=sample
+color#f79fb473e8b20f9e)

I'm using the 1.3.0 version, and this is part of the parameters file
that I'm using:

"
###beta_diversity_through_3d_plots.py parameters###

# Beta diversity parameters
beta_diversity:metrics
weighted_unifrac,unweighted_unifrac,binary_euclidean,euclidean,unifrac_G_full_tree,weighted_normalized_unifrac,unweighted_unifrac_full_tree

# Make prefs file parameters
make_prefs_file:background_color black
make_prefs_file:mapping_headers_to_use
SampleID,Age,Family,Position,Gender,Ethnicity,Description
make_prefs_file:monte_carlo_dists 10

# Make 3D plot parameters
make_3d_plots:custom_axes
make_3d_plots:ellipsoid_smoothness 1

###jackknife_upgma.py parameters###

# Even-depth rarefaction parameters
multiple_rarefactions_even_depth:num-reps 20 "

Thanks for the help,

Andrea

Jesse Stombaugh

unread,
Jun 1, 2012, 12:08:24 PM6/1/12
to qiime...@googlegroups.com
Hello Andrea,

You will want to create a preferences file (http://qiime.org/scripts/preferences_file.html#index-0). I recommend you open up the log file generated from the jackknife workflow script. Within that log file, you will want to find the command using "make_2d_plots.py". Then, you will want to re-run that command, but you should pass the preference file ("-p" option).

-Jesse
--
Jesse Stombaugh, Ph.D.
Research Associate
University of Colorado, Boulder

Andrea Clavijo

unread,
Jun 1, 2012, 3:45:56 PM6/1/12
to qiime...@googlegroups.com
Jesse,
Thank you very much for the help. But now that I'm running it I get this syntax error:

"
Traceback (most recent call last):
  File "/usr/local/qiime/bin/make_2d_plots.py", line 191, in <module>
    main()
  File "/usr/local/qiime/bin/make_2d_plots.py", line 125, in main
    sample_color_prefs_and_map_data_from_options(opts)
  File "/usr/local/lib/python2.6/dist-packages/qiime/colors.py", line 503, in sample_color_prefs_and_map_data_from_options
    prefs = eval(open(options.prefs_path, 'U').read())
  File "<string>", line 1
    {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
                                                     ^
SyntaxError: unexpected character after line continuation character   "

I'm using as preference file this code:

    • {‘background_color’:’black’,
    • ‘sample_coloring’:
      • {
        • ‘TreatmentType’:
        • {
          • ‘column’:’Description’,
          • ‘colors’:((‘green’),(‘grey’))

        • }
      • }

Do you know what could be wrong with it. Thank you very much for your help

Andrea

Greg Caporaso

unread,
Jun 1, 2012, 3:51:44 PM6/1/12
to qiime...@googlegroups.com
Hi Andrea,
It looks like you are missing one closing braket. Try the following:

{'background_color':'black',
'sample_coloring': {'TreatmentType':{'column':'Description',
'colors':(('green'),('grey'))}}
}

Greg

Andrea Clavijo

unread,
Jun 4, 2012, 5:37:11 PM6/4/12
to qiime...@googlegroups.com
Hello,
Thank you for the corrections but, honestly, I don't know if I'm doing the right thing. It keeps me showing the error message. 
Here it is what I wrote and what I got:

"
gln:~> python /usr/local/qiime/bin/make_2d_plots.py -i /home/aclavijo/TateLyle/TL_Baselines_SP_Turnbaugh2/TL_jackknifed_beta_div_baselines_SP_Turnbaugh/unifrac_G_full_tree//pcoa/ -o /home/aclavijo/TateLyle/TL_Baselines_SP_Turnbaugh2/TL_jackknifed_beta_div_baselines_SP_Turnbaugh/unifrac_G_full_tree//2d_plots2/ -m /home/aclavijo/TateLyle/Mapfile_TL_Turnbaugh/Map_metafile_Baselines_Turnbaugh_corrected.txt -p /home/aclavijo/TateLyle/color_change2.txt
This code was only tested with Matplotlib-0.98.5.2 and               Matplotlib-0.98.5.3
Traceback (most recent call last):
  File "/usr/local/qiime/bin/make_2d_plots.py", line 191, in <module>
    main()
  File "/usr/local/qiime/bin/make_2d_plots.py", line 125, in main
    sample_color_prefs_and_map_data_from_options(opts)
  File "/usr/local/lib/python2.6/dist-packages/qiime/colors.py", line 503, in sample_color_prefs_and_map_data_from_options
    prefs = eval(open(options.prefs_path, 'U').read())
  File "<string>", line 1
    {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
                                                     ^
SyntaxError: unexpected character after line continuation character    "

the file for -p contains exactly and only this:

"

{

'background_color':'black',

'sample_coloring':

{

'TreatmentType':

{

'column':'Description',

'colors':(('green'),('grey'))

}

}

}         "


Thank you so much,


Andrea C

Jesse Stombaugh

unread,
Jun 4, 2012, 6:31:33 PM6/4/12
to qiime...@googlegroups.com
Hello Andrea,

It appears you were missing the HSV codes for each of the colors. Additionally, I don't know if it is an email thing, but you shouldn't have double-quotes around the entire text string. Please copy/paste the following into your prefs file and try re-running it:

{
'background_color':'black',
'sample_coloring':
{
'TreatmentType':
{
'column':'Description',
'colors':(('green',(120,100,50.2)),('gray',(300,0,50.2)))
}
}

}




Reply all
Reply to author
Forward
0 new messages