baliga-lab / cmonkey2

Python port of cMonkey, a machine-learning based method for clustering
GNU Lesser General Public License v3.0
26 stars 16 forks source link

Current version of BeautifulSoup #18

Closed ghost closed 11 years ago

ghost commented 11 years ago

The current version of BeautifulSoup is 4.x.x. The name of the package while importing is bs4 instead of bs. Should I downgrade to version 3.x.x or is a code bug?

Thanks!


tests the select_probes_proportional() function ... ok
test_get_default_motif_scaling (scoring_test.DefaultScalingTest) ... ok
test_get_default_network_scaling (scoring_test.DefaultScalingTest) ... ok

======================================================================
ERROR: test_best_rsat_matches (util_test.BestMatchingLinksTest)
test the best_matching_links function
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/alomana/software/cmonkey-python/test/util_test.py", line 98, in test_best_rsat_matches
    matches = util.best_matching_links('Halobacterium', html)
  File "/Users/alomana/software/cmonkey-python/cmonkey/util.py", line 158, in best_matching_links
    soup = bs.BeautifulSoup(html)
NameError: global name 'bs' is not defined

======================================================================
ERROR: test_mapper (organism_test.RsatOrganismMapperTest)
tests the get_organism method for an existing organism
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/alomana/software/cmonkey-python/test/organism_test.py", line 105, in test_mapper
    info = self.mapper('Halobacterium')
  File "/Users/alomana/software/cmonkey-python/cmonkey/organism.py", line 65, in mapper_fun
    rsatdb.get_directory())[0].rstrip('/')
  File "/Users/alomana/software/cmonkey-python/cmonkey/util.py", line 158, in best_matching_links
    soup = bs.BeautifulSoup(html)
NameError: global name 'bs' is not defined

----------------------------------------------------------------------
Ran 153 tests in 1.983s

FAILED (errors=2)
GATES:~/software/cmonkey-python python
Python 2.7.3 (default, Nov 17 2012, 19:54:34) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named bs
>>> import bs4
>>> 
akashnimare commented 11 years ago

This is not a bug.They gave it the name "bs4".You can use it via >>import bs4.It works fine.

ghost commented 11 years ago

I see. What's the reason why the tests failed?

GATES:~/software/cmonkey-python ./run_tests.sh WARN: could not import BeautifulSoup, RSAT organism finding won't work WARNINGY Could not import MySQLdb - Microbes Online MySQL integration will not work test_column_values (datamatrix_test.DataMatrixTest) tests the column_values() method ... ok test_create_with_0_row_size (datamatrix_test.DataMatrixTest) create DataMatrix with a 0 row size ... ok test_create_with_init_value (datamatrix_test.DataMatrixTest) create DataMatrix with an initialization value ... ok test_create_with_names (datamatrix_test.DataMatrixTest) create DataMatrix with row and column names ... ok test_create_with_wrong_column_name_count (datamatrix_test.DataMatrixTest) create DataMatrix, providing the wrong number of column names ... ok test_create_with_wrong_row_name_count (datamatrix_test.DataMatrixTest) create DataMatrix, providing the wrong number of row names ... ok test_create_without_names (datamatrix_test.DataMatrixTest) create DataMatrix without row and column names ... ok test_fix_extreme_values (datamatrix_test.DataMatrixTest) tests the adjustment function ... ok test_init_with_values_none (datamatrix_test.DataMatrixTest) invoke set_values() with None should result in ValueError ... ok test_init_with_values_ok (datamatrix_test.DataMatrixTest) invoke set_values() with wrong row count should result in ... ok test_init_with_values_wrong_column_count (datamatrix_test.DataMatrixTest) invoke set_values() with wrong row count should result in ... ok test_init_with_values_wrong_row_count (datamatrix_test.DataMatrixTest) invoke set_values() with wrong row count should result in ... ok test_max (datamatrix_test.DataMatrixTest) tests the max() method ... ok test_min (datamatrix_test.DataMatrixTest) tests the min() method ... ok test_multiply_column_by (datamatrix_test.DataMatrixTest) tests the multiply_column_by method ... ok test_residual (datamatrix_test.DataMatrixTest) tests the residual() method ... ok test_residual2 (datamatrix_test.DataMatrixTest) tests the residual() method ... ok test_residual_var_normalize (datamatrix_test.DataMatrixTest) tests the residual() method. Note that this method ... ok test_row_values (datamatrix_test.DataMatrixTest) tests the row_values() method ... ok test_sorted_by_rowname (datamatrix_test.DataMatrixTest) ... ok test_sorted_by_rowname_duplicate_row_names (datamatrix_test.DataMatrixTest) ... ok test_submatrix_by_name_columns_only (datamatrix_test.DataMatrixTest) test creating sub matrices by row/column names ... ok test_submatrix_by_name_rows_and_cols (datamatrix_test.DataMatrixTest) test creating sub matrices by row/column name selection ... ok test_submatrix_by_name_rows_and_cols_with_nonexisting (datamatrix_test.DataMatrixTest) test creating sub matrices by row/column name selection ... ok test_submatrix_by_name_rows_only (datamatrix_test.DataMatrixTest) test creating sub matrices by row/column names ... ok test_submatrix_by_rows (datamatrix_test.DataMatrixTest) test creating sub matrices by providing row indexes ... ok test_no_filters (datamatrix_test.DataMatrixFactoryTest) test a factory without filters ... ok test_simple_filter (datamatrix_test.DataMatrixFactoryTest) test a factory using a single filter ... ok test_with_na_values (datamatrix_test.DataMatrixFactoryTest) test a factory with a DelimitedFile containing NA values ... ok test_remove_column (datamatrix_test.NoChangeFilterTest) remove one column ... ok test_remove_row (datamatrix_test.NoChangeFilterTest) remove one row ... ok test_simple (datamatrix_test.NoChangeFilterTest) simplest test case: everything kept ... ok test_filter (datamatrix_test.CenterScaleFilterTest) test the centering ... ok test_as_flat_values_empty_input (datamatrix_test.QuantileNormalizeTest) tests as_sorted_flat_values() with no input ... ok test_as_sorted_flat_values (datamatrix_test.QuantileNormalizeTest) tests that the flat values of the input matrices are ... ok test_qm_result_matrices (datamatrix_test.QuantileNormalizeTest) ... ok test_quantile_normalize_scores_with_all_defined_weights (datamatrix_test.QuantileNormalizeTest) happy path for quantile normalization ... ok test_quantile_normalize_scores_with_no_weights (datamatrix_test.QuantileNormalizeTest) no weights -> fall back to row means ... ok test_quantile_normalize_scores_with_undefined_weight (datamatrix_test.QuantileNormalizeTest) one undefined weight ... ok test_ranks (datamatrix_test.QuantileNormalizeTest) ... ok test_create_from_text (util_test.DelimitedFileTest) Reads a tab delimited file from a text ... ok test_create_from_text_empty_line_at_end (util_test.DelimitedFileTest) Reads a tab delimited file from a text ... ok test_read_with_empty_lines (util_test.DelimitedFileTest) Reads a semicolon delimited file containing emptylines ... ok test_read_with_quotes (util_test.DelimitedFileTest) Reads a semicolon delimited file with quotes ... ok test_read_with_semicolon_header_and_comments (util_test.DelimitedFileTest) Reads a semicolon delimited file with a header and comments ... ok test_read_with_tabs (util_test.DelimitedFileTest) Reads a tab delimited file ... ok test_read_with_tabs_and_header (util_test.DelimitedFileTest) Reads a tab delimited file with a header ... ok test_column_means (util_test.UtilsTest) tests the column_means() function ... ok test_column_means_with_nans (util_test.UtilsTest) tests the column_means() function, containing NaNs ... ok test_density (util_test.UtilsTest) ... ok test_max_row_var (util_test.UtilsTest) tests maximum row variance function ... ok test_max_row_var_with_nans (util_test.UtilsTest) tests maximum row variance with NaNs ... ok test_mean_with_nans (util_test.UtilsTest) tests the mean() function ... ok test_quantile (util_test.UtilsTest) tests the quantile function ... ok test_r_outer (util_test.UtilsTest) tests the r_outer function ... ok test_r_stddev (util_test.UtilsTest) tests the standard deviation function ... ok test_r_stddev_with_nan (util_test.UtilsTest) tests the standard deviation function ... ok test_r_variance_columns (util_test.UtilsTest) tests the column variance function ... ok test_r_variance_columns_with_nans (util_test.UtilsTest) tests the column variance function ... ok test_row_means (util_test.UtilsTest) tests the row_means() function ... ok test_row_means_with_nans (util_test.UtilsTest) tests the row_means() function ... ok test_sd_rnorm (util_test.UtilsTest) ... ok test_trim_mean_median (util_test.UtilsTest) ... ok test_trim_mean_no_values (util_test.UtilsTest) ... ok test_trim_mean_nonmedian (util_test.UtilsTest) ... ok test_trim_mean_real (util_test.UtilsTest) ... ok test_kitten_sitting (util_test.LevenshteinDistanceTest) compare kitten with sitting ... ok test_saturday_sunday (util_test.LevenshteinDistanceTest) compare Saturday with Sunday ... ok test_best_rsat_matches (util_test.BestMatchingLinksTest) test the best_matching_links function ... ERROR test_order2string (util_test.Order2StringTest) ... ok test_get_existing_organism (organism_test.KeggOrganismCodeMapperTest) retrieve existing organism ... ok test_get_non_existing_organism (organism_test.KeggOrganismCodeMapperTest) retrieve non-existing organism ... ok test_mapper (organism_test.RsatOrganismMapperTest) tests the get_organism method for an existing organism ... ERROR test_get_existing (organism_test.GoTaxonomyMapperTest) retrieve an existing id ... ok test_get_non_existing (organism_test.GoTaxonomyMapperTest) retrieve None for a non-existing organism ... ok test_create_eukaryote (organism_test.MicrobeFactoryTest) tests creating an eukaryote ... ok test_create_prokaryote (organism_test.MicrobeFactoryTest) tests creating a Prokaryote ... ok test_get_networks (organism_test.MicrobeTest) tests the networks() method ... ok test_init_genome (organism_test.MicrobeTest) Tests the init_genome() method ... WARNING:root:Microbes Online operon gene 'gene1' not found in RSAT features WARNING:root:Microbes Online operon gene 'gene2' not found in RSAT features WARNING:root:Microbes Online operon gene 'gene3' not found in RSAT features WARNING:root:Operon did not contain any available genes ok test_markov_background_0 (seqtools_test.SeqtoolsTest) test markov_background() with order 0 ... ok test_markov_background_1 (seqtools_test.SeqtoolsTest) test markov_background() with order 1 ... ok test_replace_degenerate_residues (seqtools_test.SeqtoolsTest) ... ok test_replace_degenerate_residues_leading_trailing_whitespace (seqtools_test.SeqtoolsTest) ... ok test_replace_degenerate_residues_multi (seqtools_test.SeqtoolsTest) Test ensures that spaces in the string will be preserved ... ok test_revcomp (seqtools_test.SeqtoolsTest) test revcomp function ... ok test_reverse (seqtools_test.SeqtoolsTest) tests with simple coordinate, setting reverse flag ... ok test_simple (seqtools_test.SeqtoolsTest) tests with a simple coordinate ... ok test_subseq_counts_1 (seqtools_test.SeqtoolsTest) test subseq_counts() with length 1 ... ok test_subseq_counts_2 (seqtools_test.SeqtoolsTest) test subseq_counts() with length 2 ... ok test_subseq_frequencies_1 (seqtools_test.SeqtoolsTest) test subseq_frequencies() with length 1 ... ok test_read_sequences_from_fasta_file (seqtools_test.FastaTest) test reading sequences from a string in FASTA format ... ok test_read_sequences_from_fasta_string (seqtools_test.FastaTest) test reading sequences from a string in FASTA format ... ok test_write_sequences_to_fasta_file (seqtools_test.FastaTest) Tests writing to a FASTA file ... ok test_write_sequences_to_fasta_file_empty_seqs (seqtools_test.FastaTest) Tests ensures that only non-empty sequences will be written to FASTA ... ok test_equals_false (seqtools_test.LocationTest) Tests the equality operator ... ok test_equals_true (seqtools_test.LocationTest) Tests the equality operator ... ok test_notequals (seqtools_test.LocationTest) Tests the equality operator ... ok test_create_from_delimited_file1 (thesaurus_test.DelimitedFileFactoryTest) test the delimited file simple version ... ok test_create_from_delimited_file2 (thesaurus_test.DelimitedFileFactoryTest) test the delimited file second version ... ok test_create_from_rsat_feature_names_no_transform (thesaurus_test.DelimitedFileFactoryTest) test the creation from RSAT feature names file ... ok test_create_from_rsat_feature_names_with_transform (thesaurus_test.DelimitedFileFactoryTest) test the creation from RSAT feature names using a key transformer ... ok test_build_operons (operon_nw_test.ReadOperonNetworkTest) tests building an operon list from two name lists ... ok test_get_network_factory (operon_nw_test.ReadOperonNetworkTest) test happy path ... ok test_make_edges_from_predictions (operon_nw_test.ReadOperonNetworkTest) tests the make_edges_from_predictions function ... ok test_make_operon_edges_forward (operon_nw_test.ReadOperonNetworkTest) test when all genes of the operon are on the forward strand ... ok test_make_operon_edges_reverse (operon_nw_test.ReadOperonNetworkTest) test when all genes of the operon are on the reverse strand ... ok test_make_operon_pairs (operon_nw_test.GetOperonPairsTest) test the make_operon_pairs() function in integration ... ok test_construct (network_test.NetworkTest) tests creating a network using the constructor ... ok test_create_overlapping_edges (network_test.NetworkTest) tests creating a network using the standard factory method ... ok test_create_unique_edges (network_test.NetworkTest) tests creating a network using the standard factory method ... ok test_edges_with_source_in (network_test.NetworkTest) tests the edges that have a source in the input ... ok test_normalize_to_different_score (network_test.NetworkTest) tests creating a network ... ok test_normalize_to_same_score (network_test.NetworkTest) tests creating a network ... ok test_add_cluster_to_column (membership_test.ClusterMembershipTest) tests adding a cluster to a column ... ok test_add_cluster_to_column_exceed_limit (membership_test.ClusterMembershipTest) tests adding a column to a cluster, hitting the limit ... ok test_add_cluster_to_column_twice (membership_test.ClusterMembershipTest) tests adding a cluster to a column twice and making sure it's only in there once ... ok test_add_cluster_to_row (membership_test.ClusterMembershipTest) tests adding a cluster to a row ... ok test_add_cluster_to_row_exceed_limit (membership_test.ClusterMembershipTest) tests adding a row to a cluster, checking the limit ... ok test_compute_column_scores_submatrix (membership_test.ClusterMembershipTest) tests compute_column_scores_submatrix ... ok test_constructor (membership_test.ClusterMembershipTest) tests the constructor ... ok test_create_membership (membership_test.ClusterMembershipTest) test creating a ClusterMembership object ... ok test_create_membership_use_defaults (membership_test.ClusterMembershipTest) test creating a ClusterMembership object using default parameters ... ok test_get_best_clusters (membership_test.ClusterMembershipTest) ... ok test_old_fuzzy_coefficient (membership_test.ClusterMembershipTest) ... ok test_remove_cluster_from_column (membership_test.ClusterMembershipTest) tests removing a column from a cluster ... ok test_remove_cluster_from_row (membership_test.ClusterMembershipTest) tests removing a row from a cluster ... ok test_replace_column_cluster (membership_test.ClusterMembershipTest) ... ok test_replace_row_cluster (membership_test.ClusterMembershipTest) ... ok test_reseed_empty_column_clusters (membership_test.ClusterMembershipTest) ... WARNING:root:# of column clusters reached 0 -> reseeding cluster 3 WARNING:root:# of column clusters reached 0 -> reseeding cluster 4 ok test_reseed_empty_row_clusters (membership_test.ClusterMembershipTest) ... WARNING:root:# of row clusters reached 0 -> reseeding cluster 4 ok test_seed_column_members (membership_test.ClusterMembershipTest) tests seed_column_members ... ok test_std_fuzzy_coefficient (membership_test.ClusterMembershipTest) ... ok test_compute_column_scores (microarray_test.ComputeArrayScoresTest) ... ok test_compute_row_scores_multiprocessing (microarray_test.ComputeArrayScoresTest) ... (reading reference row scores...) (compute my own row scores...) (comparing computed with reference results...) ok test_compute_row_scores_single (microarray_test.ComputeArrayScoresTest) ... (reading reference row scores...) (compute my own row scores...) (comparing computed with reference results...) ok test_read_mast_output (meme_test.MemeTest) tests the read_mast_output function ... ok test_read_mast_output2 (meme_test.MemeTest) tests the read_mast_output function, this one has some ... ok test_read_mast_output3 (meme_test.MemeTest) tests the read_mast_output function, this one has an incomplete block ... ok test_read_mast_output4 (meme_test.MemeTest) tests the read_mast_output function, this has on sequence/annotation block ... ok test_read_meme_output (meme_test.MemeTest) tests the read_meme_output function ... ok test_create_empty (pssm_test.PssmTest) Test creation with no data ... ok test_read_fasta (pssm_test.PssmTest) tests reading Pssm's from a FASTA file ... ok test_read (read_wee_test.ReadWeeTest) Test creation with no data ... ok test_genes_per_group_nonproportional (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_genes_per_group_nonproportional_6 (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_genes_per_group_nonproportional_one (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_genes_per_group_proportional (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_genes_per_group_proportional_fifty_fifty (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_genes_per_group_proportional_one (human_test.HumanTest) tests the genes_per_group_proportional function ... ok test_intensities_to_ratios (human_test.HumanTest) tests the intensities_to_ratios() function ... ok test_select_probes_proportional (human_test.HumanTest) tests the select_probes_proportional() function ... ok test_get_default_motif_scaling (scoring_test.DefaultScalingTest) ... ok test_get_default_network_scaling (scoring_test.DefaultScalingTest) ... ok

ERROR: test_best_rsat_matches (util_test.BestMatchingLinksTest)

test the best_matching_links function

Traceback (most recent call last): File "/Users/alomana/software/cmonkey-python/test/util_test.py", line 98, in test_best_rsat_matches matches = util.best_matching_links('Halobacterium', html) File "/Users/alomana/software/cmonkey-python/cmonkey/util.py", line 158, in best_matching_links soup = bs.BeautifulSoup(html) NameError: global name 'bs' is not defined

ERROR: test_mapper (organism_test.RsatOrganismMapperTest)

tests the get_organism method for an existing organism

Traceback (most recent call last): File "/Users/alomana/software/cmonkey-python/test/organism_test.py", line 105, in test_mapper info = self.mapper('Halobacterium') File "/Users/alomana/software/cmonkey-python/cmonkey/organism.py", line 65, in mapper_fun rsatdb.get_directory())[0].rstrip('/') File "/Users/alomana/software/cmonkey-python/cmonkey/util.py", line 158, in best_matching_links soup = bs.BeautifulSoup(html) NameError: global name 'bs' is not defined


Ran 153 tests in 1.464s

FAILED (errors=2) GATES:~/software/cmonkey-python

Adrián López García de Lomana

https://sites.google.com/site/adrianlopezgarciadelomana/

On Jun 13, 2013, at 1:17 PM, Akash Nimare notifications@github.com wrote:

This is not a bug.They gave it the name "bs4".You can use it via >>import bs4.It works fine.

— Reply to this email directly or view it on GitHub.

ghost commented 11 years ago

Additionally, when I try to run the Halo example, it crashes… Any thoughts?

Thanks!

GATES:~/software/cmonkey-python ./run_cmonkey.sh --organism hal --ratios halo_ratios5.tsv WARN: could not import BeautifulSoup, RSAT organism finding won't work WARNINGY Could not import MySQLdb - Microbes Online MySQL integration will not work Traceback (most recent call last): File "cmonkey/cmonkey.py", line 56, in thesaurus = cmonkey_run.organism().thesaurus() File "/Users/alomana/software/cmonkey-python/cmonkey/cmonkey_run.py", line 263, in organism self.__organism = self.make_microbe() File "/Users/alomana/software/cmonkey-python/cmonkey/cmonkey_run.py", line 278, in make_microbe rsat_info = rsat_mapper(kegg_mapper(self['organism_code'])) File "/Users/alomana/software/cmonkey-python/cmonkey/organism.py", line 65, in mapper_fun rsatdb.get_directory())[0].rstrip('/') File "/Users/alomana/software/cmonkey-python/cmonkey/rsat.py", line 30, in get_directory cache_file) File "/Users/alomana/software/cmonkey-python/cmonkey/util.py", line 262, in read_url_cached CMonkeyURLopener().retrieve(url, cache_filename) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 243, in retrieve tfp = open(filename, 'wb') IOError: [Errno 2] No such file or directory: 'cache/rsat_dir.html' GATES:~/software/cmonkey-python

Adrián López García de Lomana

https://sites.google.com/site/adrianlopezgarciadelomana/

On Jun 13, 2013, at 1:17 PM, Akash Nimare notifications@github.com wrote:

This is not a bug.They gave it the name "bs4".You can use it via >>import bs4.It works fine.

— Reply to this email directly or view it on GitHub.

weiju commented 11 years ago

Ok, cmonkey will now automatically try bs4 when it does not find BeautifulSoup