This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Having problem with NCBI remap.pl

Hi,

I have hg38 coordinates at hand and I want to convert them to hg19 coordinates using ncbi remap_api.pl in java.

Here is my perl remap arguments in a string array.

[perl , C:\\Users\\Burçak\\Google Drive\\Data\REMAP\remap_api.pl, --mode asm-asm , --from , GRCh38, --dest , GRCh37.p13, --annotation , chrName_0Based_StartInclusive_EndExclusive_hg38_coordinates.bed, --annot_out , chrName_0Based_StartInclusive_EndExclusive_hg19_coordinates.bed]

I'm executing these parameters in runtime and there is no output.

I just get the the following usage information. Any idea?

Thanks,

Usage: perl remap_api.pl

      Please limit your submissions to files of approximatly 250,000 rows,
      and at most 4 simultaneous submissions.

      --mode <mode>
         batches, asm-asm, asm-rsg, rsg-asm, alt-loci.

      batches will print a list of all assembly-assembly pairs that alignments
      exist for.

      batches use no other argumentes,
      other modes:
          asm-asm is for mapping between two assemblies
          asm-rsg is for mapping from an assembly to a gene data set (RefSeq or LRG)
          rsg-asm is for mapping from a gene data set to an assembly
          alt-loci is for mapping between a primary assembly and its related alt-loci

      required:
        --annotation <filename>
          The file containing your existing annotation (GFF3, GVF, BED, etc)

        --from <gencoll accession>
        --dest <gencoll accession>
          The gencoll accessions for the assemblies being mapped to and from
          Use 'RefSeqGene' when mapping to or from RefSeqGene
          Use 'LRG' when mapping to or from LRG
          Leave out --dest when use 'alt-loci' mode

      options:
        --allowdupes <'on' or 'off'>
          on (default) does all possible mappings,
          off excludes second pass mappings

        --merge <'on' or 'off'>
          on (default) will merge fragmented mappings back together
          off will leave fragmented results untouched

        --mincov <fraction 0.01 to 10.0, default 0.5 >
        --maxexp <fraction 0.01 to 10.0, default 2.0 >
          (r_cov = mapped_feature_length / original_feature_length
           if r_cov < min_cov then throw out feature
           if r_cov > max_exp then throw out feature )
          mapped_feature_length might not be identical to original_feature_length
          because the mapping alignments are not always identical. Large gaps
          might be inserted into features, causing the total feature length to grow.
          Or regions covered by a feature might not be covered by alignments at all,
          so the mapped feature is smaller than the original

        --in_format <guess (default), hgvs, bed, gvf, gff, gtf, gff3, asnt, asnb, region>
        --out_format
          The input format of your annotation file, and the desired output format
          Conversions to different formats might not preserve meta-data exactly.
          Leave --out_format alone to get out the same format as in.
          Guess leaves the decision to our service. 

Exit status = 0
ncbi remap

What's up with the commas?

remap_api.pl, --mode asm-asm ,..

Surely that can't work..

Parameters are inside a string array (argsForNCBIRemapPerlProgram)

And it was the content of that string array.

Later on, I pass this string array in the statement below:

process = runtime.exec(argsForNCBIRemapPerlProgram);
Runtime runtime = Runtime.getRuntime();
        Process process = null;

            try {
                process = runtime.exec(argsForNCBIRemapPerlProgram);
                process.waitFor();

                //output of the perl execution is here
                BufferedReader is = new BufferedReader( new InputStreamReader( process.getInputStream()));
                String line;
                while ( ( line = is.readLine()) != null)
                    System.out.println(line);

                System.out.flush();

                System.err.println("\nExit status = " + process.exitValue());

            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

Does it work when you just call the program? Not from your java thingy but from the cmd. Also, some special characters like ç can cause problems, but in this case it just looks to me like you're not passing all the required arguments to the program. I don't know anything about java though so..

1 answer

Hi,

I have solved the issue by using the statement below

process = runtime.exec("perl " + "\"" + remapFile + "\"" + " --mode asm-asm --from " + sourceAssembly + " --dest " + targetAssembly + " --annotation " + "\"" + sourceFileName + "\"" + " --annot_out "+ "\"" + outputFileName + "\"" );

For sourceAssembly, I have used GCF_000001405.26 instead of GRCh38. For targetAssembly, I have used GCF_000001405.25 instead of GRCh37.p13.

And remapFile, sourceFileName and outputFileName can contain space characters in their directoryPath, therefore I have added double quotation mark before and after each of them.

How it runs in the command line:

perl "C:\Users\Burçak\Google Drive\\Data\REMAP\remap_api.pl" --mode asm-asm --from GCF_000001405.26 --dest GCF_000001405.25 --annotation "C:\Users\Burçak\Google Drive\\Output\test5\GivenInputData\chrName_0Based_StartInclusive_EndExclusive_hg38_coordinates.bed" --annot_out "C:\Users\Burçak\Google Drive\\Output\test5\GivenInputData\chrName_0Based_StartInclusive_EndExclusive_hg19_coordinates.bed"

In this way, I solved the issue.

Thanks

Log in to answer this question.