• 検索結果がありません。

10ー~MYA

ドキュメント内 修 士 学 位 論 文 (ページ 43-103)

Drosophil

Sophopho/a 

Figure 11Estimated divergence times for the subgenus Drnsophila species. The lineageto the New World species are markein red.  40 

Figure 12Potential migration route of the New World species from the Old World. The world map in Miocene era was according to  Blackey et al.  (2008)The common ancestor of the New World species lived in the Old World migrated through the Bering Strait to the  New World in Miocene. 

41 

AppEtndix 

Operating environment 

OS: windows 7 Ultimate 64 bit 

Integrated Developmental Environment: 

Eclipse Java EE IDE for Web Developers.  Version: Kepler Service Release 2 

Build id: 201402240627

External libraries 

Biojava version 4.0.0 (http://biojava.org/wiki/Main Page) 

Apache  POI  ‑ the  Java  API  for  Microsoft  Documents  version  3.1.1  (http://poi.apache.org/) 

I coded all  class files  in a same packag13 folder.  Almost all  softwares were GUI,  developed by Swing Designer 1.6.1.r43x201309100023. 

Output files Reader of Blast+ & Fastaleeditor 

package practice import javax.swing.

import javax.swing. text.DefaultEditorKit* import org.biojava3.c,re.sequence.合,

import org.biojava3.care.sequence.storage.BitSequenceReader import org.biojava3.data.sequence.

import Java.a wt* import Java.a wt event合,

import Java.10合,

import java.util.* import java.util.List import java. util.regex.Matcher import java. util.regex.Paern,

@SuppressWarnings("seria l

public clasNGSfileEditor extendJFrame implementActionListener{  privaJTextAreatextArea new JTexieaO;

//カット、コピーベースト用アクション privaActioncutAction new CutActionO privaActioncopActionnew CopyActionO privaActionpasteAction new PasteActionO pnvaJButtonopennew JButtonoutFileを聞く),

privaJButtonopenFastanewJBuonfastaを聞く),

privaJButtonsavenewJButton(保存 ) privaJButtoncutnew JButton(cutAction),  privaJButtoncopnew JButon(copyAction), privaJButtonpastenew JButton(pasAction), privaJButtonrunOutFile new JButton 九・unOutFile privaJButtonremoveHinew JBuonHit配列を除いて保存),

privaJButtonsaveHinew JButtonHit配列のみを取り出す)

pnvaJFileChooserchooser neJFileChooserC:¥¥cDNAData) priva回目tringfileAdress

privaArrayListseqlist

privaArrayList<ArrayListinde!List;//ヒットエリアリストのリストseqlistと同じ数だけ存在 privaArrayList<lnde!Data>hitareaList;//各配列内のインデノレリスト

privaeLis.FastaSequence>fastaList

privaArrayList<FastaSequence>fastaList2newArrayList<FastaSequence>O

//コンストラクタ publiNGSfileEditorO{ 

superLcca!Blast結果解析

setDefaultCloseOperation(JFrame.EXIT ON CLOSE) setize(S00,600);

JPanel panell neJPanelO,  JPanel panel2 new JPaneJO

getContentPaneO.add(panell,BorderLayout.NORTH)

getContentPaneO.add(new JScrollPane(textArea),BorderLayout.CENTER) getContentPane0.add(panel2,BorderLayout.SOUTH); 

panell.add(open) panell.add(openFasta),  panell.add(save) panell.add(runOutFile);  panell.add(removeHit);  panell.add(saveHit) panel2.add(cut) panel2.add(copy) panel2.add(paste) open.addActionListener(this) openFasta.addActionListener(出1s save.addActionlstener(this); runOutFile.addActionLisner(this), removeHit.addActionListener(出1s); saveHit.addActionListener(this) chooser.setAcceptAIIFileFilterUsed(false)

publistatic void main(Stringargs) { 

new NGSfileEditorO.setVisibleue),

/[聞く保存]ボタンが押された時の処理 publivoid actionPerformed<ActionEvent event){ 

openOutO,  catch (IO Exception e) { 

e.printStackτ'taceO, 

else if (event.getSourceO.equals(openFasta))  openFasO;

else if (event.getSourceO.equals(save)){  saveFileO; 

else if (event.getSourceO.equals(runOutFile)){  try { 

runOutFileO,  catch (IO Exception e) { 

II TODO Auto generaertcatch block  e.printStackτ'taceO; 

else if (event.getSourceO.equalsmoveHit)){ try { 

1moveHitO, catch (FileNotFoundException e) { 

II TODO Autogenerated catch block  e.printStackTraceO; 

else if (event.getSourceO.equals(saveHit)){  try { 

saveHitO,  catch (FileNotFoundException e) { 

II TODO Auto generated catch block  eprintStackτ'taceO; 

//ファイノレを聞くメソッド

privavoidopenOutO throws FileNotFoundExceptionIO Exception  chooser.setFileFilter(new OutFilrO);

inreturnVa chooser.showOpenDialog1is), if (return Val二 二JFileChooser.APPROVEOPTION){ 

日lefilechooser.getSelectedFileO;  se'itle(file.getAbsolutePathO); fileAdress file.getAbsolutePathO, 

pnvavoidopenFastaO 

chooser.setFileFilter(new FasFilrO), inreturnVa chooser.showOpenDialog1is), try 

if (return Val二 二JFileChooser.APPROVEOPTION){  lef山 二chooser.getSelectedFileO; FilelnputStream inputnewFilelnputStream(file)

} 

fasList(AirnyList<FastaSequence>) SequenceUtil.readFas回(input se'itle(file.getJsolutePahO);

System.out.println( 配列数 +fastaList.sizeO), catch (FileNotFoundEceptionevent) { 

event.printStackτ1aceO; catch (IO Exception event) { 

event.printStackτ1aceO,

//ファイノレを保存するメソッド privavoidsa veFileO 

}  llrunメソッド

chooser.setFileFilter(new TxtFilrO), inreturnVa lchooser.showSaveDialog(this) try 

if (return Val二 二JFileChooser.APPROVEOPTION

} 

日leWriter !Writernew FileWriter(chooser.getSelectedFileO) xtArea.write(fWriter);

catch (FileNotFoundEceptionevent) {  event.printStackτ1aceO; catch (IO Exception event) { 

event.printStackτ1aceO,

privavoidrunOutFilethrows IO Exception {  FileReader fReader

fReadernewFileReader(fileAdress), 

BufferedReader bReadernewBufferedReader(fReader),  mt threshold60;/Iヒットした領域の切る値 % Strmg lmestart,

o; 

Strinppldnull, booleaindelcheck false,  int hitCount o;  seq listnewArrayListO indelListnewArrayListO, 

whileOine.indexOf(Number osequences in database.1){

Ii bReader.readLineO; 出line.indexOf("BLASTX")I1)(

blastx 

// 1つのクエリーについて読み始める if(line.indexOf(Query二)?二1){

Stringid二line.spl以 ¥¥s),

Strinnameid[l]; float querlength0, i(line.indexOf("length11){

Stringlengh二line.split(¥¥s¥¥s

querylength 二Integer.parselnt(length[l].replaceA!l("[A9),10) if (blastx二 二1){

querylength querylength/3, 

// 1つの遺伝子内について、情報を集める mth1t1,

StringeneNamenull, Stringenelnull hitareaList new ArrayListO,  float hitlengh=o; 

float identities = o; 

int geneNo O;Jヒットした遺伝子の最初のもののみを読むためのパラメータ whilline.indexOf(Effective searcspace used:  ){ 

line bReader.readLineO;  if (line.indexOf(Leng出二l?二 1){

StingOlength= line.split 

query length IntegerparselntOength[l.replaceA!l([A9,),10) f(blastx二 二1){

querylength querylength/3, 

//プラストヒットした場合の処理

else if(line.indexOf(日equencesproducing significanalignments11){ //hit

hitCount+,

while ( line.indexOf(Eetivesearspace used:  ){  line bReader.readLineO; 

if (line.indexOf(o){ geneNo++, 

Hプラストヒットの一番最初の遺伝子についての 読み取り

if (geneNo二 二1){

if(line.indexOf(name= 1){  //name  l geneNameを代入して次のベクトノレへ

String regex lname二+ヲ,

Pattern  Pattern.compile(regex); 

Macher p.matcher(line), 

if(m.findO) mt startm.start0+5, 

mt end= m.endO L 

(geneName二 二null){

geneNameline.substring(start,end),

(line.indexOfparent11){

Strinregex2 =FBgn 

Pattern p2 Pattern.compile(regex2) Matchem2 p2.matcher(line), 

if(m2find0){ 

︷ ︶ 

geneld m2.group0,  }else if(geneld二 二m2.group0){ 

}else 

System.out.println( 複数ヒットです ),

Sysem.out.println川ameマッチしませんl

代入して次のベクトノレへ FBgn.  l Pattern.compilerngex); p.matcher(line

(geneld二 二null){

l?二 1){ bReader.readLineO, 

イトの位置

0,  0, 

geneldmgroupO,  }else il1geneld二 二mgroupO) { 

}else { 

Sysem.out.println( 複数ヒットです ),

o;11最初にヒットした遺伝子内の個所の、先頭の部分のクエリー番号のみを記録する

false, の読み取り

二 二false){

if(line.indexOfIdentities 1){ 

Stringident二line.split¥s  String length二iden[3] spli

1dentScore 二Integer.parselnt(ident[4]replaceAllAQ 9,10);  lcca!Length 二Integer.parselnt(lengh[l].replaceAll0910),

if((line.indexOfFrame ~") I二1& &  (blastx1)){

StringfL'二line.split l mt lastfr.length1, 

els

else if(line.indexOf(FBgn1

//ID lgeneldl String regex

Pattern  Macher m

if(m.findO)

elsiOine.indexOf(Score 

!me  inframe 0 instart o;11 inend0,  inidentScore

int lora ]Length

int siteCount

boolean lastarea  H次のエリアまで while  Oastarea 

((!ine.indexOf(Query1 1)& &  (identScore threshold)) Stringsitelineline.split0), i(siteCount二 二o){

starInteger.parselnt(siteline[ll.replaceA!l("[A910)

endIneger.parselnt(siteline[siteline.length 1.replaceA!l[八09),10),  siteCount++

ヒット2箇所以降

else if ((identScore threshold) & &  (line.indexOf(Seo二)1)){ hitaaList.add(newIndelData(start,end,frame,identScore,localLength)) hit 1, 

siteCount 0

//1つ目の遺伝子が終わり、次の遺伝子か1つの遺伝子のみについての情報を読み取ったら終了

else if ((line.indexOf(〉)0)(line.indexOf("Lambda") f1)) {  geneNo++

lastareatrue, i(identScore threshold){ 

hit 1, 

hitareaList.add(new Inde!Data(sart,end,frame,identScore,localLength)),

/ヒットした部分の長さの和を計算。変則ヒットは計算していない

i(hitareaList.sizeO 1){ 

i(hitareaList.sizeO 4){ 

Sysem.out.println(name+ +hitareaList.sizeO+個所を結合),

ArrayList fixnew ArrayListO,  for (int jo;j<5;j++){

fix.add (hitareast. get(j

hitareaList fix, 

Sysmout.println(ヒッ数大杉),

Collections.sort(hitareaList,new lndelComparatorO) mt pHitlength0,

for (int jo;j<hitaaList.sizeO;j++){

pHitlength hireaList.get(j).getLengthO,

for (int jo;j<hireaList.sizeOLj++){ 

mt reverse hitareaList. E)• getFrameO,  mt preS hitareaList.get(j).getStartSi0, mt preE hitareaList.get(j).getEndSiteO

 

mt proE hireaList.get(j+1).getEndSiteO

//Sysmout.prinln( 前のシーケンス +preS+","+preE+後のシーケンス +proSγ mtdif0, 

i(reverse < O){ 

if (preE < proS){ 

difproS‑preE

else if (reverse 0) {  if (preE proS ){ 

difpreE‑pros, 

i(blastx二 二1){ dif I3

pHitlength一二dif,

hitlength pHitlength }else i(hitareaList.sizeO二 二1){

hitlength hareaList.get(O).getLength 0,  }else i(hitareaList.sizeO

hit二 一L

//Sysm.out.prinln("hitしたが、 thresholdでアウトウ,

break, 

linebReader.readLineO, 

} 

//プラストヒットしなかった場合 else if(line.indexOf(Nohifound)?二1){

//indent山 田0を代入して次のベクトノレへ identitieo; 

//遺伝子内情報を集めた後、seqDaの生成 if(line.indexOf(Effective search space used: 1 1){

//シーケンスリストの生成

} 

bReader.closeO,  fReader.closeO; 

identities二(hitlength/querylength100,

seqlist.add(new SeqData(name,hit,identities,geneName,geneld,geneNo)),  indelList.add(hitareaList); 

Sysem.out.println("sequenceList:seqlist.sizeO);  System.out.println("HitCount:叫hitCount); Sysem.out.println("lnde!List:l+ indelList.sizeO); 

pnvaevoid removeHitthrows FileNotFoundException {  int hitcount o; 

for(int i~O;i<seqlist.sizeO;i++) { 

int hit eqDaseqlist.get(i)).getHitO, 

hitcount++, 

fasList.remove(ihitc,unt+1) Sysmout.println(i) }else if (hit1){

Sysem.out.println川ohit), 

chooser.setFileFilter(new FasFilrO), inreturn Vachooser.showSaveDialog(this),  tr

i(return ValJFileChooser.APPROVEOPTION

OutputStreaosnewFileOutputStream(chooser.getSelectedFileO) SequenceUtil.writeFasta(osfastaList)

} 

catc(FileNotFoundExceptioevent event.printStackτ'taceO catc(IO Exceptioevent)  { 

event.printStackτ'taceO, 

pnvavoidsaveHitthrows FileNotFoundExceptio extArea.append(変則ヒットリスト¥n),

for(ini~O;i<seqlist.sizeO;i++) {//outファイノリスト inhit ((SeqData) seqlist.get(i)).getHitO inparalog ((SeqDaseqliget(i)).getGeneNoO, Strinflybaseld二(SeqData)seqlist.get(i)).getldO if(hit1){

//System.out.println(((SeqData) seqlist.get(il).getNameOヒットなレウヲ

} 

else if (hit二 二1){

System.out.println(fastaList.get(i).getld Hit:"+ ((SeqDa回)seqlistE目(i))getHitO);  Strinseq二fastaList.get(i).getSequenceO;//fastaのリスト

ArrayList<lndelDa回>indellistinde!List.get(i); seqmodseq(seq,indellist,false), 

if (indellist.sizeO 4){ 

textArea.append(ヒット数が多す ぎ ま すflybaseld)

Strinid二SeqDa回)seqlist.get(il).getGeneO+ '( 

loca!Name−+ ((SeqData) seqlist.get(i)).getNameO frame−+ indellist.get(O).getFrameO

Fas回目equencefs new FastaSequence(id,seq) fasList2.add(fs);

} 

chooser.setFileFilter(new FasFilrO inreturn Vachooser.showSaveDialog(this),  tr

i(return Val二 二JFileChooser.APPROVE OPTION

OutputStreaonew FileOutputStream(chooser.getSelectedFileO) SequenceUtil.writeFasta(osfastaList2)

} 

catc(FileNotFoundExceptioevent)  {  event.printStackτ'taceO;  catc(IO Exceptioevent)  { 

event.printStackτ'taceO, 

} 

//ind elリストを並べ替え、 入 れ子 に な っ て い る も の を 修E

privaArrayList<lndelDa回>fixindel(ArrayList<lndelDatainde!List,boolean onlyHitArea) Collections.sort(inde!List,new lnde!Comparatc,r())

ArrayList<lndelData> fixlisnew ArraList);ヲ fixlist.add(inde!List.get(O)); 

for(inio;i<inde!List.size01;++ ){ 

inreverseinde!List.get(i).getFrameO, inpresinde!List.get(i).getS回 目 白 血O; inpreEinde!List.get(il.getEndSiO; inprosinde!List.get(i+1).getSrtSiteO, inproEinde!List.get(i+1).getEndSiteO inpreldentinde!List.get(i).getldentO; inproldentinde!List.get(i1).getldentO, mt same0, 

︵ A

A u 

t s vpnp

Pr p ︵ ︶ On︿ OD  

− ︵ ︷ ︶ 

n u 

v e − ︵ X− vl n ︵ 

lnde!Da(preS,proSl,inde!List.get(i).getFrameO,O,proS 1 preS))

fixlist.add(inde!List.get(i1)) fixlist.add(new 

lnde!Da回(proE+l,prol,inde!List.get(i).getFrameO,O,proS1 preS))

}else

if(preldenproldent)

fixlist.add(inde!List.get(i)),  fixlist.add(new 

}else{ 

fixlist.add(new  IndelData(preS,proS l,indelList.get(i).getFrameO,O,proS 1 preS))

fixlist.add(inde!List.get(i1)), 

}else if (pres二pros){

if(preldenproldent){ 

fixlist.add(inde!List.get(i)) fixlist.add(new 

Inde!Da(preE+l,proE,indelListE(i).getFrameO,O,proEpreE)), 

}else{ 

fixlist.add(new  Inde!Da(preS,proSl,indelList.get(i).getFrameO,O,pro1preS))

fixlist.add(inde!List.get(i1

}else{ 

if((preSproS)&& (prE二proE)){

if(reverse > O){ 

if ((same&&(i>O))

E1st.add(inde!List.get(i)),

}  same++, 

if(pro<二preE){

xlist.remove(fixlist.sizeO1) f((p四日二pr11 (preE二proE)){

fixlist.add(new  Inde!Data (preS ,preE,indelList.get(i)getFrameO,preS preE), 

}else{ 

fixlist.add(new  IndelData(preS,proS,indelList.get(i).getFlameO,O,proS p四S

fixlist.add(inde!List.get(i1)),  fixlist.add(new 

IndelData(proE,preE,indelList.get(i).getFrameO,O,preE proE)), 

}else{ 

1++ }else{ 

fixlist.add(inde!List.get(i1

if(pro>二preE){

fixlist.remove(fixlist.sizeO 1) f((p四日二pros)(preE二proE)){

fixlist.add(new  Inde!Da(preS,preE,indelList.get(i).getFrameO,O,preEpref

}else{ 

fixlist.add(new  IndelData(preS,proS,indelList.get(i).getFlameO,O,preS proS

fixlist.add(inde!List.get(i+ 1)),  fixlist.add(new 

IndelData(proE,preE,indelList.get(i).getFlameO,O,proE preE)), 

} 

1++,  }else{ 

xlist.add(inde!List.get(i+1

} 

Collections.sort(inde!List,new IndelComparatorO);  return fixlist; 

priva回目tringmodseq(StrininitSeq,ArrayList<IndelData> indellistboolean onlyHitArea){  StrinseqinitSeq,

inseqlengthseq.Ieng0,

//Sysmout. printlnmi.Length:"+seqlength),  indellistfixindel(indellist,false

inmultihiindellist.sizeO;  Hヒットーか所の修E Inde!Datfirstindellist.get(o); inframefirst.getFrameO; inframeShifo; 

inprentSitefirst.getStartSiteO, booleahensokuhifalse;  H表裏をもとに戻す i(frame 0) { 

DNASequence dnew DNASequence(seq

seqds.getReverseComplementO.getSequenceAsStringO frame frame( 1); 

i(onlyHitArea) { 

}else{ 

for (int io;i<multihit;i++){

} 

semodseq

frameindellist.getG).getFrameO, int ss indellist.get(i).getStartiteOi;  int esindellist.get(i) .getEndSi0 if (frame < o){ 

} 

ssseqlength‑ss ‑1,  esseqlengthe‑L  modseseq.substring(ss,es+ 1), 

StringBuildesneStringBuilder(seq);  if(onlyHiTea二 二false){

} 

switc(frame){ 

case 2:seqsb.delete(O,1もoStl'ingO;frameShift2;break,  case 3:seqsb.delete(O,2)回目白ingO;frameShift++;break; default:break

} 

infirstShifframeShift

//2個所目以降のサイトの位置がずれる(フォワードの場合)

//2個所目以降の修E if (multihit 1){ 

if (multihi4) {  }else{ 

for (injo;j<multihitLj++ ){ 

lnde!Data preindel (Inde!Data) indellist.getG), 

sb.dele(presentSite,presentSite+1加StringO;frameShi此+;break,

lnde!Datproindel (Inde!Data) indellist.getG+ 1),  int preframe preindel.getFrameO; 

int proframe proindel.getFrnmeO; 

s new StringBuilder(seq); 

presentSite preindel.getEndSiteO + 1 frameShift;  f(proindel.getFrameO){ 

presentSite seqlen宮山 (p四 国del.getEndSiteO+ 1) ,  preframe pframe1);

proframe proframe*1);  switch (preframe){ 

case 2 

switch (proframe){ 

case  3:se case  1:se sb.dele回(presentSite,presentSite+2)回StringO;frameShi二frameShi此+2;break

case 3 

sb.dele回(presentSite,presentSite+1)回StringO;frameShi;break,

sb.dele回(presentSite,presentSite+2)回StringO;frameShi二frameShi此+2;break, 

case 1 

sb.dele回(presentSite,presentSite+1StringO;frameShi此十両break,

sb.dele回(presentSite,presentSite+2)回StringO;frameShi二frameShi此+2;break

if (onlyHitArea & &  multihit < 5){ 

//ヒット領域のみを抽出 framefirst.getFrameO,  infirstFrame frame if (firstFrame < O){ 

firstFrame firstFrame1), switc(firstFrame){ 

case UirstFrame  o;break,  case 2:firstFrame  2;break;  case 3:firstFrame  Lbreak; 

} 

inss  first.getStartSiteO  L 

default:break

}  break switc(proframe){  case 

case  default:break

}  break switch (proframe){  case 

case  default:break

}  break

1:se 2:se

2:se 3:se

i(frame o){ 

es frameh }else if (frame O){ 

ssseqlengthss ‑1, 

esseqlength‑frameShift es ‑

} 

seqseq.substring(ss,es+ 1), 

//seq seq.replaceAllN  return seq; 

Class of information of insertion and deletion sites 

packagpractice; 

publiclass IndelData  {  private int startSite; 

private intrame, private int endSite; 

private int identity private int length; 

public IndelDataint startSte, int endSite, intrame,,int 1dentity,1nt length this startSite startSite, 

thisendSiteendSite; 

thisrame=千rame, thisidentityidentity thislengthlength; 

public  int getStartSite() return startSite, 

} 

public  int getEndSite() return endSite; 

} 

public  int getFrame () {  return frame; 

} 

public  int getldent () {  return  identity

} 

public  int getlength() return  length, 

Class of sequence data information of Blast 

packagpractice; 

publiclass  SeqData  {  privatString  name; 

private int hit,  privateloatidentities; 

privatString geneName,  privatString geneid,  //private intrame;

private int geneNo; 

public SeqData(String name,int hitloat identities, String geneName, String gene Id, int geneNo)  thisnamename; 

} 

this hihit; 

this identities 1dentit1es;  thisgeneNamegeneName; 

this geneigeneid,  /this.rame=千rame;

thisgeneNogeneNo; 

public String getName()  return name, 

} 

public  int getHi t () {  return hit; 

} 

publicloatgetidentities() return  identities; 

} 

public String getGene() return geneName; 

} 

public String getid() return geneid; 

} 

/*public  int  getFrame() returnrame;

}*/ 

public  int getGeneNo() return geneNo, 

Indel comparator 

package practice; 

import java. utilComparator;

public class  IndelComparator implements Comparator<IndelData>  public IndelComparator() 

TODO Auto‑generated constructor stub 

}  旧verride

public  int compare(IndelData ol, IndelData o2)  {  intramelol. getFrame(),  int sl ol.getStartSite();  int s2 o2 getStartSite(),  if (千ramel < 0){ 

isl > s2){ 

return 1, 

}  else

return 1, 

}  }else if (frame0){ 

isl > s2){ 

return 1, 

}  else

return 1 }else

return 0

Flybase gene number filter 

package practice

import java. util.regex.Matcher import java. util.regex.Paern, public class FbgnFilter { 

public FbgnFilterO { 

II TODO Auto generated constructor stu

} 

publistatic String fbgnfilter日tringline){

sringregex2FBgn.

Paternp2 Pattern.compile(regex2) Matherm2p2.macher(line); if(m2.find0){ 

return m2.group0,  else { 

return error, 

} 

publistatic String cantigfilter(String line) String regexntig. , 

} 

Paernp Pattern.compile(regex);  Matcher p.matcher(line);  if(m.find0){ 

else { 

return m.groupO, 

return error, 

publistatic String parenthesisfilter(String line){  String regexl. Patl'IlpPattern.compile(regex), Matcher mpmatcher(line);  if(m.find0){ 

else { 

return m.groupO, 

return error, 

, 

Blast output file filter 

package practice,  imporjava.io.File, 

imporjavax.swing.filechooser.FileFilter publiclass OutFilteextendFileFilte

publiboolean accep(Filfile) {  ilenull){ 

//ディレクトリ判定 if (file.isDirectoryO) {  }else { 

return true,  H拡張子判定

StrinextgetExtensionle); if (ext 1~ null & &  ext.equalsout")) { 

return true; 

//trueが返らなかったとき return false, 

//拡張子を取得するメソッド

priva回 目tri getExtension(Filefile) {  if(file二 二null) else { 

return null

//ファイノレ名を取得

Strinnamefile.getNameO, 

//最後のピリオド位置を取得 mt perioname.lastlndexOf(' '), 

if (period> & &  period< name.length1

//拡張千を小文字で返す

1turnname.substring(period 1).toLowerCaseO,  else { 

return null

publiString getDescription returnOutファイノレ(*.out

Orthologous gene checker by Flybase Gene numbers 

package practice import javax.swing.

import javax.swing.text.DefaultEditorKit. import org.biojava3.data.sequence.FastaSequence import org.biojava3.data.sequence.SequenceUtiJ;  import org.biojava3.c,re.sequence.io̲*;  import org.biojava3.c,re.sequence. import Java.wt*, 

import Java.wt event会,

import Java.10合,

importjava.util.*,  import java.util.List, 

import javautil.regex.Matcher import javautil.regex.Paern,

@SuppressWarnings("seria l

public class OrthologChecker extends JFrame implements ActionListener{  pnvaJTextAreatextArea new JTexTea0, 

//種名入力欄

pnva回JLabelsplabel 二new JLabel privaJTextFieldspeciesnewJTextField(lO)

//プログラム実行部分

priva回JButtonopenFasta二newJBuonfastaを聞く ),

privaJButtonsave二newJButon("オ一ソログリストを テキストで保 privaJButtonsetFolder二newJButtonfasの保存先");

privaeJButton check二newJButton checkOrth

log

privaeJFileChooser chooser

privaeList<FastaSequencefastaList; 

privaArrayList<FastaSequence>fastaLiOutNucnewArrayList<FastaSequence>O privaArrayList<FastaSequence>fastaLiOutPronewAr・rayList<FastaSequence>O; 

priva回ArrayList<FastaSequence>fastaLi3二newArrayList<FastaSequence>O;//最後に、NGSデータのみをまとめたりスト String saveadressC:¥¥cDNADa

//コンストラクタ public OrthologCheckerO{ 

superOrtholog結果解析 ),

setDefaultCloseOperation(JFrame.EXIT ON CLOSE);  setize(S00,600);

JPanel panell new JPanelO,  JPanel panel2newJPaneJO; 

getContentPaneO.add(panell,BorderLayout.N ORTH); 

getContentPaneO.add(new JScrollPane(textArea),BorderLayout.CENTER),  getContentPane0.add(panel2,BorderLayout.S0UTH); 

panell.add(openFasta),  panell.add(check);  panell.add(save);  panel2.add(splabel) panel2.add(species);  panel2.add(setFolder) openFasta.addActionListener(出1s save.addActionListener(this);  check.addActionListener(this) setFolder.addActionListenerhis),

publistatic void main(StringD args) { 

new OrthologCheckerO. set Visible(true), 

/[聞く][保存]ボタンが押された時の処理 publivoid actionPerformed(ActnEventevent){ 

i(event.getSourceO.equals(openFasta) openFasO;

else if (event.getSourceO.equals(setFolder)){  try { 

setFolderO catch (FileNotFoundException e) { 

II TODO Auto generaertcatch block  eprintStackτ'taceO; 

catch (IO Exception e) { 

e.pnntStackτ'taceO, 

else if (event.getSourceO.equals(save)){  saveO; 

else if (event.getSourceO.equals(check)){  try { 

checkO,  catch (IO Exception e) { 

II TODO Auto generaertcatcblock  e.printStackτ'taceO; 

//ファイノレを聞くメソッド privavoidopenFasta

choosernewJFileChooserC:¥¥cDNAData  chooser.setFileFilter(new FastaFilterO int returnVal   chooser.showOpenDialog1is), try 

i(return Val二 二JFileChooser.APPROVEOPTION){  日lefilechooser.getSelectedFileO;  日lelnputStream inputnew FilelnputStream(file); 

} 

fasListSequenceUtil.readFasta(input) se'itle(file.getAbsolutePahO);

Sysem.out.println( 配列数 +fastaList.sizeO),

System.out.println(((FasSequence)fastaList.get(3))getlO), 

catch (FileNotFoundException event) {  event.printStackτ'taceO;  catch (IO Exception event) { 

event.printStackτ'taceO, 

//ファイルを保存するメソッド privavoidsaveO { 

} 

int returnVal   chooser.showSaveDialog(this),  try 

i(return Val二 二JFileChooser.APPROVEOPTION

} 

日leWrerfWriter new FileWriter(chooser.getSelectedFileO) xtArea.write(fWriter);

catc(FileNotFoundException event) {  event.printStackτ'taceO;  catc(IException event) { 

event.printStackτ'taceO, 

llsetFolderメソッド

privaevoid setFolderthrows FileNotFoundException,IOExceptio choosernewJFileChooserC:¥¥cDNAData 

chooser.setFileSelectionMode(JFileChooser.DIRECTORIES ONLY int returnVa chooser.showOpenDialog1is);

i(return Val二 二JFileChooser.APPROVEOPTION){ 

lef chooser.getSelectedFileO; se'itle紅白getAbsolutePathO); saveadressfile.getAbsolutePathO,

}  II checkメソッド

private void checkOhrowsFileNotFoundException,IOException  日lefile new FileC:¥¥cDNAData¥¥originalAlignments Stringorthologlistfile.list(new FastaNameFilrO); se'itle(file.getAbsolutePathO);

IIStrinfileAdress file.getAbsoluPath0,  String spname species.getTextO; 

mt count0, mt multicount 0, 

Lis.FastaSequence>notOrtholognewArrayListO,  boolean hit

for (ini~o; ifastaList.sizeO; i++){ 

String name fasList.get(i).getldO, String id FbgnFiler.fbgnfilter(name), hitfalse; 

for (int jo;j< orthologlist.lengthj++) 

if (orthologlist.indexOf(id)七 1){

hittme; 

Strinseq fasList.get(i)getSequenceO llc,ntig名の読み取り

String contigFbgnFilter.contigfilter(narr

//ファイノレへの書き込み設定

lpsString), 

l γ.fasl

if(hit二 二false){

noOrtholog.add(fastaList.get(i)),

StrinproName saveadress¥¥Prat'+ i+".fas

//ヌクレオチドシーケンスの作成

FastaSequence nucFsnewFastaSequence(spname +(+ conti+)seq),  ArrayList<FasaSequence>nucListnewArrayList<FastaSequence>O; 

//既存ファイノレの確認

File existNuc new File(nucName f(exisNuc.exis0){

nucNamesaveadress+ ¥+ id+(+contig +)+.fas ta,  nucList.add(nucFs), 

FastaSequence fsLast new FastaSequence(i+(+ contig +),seq), 

//アミノ酸シーケンスの作成

DNASequence dneDNASequence(seq),  RNASequence rsds.getRNASequenceO PrnteinSequence prs.getProteinSequenceO String psString ps.getSequenceAsStringO; 

FastaSequence proFs  new  FastaSequence(spname + ( +  contig  +  ArrayList<Fas回目equence>proList new ArrayList<FastaSequence>O

//既存ファイノレの確認

File existPro new File(proName),  f(existNuc.exis0){

proName  saveadress¥¥Prat¥¥ + id +"("  + contig  + 

proList.add(proFs), 

//オーソログ遺伝子の表示、リスのストック textArea.append(id+¥n 

fastaList3.add(fsLast);  f(proList.sizeO> 1){ 

System.out.println(id+ 複数ヒットしました。l),

multicount+,

}  count++, 

OutputStream nucOnew FileOutputStream(nucName),  SequenceUtil.wriFasta(nucOs,nucList)

nucOs.closeO; 

OutputStream proOnew FileOutputStream(proName),  SequenceUtil.wriFasproOs,prjst);

proOs.closeO; 

} 

String otherGeneAdress saveadress +¥¥notOrthologList.fasta";  OutputStream notOrthologOs new FileOutputStream(oherGeneAdress

SequenceUtil.wri日FasnoOrthologOs,notOrtholog);  notOrhologOs.closeO;

textArea.append(全lCoun+ 遺伝子座でオーソログが見つかりました。) 

ysm.out.println(全+multicount + 遺伝子座で複数ヒツトしました" i1  return Valuechooser.showSaveDialog(this);

try { 

i(return Value二 二JFileChcoser.APPROVEOPTION) 

OutputStream os new FileOutputStream(chooser.getSelectedFileO),  org.biojava3.dasequence.SequenceUtil.writeFasta(os,fastaList3); 

} 

catch (FileNotFoundException event) {  event.printStackτ'taceO;  catch (IException event) { 

event.printStackτ'taceO, 

Fasta name filter 

package practice import java.io.File,  import java.io.FilenameFilter, 

public class FastaNameFilter implements FilenameFilter  public FastaNameFilter

II TODO Auto generated constructor stub 

@Override 

public boolean accept(File d民 日 町 昭name){

inindexname.lastlndexOf(11拡張千の を探す II.以下の文字列を取りして全て小文字に Strinext name.substring(index+ 1)tolρwerCaseO, 

//拡張子が"txtと一致すれば取り出す if(ext.indexOf(fas?二一1){

return true, 

Hそれ以外のファイノレはリストアップしない return false

Fasta filter 

package practice import java.io.File, 

import javax.swing.filechooser.FileFilter, 

public class FastaFilter extends FileFilr{

publiboolean accept (File file) {  ilenull){ 

//ディレクトリ判定 if (file.isDirectoryO)  }else { 

return true,  H拡張子判定

StrinextgetExtension(file) if (ext 1~ null & &  ext.indexOf(fas 1){ 

returtrue; 

//trueが返らなかったとき return false, 

//拡張子を取得するメソッド

priva回 目tri getExtension(Filefile if(file二 二null) else { 

return null

//ファイノレ名を取得

String namefile.getNameO

//最後のピリオド位置を取得 mt period name.lastlndexOf(' '), 

if (period> & &  period< name.lengthO 1

//拡張千を小文字で返す

1turnname.substring(period 1).tolwerCaseO, else { 

return null

publiString getDescription

returnFas taファイノレ(安.fasta

Profile and multiple Alignment batch script creator 

package practice

import java.awt.BorderLayout import java.awt.EventQueue,  import javax.swing.JFileChooser,  import javax.swing.JFrame import javax.swing.JPaneJ; 

import javax.swing.border.EmptyBorder import javax.swing.GroupLayout import javax.swing.GroupLayout.Alignment import javax.swing.JTextField

import javax.swing.JLabeL 

import javax.swing.LayoutStle. ComponentPlacement import javax.swing.JBu抗,n,

import javax.swing.AbstractAction,  import java.awt.event.ActionEvent impojava.io.BulieredWrer; import java.io.File;  imporjava.io.FileWriter, import java.io.IOException imporjava.util.ArrayList; import java. util. Collections impojava.uIl.regex.Matcher, import java. util.regex.Pattern;  import javax.swing.Action

import org.biojava3.data.sequence.Fas回目equence, impojavax.swing.JTextArea,

import java.awt.Scrollbar impojavax.swing.JScrollPane,

publiclass ProfileA!ignmentbyClustaexendsJFrame  pnvaeJPanel contentPane, 

privaJTextFieldnewSeqAdress privaJTextFieldorthologAdSS,

privaJTextFieldtextField 2

priva回JFileChooserfilecho沼 田newJFileChooser(℃:¥¥cIINADa privafinalAction actionnew SwingActionO

privafinalAction action  1 new SwingAction 10 privafinalAction action 2 new SwingAction 20 privaJTextAreatextArea new JTexieaO; privaArrayList seqlist: 

privaArrayListindelLisU/ヒットエリアリストのリストseqlistと同じ数だけ存在 privaArrayListhi回 目aLisU/各配列内のインデノレリスト

privaArrayList<FastaSequence>fastaListnewArrayList<FastaSequence>O privaArrayList<FastaSequence>fastaList2newArrayList<FastaSequence>O priva回 目nalAction actn 3newSwingAction 30

privafinalAction actin 4newSwingAction 40

/** 

Launch thapplication 

*

publistatic void main(Stringargs){ 

EventQueue.invokeLater(new RunnableO  public void runO { 

tr

PrnfileA!ignmentbyC!ustal framenew ProfileA!ignmentbyC!ustalO frame.setVisible(true); 

catch (Exception e) {  e.printStackτ'taceO, 

 

/** 

Create the frame 

*

publiProfileA!ignmentbyClustaIO { 

setilefaultC!oseOperation(JFrame.EXIT ON CLOSE) setBounds(lOO100571633)

contentPanenewJPaneIO

contentPane.setBorder(new EmptyBorder(5555 setContentPane(contentPane)

neweqAdressnew JTextFieldO,  newSeqAdress.setColumns(lO); 

JLabel  label  new 

JLabel(u65BO¥u305F¥u306B¥u30A2¥u30E9¥u30A4¥u30E1¥u30F3¥u30C8¥u3059¥u308B¥u7A2E¥u3092¥u542B¥u3080¥u30D5¥u30A9¥u30

¥u30C

l

ドキュメント内 修 士 学 位 論 文 (ページ 43-103)

関連したドキュメント