Matrix Science header

resfile_input.java

Example program for retrieving input spectrum data.

/*
##############################################################################
# file: resfile_input.java                                                   #
# 'msparser' toolkit                                                         #
# Test harness / example code                                                #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#    $Archive:: /MowseBranches/ms_mascotresfile_1.2/test_java/test_inputda $ #
#     $Author: davidc $ #
#       $Date: 2006/07/05 14:27:56 $ #
#   $Revision: 1.3 $ #
# $NoKeywords::                                                            $ #
##############################################################################
*/

import java.util.Date;
import matrix_science.msparser.*;

public class resfile_input {
    static {
        try {
            System.loadLibrary("msparserj");
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Native code library failed to load. "
                               + "Is msparserj.dll on the path?\n" + e);
            System.exit(0);
        }
    }

    public static void main(String argv[]) 
    {
        // ----- Object creation -----
        if(argv.length < 1) {
            System.out.println("Must specify results filename as parameter");
            System.exit(0);
        }

        ms_mascotresfile file = new ms_mascotresfile(argv[0], 0, "");
        if (file.isValid()) {
            inputData(file);
        } else {
            System.out.println("Error number: "+file.getLastError());
            System.out.println("Error string: "+file.getLastErrorString());
            System.exit(0);
        }
    }
  
    private static void inputData(ms_mascotresfile file) {
        int i;
        int j;
        int num_peaks;
      
        // display input data via inputquery get functions
        for(i=1; i <=1; i++) { // replace i<=1 with i<=file.getNumQueries() for complete dataset
            System.out.println("Input data for query number "+i);
            System.out.println("=========================================");
            ms_inputquery q=new ms_inputquery(file,i);
            System.out.println("      title       : "+q.getStringTitle(true));
            System.out.println("      mass_min    : "+q.getMassMin());
            System.out.println("      mass_max    : "+q.getMassMax());
            System.out.println("      int_min     : "+q.getIntMin());
            System.out.println("      int_max     : "+q.getIntMax());
            System.out.println("      num_vals    : "+q.getNumVals());
            System.out.println("      num_used1   : "+q.getNumUsed());
            System.out.println("      ions1       : "+q.getStringIons1());
            System.out.println("      ions2       : "+q.getStringIons2());
            System.out.println("      ions3       : "+q.getStringIons3());
            System.out.println("      peptol      : "+q.getPepTol());
            System.out.println("      peptol units: "+q.getPepTolUnits());
            System.out.println("      peptol str  : "+q.getPepTolString());
            System.out.println("      INSTRUMENT  : "+q.getINSTRUMENT());
            System.out.println("      RULES       : "+q.getRULES());
            System.out.println("      IT_MODS     : "+q.getIT_MODS());
            System.out.println("      repeat srch : "+file.getRepeatSearchString(i));


            num_peaks = q.getNumberOfPeaks(1);
            for(j=1; j <= num_peaks; j++) {
                System.out.println(roundWholeNumber(q.getPeakMass(1,j))+", "+roundWholeNumber(q.getPeakIntensity(1,j)));
            }
        }
        System.out.println("\n");
    }
  


    private static int toBinary(boolean bool) {
        if(bool) return 1;
        return 0;
    }


    private static String roundWholeNumber (double toRound) {
        String myInt = ""+toRound;
        myInt += "\n";
        if(myInt.indexOf(".0\n")>-1) {
            return myInt.substring(0,myInt.indexOf(".0\n"));
        }
        return ""+toRound;
    }

}

/*

will give the output: 


C>java -classpath .;../java/msparser.jar resfile_input F981123.dat
Input data for query number 1
=========================================
      title       : dp210198c                      21-Jan-98 DERIVED SPECTRUM    #9
      mass_min    : 214.8
      mass_max    : 1228.7
      int_min     : 7.0
      int_max     : 114465.0
      num_vals    : 443
      num_used1   : 0
      ions1       : 288.200000:2137,371.127841:1663,472.096295:2.939e+04,567.000000:5.469e+04,663.100000:1.145e+05,758.2
00000:7.356e+04,871.200000:2.539e+04,956.100000:2241,1055.000000:1.227e+04,1167.994665:1.725e+04,1215.400000:257,314.200
000:1308,377.992647:1088,501.400000:1.043e+04,584.997427:3.906e+04,654.180103:3.006e+04,759.300000:1.557e+04,841.900000:
1.917e+04,972.292156:1874,1056.300000:3799,1169.100000:1.123e+04,1225.200000:58,242.800000:417,377.000000:828,454.100000
:5162,586.200000:5258,662.700000:1.83e+04,728.800000:1397,842.900000:4893,956.800000:443,1029.300000:1846,1170.200000:12
80,1216.200000:51,313.900000:187,387.200000:656,473.200000:1342,568.100000:5122,663.600000:9782,729.200000:626,872.30000
0:4300,973.515686:255,1100.300000:1290,1198.200000:117,1217.500000:45,243.200000:159,379.100000:231,502.400000:556,599.1
00000:1504,655.000000:1672,814.100000:277,841.200000:215,958.138974:195,1056.000000:492,1196.900000:96,1226.400000:38,28
6.100000:83,408.200000:187,428.200000:283,614.400000:1403,710.900000:1144,730.000000:214,843.600000:194,1011.400000:78,1
057.200000:416,1198.900000:80,1227.000000:20,289.000000:60,353.300000:136,500.700000:143,551.300000:800,665.994513:565,7
57.300000:182,873.300000:166,955.000000:51,1101.262914:302,1197.600000:53,1228.700000:19,253.900000:44,394.000000:115,42
6.400000:75,566.263208:424,665.300000:563,801.800000:171,827.400000:165,1002.100000:46,1030.500000:193,1168.500000:42,29
0.200000:25,388.100000:63,444.100000:75,542.000000:399,664.600000:388,760.000000:160,825.200000:76,937.900000:38,1082.40
0000:126,1170.500000:40,287.100000:23,342.800000:48,454.900000:64,614.100000:373,644.000000:290,769.300000:111,902.10000
0:67,917.300000:37,1029.800000:125,1149.800000:38,214.800000:18,242.100000:19,252.100000:20,315.200000:44,325.800000:17,
333.100000:21,347.500000:19,348.700000:13,349.500000:23,352.600000:47,359.100000:28,366.000000:36,367.900000:7,376.10000
0:14,380.100000:46,407.300000:11,410.900000:22,412.400000:31,418.000000:17,429.900000:57,431.000000:15,436.400000:11,444
.900000:27,447.200000:18,453.200000:11,455.500000:33,456.100000:14,459.900000:15,461.600000:19,463.300000:7,465.600000:2
2,470.400000:12,470.900000:51,474.200000:44,477.100000:15,477.900000:32,483.900000:37,486.200000:20,496.900000:11,497.60
0000:14,499.100000:41,503.800000:24,505.400000:22,508.300000:12,508.900000:17,511.800000:19,513.000000:20,515.000000:18,
517.000000:16,522.100000:58,523.900000:15,524.600000:78,525.300000:19,525.900000:370,526.700000:36,532.900000:11,533.500
000:14,536.900000:19,538.200000:44,539.261607:224,540.200000:39,541.100000:133,543.043902:41,545.100000:9,545.600000:30,
547.300000:23,547.900000:13,548.700000:340,549.600000:81,550.200000:41,551.700000:16,552.300000:69,555.500000:29,557.068
975:361,558.300000:54,560.100000:7,561.100000:24,563.400000:39,564.100000:101,567.600000:35,568.900000:37,569.500000:14,
570.000000:49,571.100000:45,572.300000:76,574.000000:99,574.600000:22,576.300000:18,580.800000:34,582.300000:41,587.1000
00:131,587.900000:53,590.300000:12,591.800000:17,592.500000:18,594.800000:9,595.300000:56,596.100000:97,596.600000:62,59
7.100000:27,597.700000:63,600.000000:57,602.100000:28,603.900000:16,605.200000:69,606.800000:24,607.500000:13,608.500000
:57,608.800000:12,610.200000:50,610.500000:12,611.200000:96,612.200000:24,613.200000:13,615.000000:194,615.600000:19,616
.200000:23,618.400000:15,619.100000:31,621.100000:120,621.700000:36,622.600000:11,623.200000:43,624.100000:147,624.80000
0:32,626.000000:22,627.000000:53,627.900000:21,628.900000:16,629.500000:29,630.500000:14,631.400000:45,633.200000:61,635
.000000:58,635.736413:184,636.600000:29,637.500000:78,638.600000:14,639.800000:72,640.500000:51,641.100000:33,641.700000
:40,642.400000:121,642.800000:170,643.300000:57,644.600000:48,645.700000:36,646.500000:39,647.400000:28,648.500000:30,64
9.500000:108,650.000000:13,650.600000:43,651.800000:107,652.300000:33,652.900000:33,656.300000:178,657.100000:78,658.200
000:19,658.800000:76,660.590741:108,661.900000:216,667.000000:193,677.300000:8,680.500000:13,683.500000:38,684.500000:28
,685.500000:24,686.200000:13,687.275862:87,688.200000:28,688.900000:28,689.400000:50,691.500000:28,692.700000:25,693.200
000:15,694.000000:31,697.100000:8,698.300000:42,700.300000:17,700.900000:21,703.500000:39,704.200000:20,704.900000:14,70
8.300000:15,709.000000:42,711.500000:90,711.800000:119,713.100000:35,715.200000:29,718.500000:57,719.900000:52,721.50000
0:78,722.400000:29,725.400000:30,731.100000:13,731.800000:13,734.500000:36,735.300000:46,735.700000:28,738.600000:23,739
.900000:20,740.500000:81,741.800000:64,744.700000:23,745.500000:18,747.400000:23,751.100000:21,751.900000:34,755.200000:
13,756.200000:28,760.900000:21,762.800000:19,764.100000:19,767.600000:41,768.200000:75,771.200000:9,771.800000:10,773.80
0000:10,776.100000:21,777.500000:39,783.400000:39,785.100000:26,786.800000:15,788.200000:23,789.300000:14,791.700000:21,
792.600000:29,795.700000:53,796.200000:25,798.900000:13,799.400000:14,800.200000:12,800.700000:32,802.300000:25,802.8000
00:103,804.000000:26,805.200000:83,807.900000:15,808.700000:25,809.800000:36,810.900000:50,811.500000:85,812.100000:36,8
13.400000:22,814.600000:78,815.100000:52,815.900000:25,817.300000:21,821.300000:30,822.000000:9,827.800000:33,828.900000
:20,832.100000:13,834.800000:18,835.700000:25,836.600000:20,846.700000:8,851.100000:25,852.054545:66,853.200000:20,854.4
00000:28,857.000000:21,857.800000:21,859.500000:14,861.100000:17,864.500000:20,867.800000:49,868.800000:47,869.100000:19
,869.700000:22,872.900000:22,877.100000:16,880.800000:20,885.000000:21,885.800000:12,886.300000:16,888.800000:11,890.500
000:10,899.339024:41,907.800000:39,909.400000:8,911.200000:27,911.900000:9,925.900000:10,928.800000:30,930.700000:26,933
.700000:9,935.700000:13,945.100000:20,948.900000:10,953.600000:14,960.500000:14,974.100000:36,994.000000:37,1003.300000:
18,1010.200000:18,1010.800000:27,1012.100000:21,1014.000000:14,1020.100000:20,1021.000000:31,1028.900000:118,1031.000000
:18,1031.600000:40,1033.100000:14,1037.900000:55,1041.100000:17,1045.300000:13,1054.000000:92,1057.700000:19,1061.900000
:20,1069.100000:16,1083.600000:41,1093.400000:49,1098.500000:32,1099.800000:46,1102.500000:52,1103.200000:18,1104.500000
:9,1125.400000:16,1131.800000:24,1132.400000:21,1139.800000:12,1150.800000:22,1152.900000:15,1157.600000:8,1165.300000:1
4,1166.700000:11,1178.700000:25,1179.500000:23,1180.400000:25,1185.800000:12,1192.800000:18,1194.800000:12,1214.700000:3
5
      ions2       :
      ions3       :
      peptol      : 0.0
      peptol units:
      peptol str  :
      repeat srch : 1341.784350 from(671.900000,2+)  title(dp210198c%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%
20%20%20%20%2021%2dJan%2d98%20DERIVED%20SPECTRUM%20%20%20%20%239)  query(1)
288.2, 2137
371.127841, 1663
472.096295, 29390
567, 54690
663.1, 114500
758.2, 73560
871.2, 25390
956.1, 2241
1055, 12270
1167.994665, 17250
1215.4, 257
314.2, 1308
377.992647, 1088
501.4, 10430
584.997427, 39060
654.180103, 30060
759.3, 15570
841.9, 19170
972.292156, 1874
1056.3, 3799
1169.1, 11230
1225.2, 58
242.8, 417
377, 828
454.1, 5162
586.2, 5258
662.7, 18300
728.8, 1397
842.9, 4893
956.8, 443
1029.3, 1846
1170.2, 1280
1216.2, 51
313.9, 187
387.2, 656
473.2, 1342
568.1, 5122
663.6, 9782
729.2, 626
872.3, 4300
973.515686, 255
1100.3, 1290
1198.2, 117
1217.5, 45
243.2, 159
379.1, 231
502.4, 556
599.1, 1504
655, 1672
814.1, 277
841.2, 215
958.138974, 195
1056, 492
1196.9, 96
1226.4, 38
286.1, 83
408.2, 187
428.2, 283
614.4, 1403
710.9, 1144
730, 214
843.6, 194
1011.4, 78
1057.2, 416
1198.9, 80
1227, 20
289, 60
353.3, 136
500.7, 143
551.3, 800
665.994513, 565
757.3, 182
873.3, 166
955, 51
1101.262914, 302
1197.6, 53
1228.7, 19
253.9, 44
394, 115
426.4, 75
566.263208, 424
665.3, 563
801.8, 171
827.4, 165
1002.1, 46
1030.5, 193
1168.5, 42
290.2, 25
388.1, 63
444.1, 75
542, 399
664.6, 388
760, 160
825.2, 76
937.9, 38
1082.4, 126
1170.5, 40
287.1, 23
342.8, 48
454.9, 64
614.1, 373
644, 290
769.3, 111
902.1, 67
917.3, 37
1029.8, 125
1149.8, 38
214.8, 18
242.1, 19
252.1, 20
315.2, 44
325.8, 17
333.1, 21
347.5, 19
348.7, 13
349.5, 23
352.6, 47
359.1, 28
366, 36
367.9, 7
376.1, 14
380.1, 46
407.3, 11
410.9, 22
412.4, 31
418, 17
429.9, 57
431, 15
436.4, 11
444.9, 27
447.2, 18
453.2, 11
455.5, 33
456.1, 14
459.9, 15
461.6, 19
463.3, 7
465.6, 22
470.4, 12
470.9, 51
474.2, 44
477.1, 15
477.9, 32
483.9, 37
486.2, 20
496.9, 11
497.6, 14
499.1, 41
503.8, 24
505.4, 22
508.3, 12
508.9, 17
511.8, 19
513, 20
515, 18
517, 16
522.1, 58
523.9, 15
524.6, 78
525.3, 19
525.9, 370
526.7, 36
532.9, 11
533.5, 14
536.9, 19
538.2, 44
539.261607, 224
540.2, 39
541.1, 133
543.043902, 41
545.1, 9
545.6, 30
547.3, 23
547.9, 13
548.7, 340
549.6, 81
550.2, 41
551.7, 16
552.3, 69
555.5, 29
557.068975, 361
558.3, 54
560.1, 7
561.1, 24
563.4, 39
564.1, 101
567.6, 35
568.9, 37
569.5, 14
570, 49
571.1, 45
572.3, 76
574, 99
574.6, 22
576.3, 18
580.8, 34
582.3, 41
587.1, 131
587.9, 53
590.3, 12
591.8, 17
592.5, 18
594.8, 9
595.3, 56
596.1, 97
596.6, 62
597.1, 27
597.7, 63
600, 57
602.1, 28
603.9, 16
605.2, 69
606.8, 24
607.5, 13
608.5, 57
608.8, 12
610.2, 50
610.5, 12
611.2, 96
612.2, 24
613.2, 13
615, 194
615.6, 19
616.2, 23
618.4, 15
619.1, 31
621.1, 120
621.7, 36
622.6, 11
623.2, 43
624.1, 147
624.8, 32
626, 22
627, 53
627.9, 21
628.9, 16
629.5, 29
630.5, 14
631.4, 45
633.2, 61
635, 58
635.736413, 184
636.6, 29
637.5, 78
638.6, 14
639.8, 72
640.5, 51
641.1, 33
641.7, 40
642.4, 121
642.8, 170
643.3, 57
644.6, 48
645.7, 36
646.5, 39
647.4, 28
648.5, 30
649.5, 108
650, 13
650.6, 43
651.8, 107
652.3, 33
652.9, 33
656.3, 178
657.1, 78
658.2, 19
658.8, 76
660.590741, 108
661.9, 216
667, 193
677.3, 8
680.5, 13
683.5, 38
684.5, 28
685.5, 24
686.2, 13
687.275862, 87
688.2, 28
688.9, 28
689.4, 50
691.5, 28
692.7, 25
693.2, 15
694, 31
697.1, 8
698.3, 42
700.3, 17
700.9, 21
703.5, 39
704.2, 20
704.9, 14
708.3, 15
709, 42
711.5, 90
711.8, 119
713.1, 35
715.2, 29
718.5, 57
719.9, 52
721.5, 78
722.4, 29
725.4, 30
731.1, 13
731.8, 13
734.5, 36
735.3, 46
735.7, 28
738.6, 23
739.9, 20
740.5, 81
741.8, 64
744.7, 23
745.5, 18
747.4, 23
751.1, 21
751.9, 34
755.2, 13
756.2, 28
760.9, 21
762.8, 19
764.1, 19
767.6, 41
768.2, 75
771.2, 9
771.8, 10
773.8, 10
776.1, 21
777.5, 39
783.4, 39
785.1, 26
786.8, 15
788.2, 23
789.3, 14
791.7, 21
792.6, 29
795.7, 53
796.2, 25
798.9, 13
799.4, 14
800.2, 12
800.7, 32
802.3, 25
802.8, 103
804, 26
805.2, 83
807.9, 15
808.7, 25
809.8, 36
810.9, 50
811.5, 85
812.1, 36
813.4, 22
814.6, 78
815.1, 52
815.9, 25
817.3, 21
821.3, 30
822, 9
827.8, 33
828.9, 20
832.1, 13
834.8, 18
835.7, 25
836.6, 20
846.7, 8
851.1, 25
852.054545, 66
853.2, 20
854.4, 28
857, 21
857.8, 21
859.5, 14
861.1, 17
864.5, 20
867.8, 49
868.8, 47
869.1, 19
869.7, 22
872.9, 22
877.1, 16
880.8, 20
885, 21
885.8, 12
886.3, 16
888.8, 11
890.5, 10
899.339024, 41
907.8, 39
909.4, 8
911.2, 27
911.9, 9
925.9, 10
928.8, 30
930.7, 26
933.7, 9
935.7, 13
945.1, 20
948.9, 10
953.6, 14
960.5, 14
974.1, 36
994, 37
1003.3, 18
1010.2, 18
1010.8, 27
1012.1, 21
1014, 14
1020.1, 20
1021, 31
1028.9, 118
1031, 18
1031.6, 40
1033.1, 14
1037.9, 55
1041.1, 17
1045.3, 13
1054, 92
1057.7, 19
1061.9, 20
1069.1, 16
1083.6, 41
1093.4, 49
1098.5, 32
1099.8, 46
1102.5, 52
1103.2, 18
1104.5, 9
1125.4, 16
1131.8, 24
1132.4, 21
1139.8, 12
1150.8, 22
1152.9, 15
1157.6, 8
1165.3, 14
1166.7, 11
1178.7, 25
1179.5, 23
1180.4, 25
1185.8, 12
1192.8, 18
1194.8, 12
1214.7, 35


*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50