How to separate a strain of MTB drug wise?
1
0
Entering edit mode
6.1 years ago
S AR ▴ 80

Hi

I have a list of strains and the drugs name to which they are resistant and i want to separate the list in three groups MDR, Pre-XDR and XDR by following criteria:

For MDR it is resistant to: Isoniazid and Rifampicin

For Pre-XDR it is resistant to: ISONIAZID + RIFAMPICIN + CIPROFLOXACIN/MOXIFLOXACIN/OFLOXACIN/LEVOFLOXACIN -> (out of CIPROFLOXACIN/MOXIFLOXACIN/OFLOXACIN/LEVOFLOXACIN it can be any one or two or all + ISONIAZID + RIFAMPICIN)

For XDR it is resistant to:

ISONIAZID + RIFAMPICIN + CIPROFLOXACIN/MOXIFLOXACIN/OFLOXACIN/LEVOFLOXACIN + AMYCACIN/CAPREOMYCIN/KANAMYCIN -> again here same follows ISONIAZID + RIFAMPICIN + any of these or two or three or all (CIPROFLOXACIN/MOXIFLOXACIN/OFLOXACIN/LEVOFLOXACIN) + any of these or two or all (AMYCACIN/CAPREOMYCIN/KANAMYCIN)

The list is below:

    msrefid msdrug  msstresc
ERR038736   ISONIAZID   RESISTANT
ERR038736   RIFAMPICIN  RESISTANT
ERR038737   ISONIAZID   RESISTANT
ERR038737   RIFAMPICIN  RESISTANT
ERR038738   ISONIAZID   RESISTANT
SRR2100250  ISONIAZID   RESISTANT
SRR2100250  KANAMYCIN   RESISTANT
SRR2100250  RIFAMPICIN  RESISTANT
SRR2100257  AMIKACIN    RESISTANT
SRR2100257  CAPREOMYCIN RESISTANT
SRR2100257  ISONIAZID   RESISTANT
SRR2100257  KANAMYCIN   RESISTANT
SRR2100257  RIFAMPICIN  RESISTANT
SRR2100282  ISONIAZID   RESISTANT
SRR2100282  RIFAMPICIN  RESISTANT
SRR2100294  ISONIAZID   RESISTANT
SRR2100294  RIFAMPICIN  RESISTANT
SRR2100349  ISONIAZID   RESISTANT
SRR2100349  RIFAMPICIN  RESISTANT
SRR2100368  ISONIAZID   RESISTANT
SRR2100368  RIFAMPICIN  RESISTANT
SRR2100376  MOXIFLOXACIN    RESISTANT
SRR2100376  OFLOXACIN   RESISTANT
SRR2100376  RIFAMPICIN  RESISTANT
SRR2100387  ISONIAZID   RESISTANT
SRR2100387  RIFAMPICIN  RESISTANT
SRR2100389  CIPROFLOXACIN   RESISTANT
SRR2100389  OFLOXACIN   RESISTANT
SRR2100389  RIFAMPICIN  RESISTANT
SRR2100390  ISONIAZID   RESISTANT
SRR2100390  RIFAMPICIN  RESISTANT
SRR2100392  ISONIAZID   RESISTANT
SRR2100392  RIFAMPICIN  RESISTANT
SRR2100400  ISONIAZID   RESISTANT
SRR2100400  RIFAMPICIN  RESISTANT
SRR2100904  ISONIAZID   RESISTANT
SRR2100904  RIFAMPICIN  RESISTANT
SRR2100906  ISONIAZID   RESISTANT
SRR2100906  RIFAMPICIN  RESISTANT
SRR2100909  ISONIAZID   RESISTANT
SRR2100909  RIFAMPICIN  RESISTANT
SRR2100911  AMIKACIN    RESISTANT
SRR2100911  CAPREOMYCIN RESISTANT
SRR2100911  ISONIAZID   RESISTANT
SRR2100911  KANAMYCIN   RESISTANT
SRR2100911  RIFAMPICIN  RESISTANT
SRR2100912  ISONIAZID   RESISTANT
SRR2100912  RIFAMPICIN  RESISTANT
SRR2100914  ISONIAZID   RESISTANT
SRR2100914  RIFAMPICIN  RESISTANT
SRR2100920  ISONIAZID   RESISTANT
SRR2100920  RIFAMPICIN  RESISTANT
SRR2100921  ISONIAZID   RESISTANT
SRR2100921  RIFAMPICIN  RESISTANT
SRR2100923  CIPROFLOXACIN   RESISTANT
SRR2100923  MOXIFLOXACIN    RESISTANT
SRR2100923  OFLOXACIN   RESISTANT
SRR2100923  RIFAMPICIN  RESISTANT
SRR2100925  ISONIAZID   RESISTANT
SRR2100925  RIFAMPICIN  RESISTANT
SRR2100950  ISONIAZID   RESISTANT
SRR2100950  RIFAMPICIN  RESISTANT
SRR2101021  ISONIAZID   RESISTANT
SRR2101021  RIFAMPICIN  RESISTANT
SRR2101023  CIPROFLOXACIN   RESISTANT
SRR2101023  ISONIAZID   RESISTANT
SRR2101023  MOXIFLOXACIN    RESISTANT
SRR2101023  OFLOXACIN   RESISTANT
SRR2101023  RIFAMPICIN  RESISTANT
SRR2101053  ISONIAZID   RESISTANT
SRR2101053  RIFAMPICIN  RESISTANT
SRR2101055  ISONIAZID   RESISTANT
SRR2101055  KANAMYCIN   RESISTANT
SRR2101055  RIFAMPICIN  RESISTANT
SRR2101307  ISONIAZID   RESISTANT
SRR2101307  RIFAMPICIN  RESISTANT
SRR2101316  CAPREOMYCIN RESISTANT
SRR2101316  ISONIAZID   RESISTANT
SRR2101344  AMIKACIN    RESISTANT
SRR2101344  CAPREOMYCIN RESISTANT
SRR2101344  ISONIAZID   RESISTANT
SRR2101344  KANAMYCIN   RESISTANT
SRR2101344  MOXIFLOXACIN    RESISTANT
SRR2101344  OFLOXACIN   RESISTANT
SRR2101344  RIFAMPICIN  RESISTANT
SRR2101360  ISONIAZID   RESISTANT
SRR2101360  RIFAMPICIN  RESISTANT
SRR2101384  ISONIAZID   RESISTANT
SRR2101384  MOXIFLOXACIN    RESISTANT
SRR2101384  OFLOXACIN   RESISTANT
SRR2101384  RIFAMPICIN  RESISTANT
SRR2101405  ISONIAZID   RESISTANT
SRR2101405  RIFAMPICIN  RESISTANT
SRR2101443  CAPREOMYCIN RESISTANT
SRR2101443  ISONIAZID   RESISTANT
SRR2101470  ISONIAZID   RESISTANT
SRR2101470  RIFAMPICIN  RESISTANT
SRR2101539  CAPREOMYCIN RESISTANT
SRR2101539  ISONIAZID   RESISTANT
SRR2101555  ISONIAZID   RESISTANT
SRR2101555  RIFAMPICIN  RESISTANT
SRR2101574  ISONIAZID   RESISTANT
SRR2101574  MOXIFLOXACIN    RESISTANT
SRR2101574  OFLOXACIN   RESISTANT
SRR2101574  RIFAMPICIN  RESISTANT
SRR2101597  ISONIAZID   RESISTANT
SRR2101597  RIFAMPICIN  RESISTANT
SRR2101598  ISONIAZID   RESISTANT
SRR2101598  RIFAMPICIN  RESISTANT
SRR2101675  ISONIAZID   RESISTANT
SRR2101675  RIFAMPICIN  RESISTANT
SRR2101690  ISONIAZID   RESISTANT
SRR2101690  RIFAMPICIN  RESISTANT
SRR2101731  ISONIAZID   RESISTANT
SRR2101731  MOXIFLOXACIN    RESISTANT
SRR2101731  OFLOXACIN   RESISTANT
SRR2101731  RIFAMPICIN  RESISTANT
SRR2101753  ISONIAZID   RESISTANT
SRR2101753  RIFAMPICIN  RESISTANT
SRR2101757  ISONIAZID   RESISTANT
SRR2101757  KANAMYCIN   RESISTANT
SRR2101757  RIFAMPICIN  RESISTANT
SRR2101761  ISONIAZID   RESISTANT
SRR2101761  RIFAMPICIN  RESISTANT
SRR2101763  ISONIAZID   RESISTANT
SRR2101763  RIFAMPICIN  RESISTANT
SRR2101775  ISONIAZID   RESISTANT
SRR2101775  RIFAMPICIN  RESISTANT
SRR671722   ISONIAZID   RESISTANT
SRR671722   RIFAMPICIN  RESISTANT
SRR671724   ISONIAZID   RESISTANT
SRR671724   OFLOXACIN   RESISTANT
SRR671724   RIFAMPICIN  RESISTANT
SRR671725   CAPREOMYCIN RESISTANT
SRR671725   ISONIAZID   RESISTANT
SRR671725   KANAMYCIN   RESISTANT
SRR671725   OFLOXACIN   RESISTANT
SRR671725   RIFAMPICIN  RESISTANT
SRR671726   CAPREOMYCIN RESISTANT
SRR671726   ISONIAZID   RESISTANT
SRR671726   KANAMYCIN   RESISTANT
SRR671726   OFLOXACIN   RESISTANT
SRR671726   RIFAMPICIN  RESISTANT
SRR671727   ISONIAZID   RESISTANT
SRR671727   RIFAMPICIN  RESISTANT
SRR671728   ISONIAZID   RESISTANT
SRR671728   RIFAMPICIN  RESISTANT
SRR671731   ISONIAZID   RESISTANT
SRR671731   RIFAMPICIN  RESISTANT
SRR671732   ISONIAZID   RESISTANT
SRR671732   RIFAMPICIN  RESISTANT
SRR671733   ISONIAZID   RESISTANT
SRR671733   RIFAMPICIN  RESISTANT
SRR671734   ISONIAZID   RESISTANT
SRR671734   RIFAMPICIN  RESISTANT
SRR671735   ISONIAZID   RESISTANT
SRR671735   RIFAMPICIN  RESISTANT
SRR671736   ISONIAZID   RESISTANT
SRR671736   RIFAMPICIN  RESISTANT
SRR671737   ISONIAZID   RESISTANT
SRR671737   RIFAMPICIN  RESISTANT
SRR671738   ISONIAZID   RESISTANT
SRR671738   RIFAMPICIN  RESISTANT
SRR671739   ISONIAZID   RESISTANT
SRR671739   RIFAMPICIN  RESISTANT
SRR671740   ISONIAZID   RESISTANT
SRR671740   KANAMYCIN   RESISTANT
SRR671740   OFLOXACIN   RESISTANT
SRR671740   RIFAMPICIN  RESISTANT
SRR671742   ISONIAZID   RESISTANT
SRR671742   RIFAMPICIN  RESISTANT
SRR671743   ISONIAZID   RESISTANT
SRR671743   RIFAMPICIN  RESISTANT
SRR671744   CAPREOMYCIN RESISTANT
SRR671744   ISONIAZID   RESISTANT
SRR671744   KANAMYCIN   RESISTANT
SRR671744   RIFAMPICIN  RESISTANT
SRR671745   ISONIAZID   RESISTANT
SRR671745   RIFAMPICIN  RESISTANT
SRR671746   ISONIAZID   RESISTANT
SRR671746   RIFAMPICIN  RESISTANT
SRR671748   ISONIAZID   RESISTANT
SRR671748   RIFAMPICIN  RESISTANT
SRR671749   ISONIAZID   RESISTANT
SRR671749   RIFAMPICIN  RESISTANT
SRR671750   ISONIAZID   RESISTANT
SRR671750   OFLOXACIN   RESISTANT
SRR671750   RIFAMPICIN  RESISTANT
SRR671751   ISONIAZID   RESISTANT
SRR671751   OFLOXACIN   RESISTANT
SRR671751   RIFAMPICIN  RESISTANT
SRR671752   ISONIAZID   RESISTANT
SRR671752   RIFAMPICIN  RESISTANT
SRR671753   ISONIAZID   RESISTANT
SRR671753   RIFAMPICIN  RESISTANT
SRR671754   ISONIAZID   RESISTANT
SRR671754   OFLOXACIN   RESISTANT
SRR671754   RIFAMPICIN  RESISTANT
SRR671755   ISONIAZID   RESISTANT
SRR671755   OFLOXACIN   RESISTANT
SRR671755   RIFAMPICIN  RESISTANT
SRR671756   ISONIAZID   RESISTANT
SRR671756   OFLOXACIN   RESISTANT
SRR671756   RIFAMPICIN  RESISTANT
SRR671757   ISONIAZID   RESISTANT
SRR671757   RIFAMPICIN  RESISTANT
SRR671774   ISONIAZID   RESISTANT
SRR671774   RIFAMPICIN  RESISTANT
SRR671779   CAPREOMYCIN RESISTANT
SRR671779   ISONIAZID   RESISTANT
SRR671779   OFLOXACIN   RESISTANT
SRR671779   RIFAMPICIN  RESISTANT
SRR671843   ISONIAZID   RESISTANT
SRR671843   RIFAMPICIN  RESISTANT
SRR671844   ISONIAZID   RESISTANT
SRR671844   OFLOXACIN   RESISTANT
SRR671844   RIFAMPICIN  RESISTANT
SRR671845   ISONIAZID   RESISTANT
SRR671845   RIFAMPICIN  RESISTANT
SRR671847   ISONIAZID   RESISTANT
SRR671847   RIFAMPICIN  RESISTANT
SRR671848   ISONIAZID   RESISTANT
SRR671848   RIFAMPICIN  RESISTANT
SRR671849   ISONIAZID   RESISTANT
SRR671849   RIFAMPICIN  RESISTANT
SRR671850   ISONIAZID   RESISTANT
SRR671850   RIFAMPICIN  RESISTANT
SRR671851   ISONIAZID   RESISTANT
SRR671851   RIFAMPICIN  RESISTANT
SRR671852   ISONIAZID   RESISTANT
SRR671852   OFLOXACIN   RESISTANT
SRR671852   RIFAMPICIN  RESISTANT
SRR671853   ISONIAZID   RESISTANT
SRR671853   RIFAMPICIN  RESISTANT
SRR671854   ISONIAZID   RESISTANT
SRR671854   OFLOXACIN   RESISTANT
SRR671854   RIFAMPICIN  RESISTANT
SRR671855   ISONIAZID   RESISTANT
SRR671855   OFLOXACIN   RESISTANT
SRR671855   RIFAMPICIN  RESISTANT
SRR671857   ISONIAZID   RESISTANT
SRR671857   RIFAMPICIN  RESISTANT
SRR671861   ISONIAZID   RESISTANT
SRR671861   RIFAMPICIN  RESISTANT
SRR671862   CAPREOMYCIN RESISTANT
SRR671862   ISONIAZID   RESISTANT
SRR671862   KANAMYCIN   RESISTANT
SRR671862   OFLOXACIN   RESISTANT
SRR671862   RIFAMPICIN  RESISTANT
SRR671863   CAPREOMYCIN RESISTANT
SRR671863   ISONIAZID   RESISTANT
SRR671863   KANAMYCIN   RESISTANT
SRR671863   OFLOXACIN   RESISTANT
SRR671863   RIFAMPICIN  RESISTANT
SRR671864   CAPREOMYCIN RESISTANT
SRR671864   ISONIAZID   RESISTANT
SRR671864   KANAMYCIN   RESISTANT
SRR671864   OFLOXACIN   RESISTANT
SRR671864   RIFAMPICIN  RESISTANT
SRR671865   ISONIAZID   RESISTANT
SRR671865   KANAMYCIN   RESISTANT
SRR671865   OFLOXACIN   RESISTANT
SRR671865   RIFAMPICIN  RESISTANT
SRR671866   ISONIAZID   RESISTANT
SRR671866   OFLOXACIN   RESISTANT
SRR671866   RIFAMPICIN  RESISTANT
SRR671867   ISONIAZID   RESISTANT
SRR671867   RIFAMPICIN  RESISTANT
SRR671868   CAPREOMYCIN RESISTANT
SRR671868   ISONIAZID   RESISTANT
SRR671868   RIFAMPICIN  RESISTANT
SRR671869   ISONIAZID   RESISTANT
SRR671869   RIFAMPICIN  RESISTANT
SRR998856   ISONIAZID   RESISTANT
SRR998856   RIFAMPICIN  RESISTANT
SRR998857   ISONIAZID   RESISTANT
SRR998857   RIFAMPICIN  RESISTANT
**SRR998860 AMIKACIN    RESISTANT
SRR998860   CAPREOMYCIN RESISTANT**
SRR998860   ISONIAZID   RESISTANT
SRR998860   KANAMYCIN   RESISTANT
SRR998860   RIFAMPICIN  RESISTANT
SRR998861   ISONIAZID   RESISTANT
SRR998861   RIFAMPICIN  RESISTANT

In the end there will be three files separating these groups and if any other combination found like one is there of Isoniazid + cepreomycin these type should be separated in the fourth file.

I tried the following: cut -f1 strains_mdr_sdr_prexdr.txt | sort | uniq -c | sort

This gave me the number of time strain ID appears:

      2 SRR1269565
      2 SRR1269566
      2 SRR1269683
      2 SRR1269684
      2 SRR1270146
      2 SRR1270147
      2 SRR1270149
      2 SRR1270186
      2 SRR1270409
      2 SRR1270410
      2 SRR1270411
      2 SRR1270413
      2 SRR1270414
      2 SRR1270415
      3 SRR671868
      3 SRS551655
      3 SRS551699
      3 SRS551735
      3 SRS551746
      3 SRS551831
      4 ERR137243
      4 ERR137248
      4 ERR137254
      4 ERR137257
      4 ERR137262
      4 ERR137282
      4 ERR137284
      4 ERR144543
      4 ERR144551
      4 ERR144593
      4 ERR144595
      4 ERR144611
      4 ERR144620
      4 ERR144622
      4 ERR144623
      4 ERR144636
      4 ERR158579
      4 ERR158587
      4 ERR158596
      4 ERR227985
      4 ERR228003
      4 ERR228059
      4 ERR229947
      4 ERR229960
      4 ERR229962
      5 SRR2100419
      5 SRR2100830
      5 SRR2100889
      5 SRR2100911
      5 SRR2101023
      5 SRR671725
      5 SRR671726
      5 SRR671761
      5 SRR671782
      5 SRR671794
      5 SRR671799
      5 SRR671807
      5 SRR671815
      5 SRR671821
      5 SRR671842
      5 SRR671862
      5 SRR671863
      5 SRR671864
      5 SRR998860
      5 SRS551701
      5 SRS551778
      5 SRS551803
      5 SRS551925
      5 SRS551930
      5 SRS551946
      5 SRS552227
      5 SRS553844
      5 SRS553852
      5 SRS553890
      5 SRS553986
      6 ERR067580
      6 ERR067662
      6 ERR067674
      6 ERR117454
      6 ERR133890
      6 ERR133900
      6 ERR137208
      6 ERR144567
      6 ERR158585
      6 ERR158588
      6 ERR158616
      6 ERR228062
      6 ERR229982
      6 ERR234657
      6 ERR234661
      6 ERR688013
      6 ERR688016
      6 ERR688017
      6 ERR688018
      6 ERR688019
      6 ERR688020
      6 ERR688021
      6 ERR688022
      6 ERR688023
      6 ERR688026
      6 ERR688029
      6 ERR688031
      7 ERR688044
      7 SRR1269497
      7 SRR2101344

And if we say that all ids that are 2 times means MDR but than there is an exception like i found one entry: ERR046784 CIPROFLOXACIN RESISTANT ERR046784 ISONIAZID RESISTANT ERR046786 CIPROFLOXACIN RESISTANT ERR046786 ISONIAZID RESISTANT

Any solution for separation?

Grep Python sed awk loop • 1.8k views
ADD COMMENT
0
Entering edit mode

Hi @rizoic,

im still unable to find the solution if you can please help me?

ADD REPLY
4
Entering edit mode
6.1 years ago
rizoic ▴ 250

Incase you need a grep/awk based solution based on your tags. You can run something on these lines.

If you paste the data into a file lets say data.txt.

Example command for Pre-XDR

tail -n +2 data.txt |\
awk '{a[$1] = a[$1]","$2};END{for(i in a)print i"\t"a[i]}'|\
grep ISONIAZID|\
grep RIFAMPICIN|\
egrep "CIPROFLOXACIN|MOXIFLOXACIN|OFLOXACIN|LEVOFLOXACIN"

The details of each of the subcommands in case required:-

tail -n +2 Will remove the header line

awk Will collapse the file into one line per msrefid e.g. SRR2101344 ,AMIKACIN,CAPREOMYCIN,ISONIAZID,KANAMYCIN,MOXIFLOXACIN,OFLOXACIN,RIFAMPICIN

grep Will apply the conditions required. The egrep is just a proxy for grep -E with which you can give multiple filters seperated by | and it returns lines which have atleast one of the filters passing.

Incase all the lines are not RESISTANT under msstresc you can add a additional filter for that with grep.

To get only the passing ids add |cut -f1 to the command.

ADD COMMENT
0
Entering edit mode

Great i was able to extract xdr and preXdr. But now when im doing it for MDr im getting others as well as for MDR the strin should be resistant to only Isoniazid and Rifampicin in this case following command was ran:

tail -n +2 data.txt |\
awk '{a[$1] = a[$1]","$2};END{for(i in a)print i"\t"a[i]}'|\
grep ISONIAZID|\
grep RIFAMPICIN

Bu it is outputting:

ERR067617       ,ISONIAZID,OFLOXACIN,RIFAMPICIN
SRR2100906      ,ISONIAZID,RIFAMPICIN
ERR067618       ,ISONIAZID,RIFAMPICIN
ERR067659       ,ISONIAZID,OFLOXACIN,RIFAMPICIN
SRR2101753      ,ISONIAZID,RIFAMPICIN
SRR2100909      ,ISONIAZID,RIFAMPICIN
ERR234590       ,ISONIAZID,RIFAMPICIN
SRR2101757      ,ISONIAZID,KANAMYCIN,RIFAMPICIN
ERR234593       ,ISONIAZID,RIFAMPICIN
ERR234594       ,ISONIAZID,RIFAMPICIN
SRR2100368      ,ISONIAZID,RIFAMPICIN
ERR234596       ,ISONIAZID,RIFAMPICIN
SRR2101405      ,ISONIAZID,RIFAMPICIN
ERR234597       ,AMIKACIN,ISONIAZID,RIFAMPICIN
ERR234556       ,ISONIAZID,RIFAMPICIN
ERR234598       ,ISONIAZID,RIFAMPICIN
ERR234557       ,ISONIAZID,RIFAMPICIN
SRR998856       ,ISONIAZID,RIFAMPICIN
SRR998857       ,ISONIAZID,RIFAMPICIN

ERR234597 ,AMIKACIN,ISONIAZID,RIFAMPICIN Its not mdr.

What step im doing wrong?

ADD REPLY
1
Entering edit mode

A simplistic tweak would be to change the condition on these lines

tail -n +2 data.txt |\
awk '{a[$1] = a[$1]","$2};END{for(i in a)print i"\t"a[i]}'|\
grep -P "\t,ISONIAZID,RIFAMPICIN$"

Here the -P makes grep evaluate the expression as a perl compatible regex.The \t and $(indicating end of line)` make the regex specific and keep only those lines where only ,ISONIAZID,RIFAMPICIN are present.

Also incase you want the regex to work even when the order of the drugs changes ie. the pattern ends up being ,RIFAMPICIN,ISONIAZID then you can substitute the grep with an awk like one below

awk "/\t,ISONIAZID,RIFAMPICIN$|\t,RIFAMPICIN,ISONIAZID$/"

Here the expression is similar but you check for both possibilities.

ADD REPLY
0
Entering edit mode

Thanks That's perfect. :)

ADD REPLY
0
Entering edit mode

Hi @rizoic,

The example you showed above:

SRR2101344 ,AMIKACIN,CAPREOMYCIN,ISONIAZID,KANAMYCIN,MOXIFLOXACIN,OFLOXACIN,RIFAMPICIN

it is not Pre-Xdr it's XDR. Pre-XDR doesn't have Amikacin, Capreomycin, Kanamycin

I am unable to extract Pre-XDR from the above code. A Pre-XDR means it must be resistant to: Isoniazid, Rifampicin and (CIPROFLOXACIN|MOXIFLOXACIN|OFLOXACIN|LEVOFLOXACIN) any of these or one or two depends.

So i tried,

tail -n +2 data.txt |\
awk '{a[$1] = a[$1]","$2};END{for(i in a)print i"\t"a[i]}'|\
grep -P "\t,ISONIAZID,RIFAMPICIN|CIPROFLOXACIN|MOXIFLOXACIN|OFLOXACIN|LEVOFLOXACIN"

SRR671821       ,CAPREOMYCIN,ETHAMBUTOL,ETHIONAMIDE,ISONIAZID,KANAMYCIN,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
SRR671863       ,CAPREOMYCIN,ETHAMBUTOL,ISONIAZID,KANAMYCIN,OFLOXACIN,RIFAMPICIN
SRR671822       ,ETHAMBUTOL,ISONIAZID,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
SRR671864       ,CAPREOMYCIN,ETHAMBUTOL,ISONIAZID,KANAMYCIN,OFLOXACIN,RIFAMPICIN
SRR671865       ,ETHAMBUTOL,ISONIAZID,KANAMYCIN,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
SRR671866       ,ETHAMBUTOL,ISONIAZID,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
SRR671825       ,ETHAMBUTOL,ETHIONAMIDE,ISONIAZID,OFLOXACIN,RIFAMPICIN
SRR671828       ,ETHIONAMIDE,ISONIAZID,OFLOXACIN,RIFAMPICIN
SRR671829       ,ISONIAZID,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
ERR144620       ,CAPREOMYCIN,ETHAMBUTOL,ISONIAZID,OFLOXACIN,PYRAZINAMIDE,RIFAMPICIN,STREPTOMYCIN
ERR144622       ,ETHAMBUTOL,ISONIAZID,MOXIFLOXACIN,OFLOXACIN,PROTHIONAMIDE,PYRAZINAMIDE,RIFAMPICIN,STREPTOMYIN
ERR144623       ,ISONIAZID,MOXIFLOXACIN,OFLOXACIN,RIFAMPICIN,STREPTOMYCIN
ERR067684       ,ETHAMBUTOL,ISONIAZID,MOXIFLOXACIN,OFLOXACIN,PYRAZINAMIDE,RIFAMPICIN,STREPTOMYCIN
ERR067644       ,ETHAMBUTOL,ISONIAZID,MOXIFLOXACIN,OFLOXACIN,PYRAZINAMIDE,RIFAMPICIN,STREPTOMYCIN

But im getting other drugs in it as well like:

ERR144622     ,ETHAMBUTOL,ISONIAZID,MOXIFLOXACIN,OFLOXACIN,PROTHIONAMIDE,PYRAZINAMIDE,RIFAMPICIN,STREPTOMYIN

Any suggestions?

ADD REPLY
0
Entering edit mode

For Pre-XDR as per the condition you mention i.e. Isoniazid, Rifampicin and (CIPROFLOXACIN|MOXIFLOXACIN|OFLOXACIN|LEVOFLOXACIN) any of these or one or two depends. the command should be the same as in the answer right? i.e.

tail -n +2 data.txt |\
awk '{a[$1] = a[$1]","$2};END{for(i in a)print i"\t"a[i]}'|\
grep ISONIAZID|\
grep RIFAMPICIN|\
egrep "CIPROFLOXACIN|MOXIFLOXACIN|OFLOXACIN|LEVOFLOXACIN"

This command will first ensure both ISONIAZID and RIFAMPICIN are present and then check for any one of the others. Can you try this command and give some examples of mismatched results if any?

ADD REPLY

Login before adding your answer.

Traffic: 3025 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6