zoukankan      html  css  js  c++  java
  • 【BioCode】Elm格式中提取位点信息

    说明:

    ①Elm格式:

    PLMD ID    Uniprot Accession    Position        Type        Sequence         Species          PMIDs
    PlMD编号 Uniprot数据库编号         位点    翻译后修饰类型    序列信息        物种          PMID

    PLMD-1      O00115        52        Ubiquitination    MIPLLLAALLCVPAGALTC Homo sapiens    21963094;23266961


    ②代码说明:从上述格式中提取Position信息,当 Uniprot Accession相同时,Position位于同一行。不相同时,回车换行。每个位点之间用空格隔开。

    代码:

    package single;
    
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    
    public class Elm_site {
        // 从Elm中获得位点 每一行是一个蛋白质的的位点
        public void get_site(String path) {
            try {
                FileReader reader = new FileReader(path);
                BufferedReader br = new BufferedReader(reader);
                String str=null;
                String now="O00115";
                FileWriter fileWritter = new FileWriter("E:\experiment--help\linglingbao\site.txt");
                BufferedWriter bufferWritter = new BufferedWriter(fileWritter);
    
                while((str=br.readLine())!=null){
                    String[] temp =str.split("    ");//每一列之间使用TAB隔开的,需要用TAB来截取
                    String uni_id=temp[1];
                    if(uni_id.equals(now)){
                        System.out.print(temp[2]+" ");//输出
                        bufferWritter.write(temp[2]+" ");//写入文件
                        bufferWritter.flush();
                    }else{
                        now=uni_id;
                        System.out.print("
    "+temp[2]+" ");
                        bufferWritter.write("
    "+temp[2]+" ");
                        bufferWritter.flush();
                    }
                }
                br.close();
                reader.close();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        public static void main(String[] args) {
            Elm_site site = new Elm_site();
            String path = "E:\experiment--help\linglingbao\ubiquitination.txt";
            site.get_site(path);
        }
    }

     输出结果格式:

  • 相关阅读:
    计算机学院大学生程序设计竞赛(2015’12)Study Words
    离散化
    一键拨打
    python中Strip()函数的用法
    笨方法学python 22,前期知识点总结
    笨方法学python之读写文件、open函数的用法
    Linux 多线程串口通信
    RSA加密前言
    GrabCut--Opencv篇
    队列
  • 原文地址:https://www.cnblogs.com/yumiaomiao/p/7117350.html
Copyright © 2011-2022 走看看