def analyze_one(soft_file, isamp, interested_organisms): """analyze a single soft_file""" if not filename_check(soft_file): return s_series = parse(soft_file, interested_organisms) # s_series should be in the list of series that are interested by the # collaborator if not s_series.name in isamp.keys(): logger.warning('{0} from {1} does not appear in ' 'isamp'.format(s_series.name, soft_file)) return return intersect(s_series, isamp)
def test_parse(self): m = mock.mock_open() with mock.patch('rsempipeline.parsers.soft_parser.open', m): m.return_value.__iter__.return_value = settings.GSE43770_FAMILY_SOFT_SUBSET_CONTENT.splitlines() series = soft_parser.parse('GSE43770_family.soft.subset', ['H**o sapiens', 'Mus musculus']) m.assert_called_once_with('GSE43770_family.soft.subset', 'rb') self.assertEqual(series.name, 'GSE43770') self.assertEqual([__.name for __ in series.passed_samples], ['GSM1070765', 'GSM1070766']) self.assertEqual([__.index for __ in series.passed_samples], [1, 2]) self.assertEqual([__.name for __ in series.samples], ['GSM1070765', 'GSM1070766', 'GSM1070767']) self.assertEqual([__.index for __ in series.samples], [1, 2, 0]) # 0 mean unindexed
def test_parse(self): m = mock.mock_open() with mock.patch('rsempipeline.parsers.soft_parser.open', m): m.return_value.__iter__.return_value = settings.GSE43770_FAMILY_SOFT_SUBSET_CONTENT.splitlines( ) series = soft_parser.parse('GSE43770_family.soft.subset', ['H**o sapiens', 'Mus musculus']) m.assert_called_once_with('GSE43770_family.soft.subset', 'rb') self.assertEqual(series.name, 'GSE43770') self.assertEqual([__.name for __ in series.passed_samples], ['GSM1070765', 'GSM1070766']) self.assertEqual([__.index for __ in series.passed_samples], [1, 2]) self.assertEqual([__.name for __ in series.samples], ['GSM1070765', 'GSM1070766', 'GSM1070767']) self.assertEqual([__.index for __ in series.samples], [1, 2, 0]) # 0 mean unindexed