comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <lutgenl@icloud.com>
Subject: Re: Some advice required [OT]
Date: Mon, 27 Dec 2021 14:09:54 -0800 (PST)	[thread overview]
Message-ID: <e5ab38f4-b456-4e99-b702-be4f88e8b5c1n@googlegroups.com> (raw)
In-Reply-To: <87fsqd7oz8.fsf@bsb.me.uk>

On Monday, 27 December 2021 at 21:49:18 UTC+1, Ben Bacarisse wrote:
> Laurent <lut...@icloud.com> writes: 
> 
> > On Monday, 27 December 2021 at 14:14:42 UTC+1, Ben Bacarisse wrote: 
> >> Laurent <lut...@icloud.com> writes: 
> >> 
> >> > On Monday, 27 December 2021 at 12:16:27 UTC+1, Niklas Holsti wrote: 
> >> > 
> >> >> Sorry, but I found your problem description impossible to understand. 
> >> >> Try to describe more clearly the experiment that is done, the structure 
> >> >> of the data the experiment provides (the meaning of the Excel rows and 
> >> >> columns), and the statistic you want to compute. 
> >> > 
> >> > Sorry tried to keep it short, was too short. 
> >> > 
> >> > Columns are the antimicrobial drugs 
> >> > Rows are the microorganism. 
> >> > 
> >> > So every cell contains a result of S, I, R or simply an empty cell 
> >> > 
> >> > S = Sensible 
> >> > I = Intermediate 
> >> > R = Resistant 
> >> > 
> >> > empty cell <S<I<R 
> >> > 
> >> > If a patient has 3 strains of the same microorganism but with 
> >> > different resistance profiles I have to find the most resistant 
> >> > one. Or if they are different I keep them all. 
> >> > 
> >> > I have no idea how to explain what I am doing to the compiler. 
> >> I think when you can explain it to people, you'll be able to code it. I 
> >> am still struggling to understand what you need. 
> >> > Why I would choose result from strain B over the result from strain A. 
> >> > 
> >> > strain A: SSSRSS 
> >> > strain B: SSRRRS 
> >> Let's space it out 
> >> 
> >> drug 1 drug 2 drug 3 drug 4 drug 5 drug 6 
> >> strain A S S S R S S 
> >> strain B S S R R R S 
> >> 
> >> You want to choose B because it has is resistant to more drugs, yes? 
> >> 
> > 
> > Yes indeed 
> > 
> >> I think, from the ordering you give, you need a measure that treats an R 
> >> as "more important" that any "I" which is "more important" than an "S". 
> >> (We will come to empty cells later.) 
> >> 
> >> I think you need to treat the number of Rs, Is and Ss like digits in a 
> >> number. In base 10, the strains score 
> >> 
> >> R S I 
> >> strain A 1 5 0 = 150 
> >> strain B 3 3 0 = 330 
> >> 
> >> Now, in fact, you don't need to use base 10. The smallest base you can 
> >> use is one more than the maximum number of test results. If there can 
> >> be up to 16 tests (say) the score is 
> >> 
> >> n(R)*17*17 + n(S)*17 + n(I). 
> >> 
> >> If this suits your needs, we can consider empty cells later on. It's 
> >> not at all clear to me how to compare 
> >> 
> >> strain C R____ 
> >> strain D RRSSSS 
> >> 
> >> Strain C is "less resistant" but only because there is not enough 
> >> information. In fact it seems more serious as it is resistant to all 
> >> tested drugs. 
> >> 
> > 
> > Strain C is probably garbage and I would remove it. With a bit of luck I will have the result with the same sample Id which would be complete. 
> > 
> >> And then what about 
> >> 
> >> strain D SR 
> >> strain E RS 
> >> 
> > 
> > Yes those are the cases which are annoying me. 
> > 
> > That's why I came up withe idea of multiplying the value of the result 
> > (S=1, I=2 and R=3) with the position of the value. Tried it with 
> > triplets but there will still be cases where different results will
> > give the same numeric value. Ignoring empty cell able tps for the moment.
> > 
> > Strain F: SSR (1*1+2*1+3*3) =12 and Strain G: RRS (1*3+ 2*3+3*1) = 12 
> > will be the same numerical value but they are different resistance 
> > profiles I would in this case keep both. 
> > 
> > How to prevent that from happening.
> Can you first say why the suggestion I made is not helpful? 
> 
> -- 
> Ben.

You mean that one:

> >> I think you need to treat the number of Rs, Is and Ss like digits in a 
> >> number. In base 10, the strains score 
> >> 
> >> R S I 
> >> strain A 1 5 0 = 150 
> >> strain B 3 3 0 = 330 
> >> 

Different resistance profiles same result:

S	S	S	S	S	S	R	S	S	S	S	S	S	S	S 
score=1	14 0

S	S	S	S	S	S	S	S	S	S	S	S	R	S	S
score=1	14 0

R	R	R	R	R	S	R	R	R	S	S	S	S	S	S
score = 8 7 0

R	R	R	R	S	S	R	R	R	S	S	S	R	S	S
score = 8 7 0

I found 6 of those cases in 69 possible duplicates.

> >> Now, in fact, you don't need to use base 10. The smallest base you can 
> >> use is one more than the maximum number of test results. If there can 
> >> be up to 16 tests (say) the score is 
> >> 
> >> n(R)*17*17 + n(S)*17 + n(I). 
> >> 

The maximum is probably 20. More drugs don't fit onto one antimicrobial susceptibility test (AST) card.

Just scoring the numbers together doesn't work always because of those cases as you said yourself: 
> >> And then what about 
> >> strain D SR 
> >> strain E RS 

So I jumped to the conclusion that I need to add a weight for the position.

That's the solution I have figured out myself so far. But it suffers from the same problem perhaps
less often.

In the data I am testing I have 264 rows with results but only 69 are possible duplicates.
None of those produced a collision. So I have no idea how common that problem actually is.

Have to check that when I am back at work tomorrow.

Thanks

Laurent

  reply	other threads:[~2021-12-27 22:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  9:21 Some advice required [OT] Laurent
2021-12-27 11:16 ` Niklas Holsti
2021-12-27 12:29   ` Laurent
2021-12-27 13:14     ` Ben Bacarisse
2021-12-27 18:24       ` Laurent
2021-12-27 19:51         ` Dennis Lee Bieber
2021-12-27 20:49         ` Ben Bacarisse
2021-12-27 22:09           ` Laurent [this message]
2021-12-28  0:29             ` Ben Bacarisse
2021-12-28  7:48               ` Laurent
2021-12-28  9:05                 ` Laurent
2021-12-28 12:54                   ` Laurent
2021-12-28 13:57                     ` Ben Bacarisse
2021-12-28 18:19                       ` Laurent
2021-12-28 13:43                 ` Ben Bacarisse
2021-12-28 16:49                 ` Dennis Lee Bieber
2021-12-29  4:20                   ` Randy Brukardt
2021-12-27 17:41     ` Dennis Lee Bieber
2021-12-27 18:56       ` Niklas Holsti
2021-12-27 19:44         ` Laurent
2021-12-28  2:10     ` Randy Brukardt
2021-12-28  6:02       ` Laurent
2021-12-29  3:58         ` Randy Brukardt
2021-12-27 17:18 ` Simon Wright
2021-12-27 18:30   ` Laurent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox